Signed-off-by: Sage Weil <sage@redhat.com>
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);
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;
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;