]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDMapMapping: put mappings in a mempool
authorSage Weil <sage@redhat.com>
Mon, 6 Feb 2017 18:03:52 +0000 (13:03 -0500)
committerSage Weil <sage@redhat.com>
Thu, 16 Feb 2017 17:04:50 +0000 (12:04 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/include/mempool.h
src/mon/OSDMonitor.cc
src/osd/OSDMapMapping.cc
src/osd/OSDMapMapping.h

index b89451ee995f5cf149097bb18f04fd7521691ea7..7b4a59618e51fe708e3b5a856c3294381c15a500 100644 (file)
@@ -148,6 +148,7 @@ namespace mempool {
   f(buffer_meta)                     \
   f(buffer_data)                     \
   f(osd)                             \
+  f(osdmap_mapping)                  \
   f(unittest_1)                              \
   f(unittest_2)
 
index 51f7b2e861b6e6cfb336708936454c5bbec49eef..34b049b286c49e1a8042b89069958f0e87b71cce 100644 (file)
@@ -1054,7 +1054,7 @@ void OSDMonitor::maybe_prime_pg_temp()
     int n = chunk;
     std::unordered_set<pg_t> did_pgs;
     for (auto osd : osds) {
-      const vector<pg_t>& pgs = mapping->get_osd_acting_pgs(osd);
+      auto& pgs = mapping->get_osd_acting_pgs(osd);
       dout(20) << __func__ << " osd." << osd << " " << pgs << dendl;
       for (auto pgid : pgs) {
        if (!did_pgs.insert(pgid).second) {
index 5a4c84b54a8ba0561a3d0315f7a944c417a6e93d..14165a156dc0a5e382cf53e2d879d3239b7301f1 100644 (file)
@@ -8,6 +8,9 @@
 
 #include "common/debug.h"
 
+MEMPOOL_DEFINE_OBJECT_FACTORY(OSDMapMapping, osdmapmapping,
+                             osdmap_mapping);
+
 // ensure that we have a PoolMappings for each pool and that
 // the dimensions (pg_num and size) match up.
 void OSDMapMapping::_init_mappings(const OSDMap& osdmap)
index e18b57493144d9af838b63e07b20a88eb46d28d6..51a445db5acbe6575dadceef5b5d99c6db369fbe 100644 (file)
@@ -167,10 +167,16 @@ public:
 
 /// a precalculated mapping of every PG for a given OSDMap
 class OSDMapMapping {
+public:
+  MEMPOOL_CLASS_HELPERS();
+private:
+
   struct PoolMapping {
+    MEMPOOL_CLASS_HELPERS();
+
     unsigned size = 0;
     unsigned pg_num = 0;
-    std::vector<int32_t> table;
+    mempool::osdmap_mapping::vector<int32_t> table;
 
     size_t row_size() const {
       return
@@ -233,9 +239,10 @@ class OSDMapMapping {
     }
   };
 
-  std::map<int64_t,PoolMapping> pools;
-  std::vector<std::vector<pg_t>> acting_rmap;  // osd -> pg
-  //unused: std::vector<std::vector<pg_t>> up_rmap;  // osd -> pg
+  mempool::osdmap_mapping::map<int64_t,PoolMapping> pools;
+  mempool::osdmap_mapping::vector<
+    mempool::osdmap_mapping::vector<pg_t>> acting_rmap;  // osd -> pg
+  //unused: mempool::osdmap_mapping::vector<std::vector<pg_t>> up_rmap;  // osd -> pg
   epoch_t epoch;
   uint64_t num_pgs = 0;
 
@@ -281,7 +288,7 @@ public:
     p->second.get(pgid.ps(), up, up_primary, acting, acting_primary);
   }
 
-  const std::vector<pg_t>& get_osd_acting_pgs(unsigned osd) {
+  const mempool::osdmap_mapping::vector<pg_t>& get_osd_acting_pgs(unsigned osd) {
     assert(osd < acting_rmap.size());
     return acting_rmap[osd];
   }