num_pgs is the most accurate value fore reserve when call _get_pgs &
_get_pgids.
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
void OSD::_get_pgs(vector<PGRef> *v, bool clear_too)
{
v->clear();
+ v->reserve(get_num_pgs());
for (auto& s : shards) {
std::lock_guard l(s->shard_lock);
for (auto& j : s->pg_slots) {
void OSD::_get_pgids(vector<spg_t> *v)
{
v->clear();
+ v->reserve(get_num_pgs());
for (auto& s : shards) {
std::lock_guard l(s->shard_lock);
for (auto& j : s->pg_slots) {