}
osd_num += osd_ids.size() - out_osd;
}
- if (pool >= 0) {
- // update an existing pool's pg num
- const auto& pg_info = osdmap.get_pools().at(pool);
- // already counted the pgs of this `pool` by iterating crush map, so
+ if (pool >= 0) {
+ // update an existing pool's pg num.
+ // already counted the pgs of this `pool` by iterating crush map, so
// remove them using adding the specified pg num
projected += pg_num * size;
- projected -= pg_info.get_pg_num_target() * pg_info.get_size();
+ projected -= mapping.get_num_acting_pgs(pool);
}
num_osds = std::max(osd_num, 3u); // assume min cluster size 3
} else {
row[4 + size + i] = up[i];
}
}
+
+ uint64_t get_num_acting_pgs() const {
+ uint64_t num_acting_pgs = 0;
+ const size_t row_size = this->row_size();
+ for (size_t ps = 0; ps < pg_num; ++ps) {
+ const int32_t *row = &table[row_size * ps];
+ num_acting_pgs += row[2];
+ }
+ return num_acting_pgs;
+ }
};
mempool::osdmap_mapping::map<int64_t,PoolMapping> pools;
return acting_rmap[osd];
}
+ uint64_t get_num_acting_pgs(int64_t pool) const {
+ auto p = pools.find(pool);
+ ceph_assert(p != pools.end());
+ return p->second.get_num_acting_pgs();
+ }
+
void update(const OSDMap& map, pg_t pgid);
std::unique_ptr<MappingJob> start_update(