mirror of
https://github.com/ceph/ceph
synced 2025-02-22 18:47:18 +00:00
osd: accessors for num_pgs
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
bfbf2044b2
commit
a01d2dfc87
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user