]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: accessors for num_pgs
authorSage Weil <sage@redhat.com>
Mon, 2 Apr 2018 14:08:51 +0000 (09:08 -0500)
committerSage Weil <sage@redhat.com>
Wed, 4 Apr 2018 13:27:00 +0000 (08:27 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc
src/osd/OSD.h

index f0d7ee390fa3bcd14c469f3c9ec6c86b0f38cd9d..37f175d22e2c90c016535facff72d75297ded1a2 100644 (file)
@@ -9290,7 +9290,7 @@ void OSDShard::_attach_pg(OSDShardPGSlot *slot, PG *pg)
   slot->pg = pg;
   pg->osd_shard = this;
   pg->pg_slot = slot;
-  ++osd->num_pgs;
+  osd->inc_num_pgs();
 
   slot->epoch = pg->get_osdmap_epoch();
   pg_slots_by_epoch.insert(*slot);
@@ -9302,7 +9302,7 @@ void OSDShard::_detach_pg(OSDShardPGSlot *slot)
   slot->pg->osd_shard = nullptr;
   slot->pg->pg_slot = nullptr;
   slot->pg = nullptr;
-  --osd->num_pgs;
+  osd->dec_num_pgs();
 
   pg_slots_by_epoch.erase(pg_slots_by_epoch.iterator_to(*slot));
   slot->epoch = 0;
index 36cdec86a7d535dfc8f4d0185ffa2736f9d00204..53f20ef1b074054e5c004380ad572f2092e89092 100644 (file)
@@ -1858,10 +1858,17 @@ public:
   vector<OSDShard*> shards;
   uint32_t num_shards = 0;
 
+  void inc_num_pgs() {
+    ++num_pgs;
+  }
+  void dec_num_pgs() {
+    --num_pgs;
+  }
+
+protected:
   // -- placement groups --
   std::atomic<size_t> num_pgs = {0};
 
-protected:
   std::mutex pending_creates_lock;
   using create_from_osd_t = std::pair<pg_t, bool /* is primary*/>;
   std::set<create_from_osd_t> pending_creates_from_osd;