From: Kefu Chai Date: Wed, 25 Oct 2017 06:29:18 +0000 (+0800) Subject: OSD/PG: fix calc of misplaced objects X-Git-Tag: v13.0.1~415^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F18528%2Fhead;p=ceph.git OSD/PG: fix calc of misplaced objects Signed-off-by: Kefu Chai --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 988114056bbe..01c2dc8286b3 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2637,11 +2637,12 @@ void PG::_update_calc_stats() // Add recovery objects not part of actingbackfill to be used to reduce // degraded and account as misplaced. - for (auto i = peer_info.begin() ; i != peer_info.end() ; ++i) { - if (actingbackfill.find(i->first) == actingbackfill.end()) - object_copies += i->second.stats.stats.sum.num_objects; - misplaced += i->second.stats.stats.sum.num_objects; + for (const auto& peer : peer_info) { + if (actingbackfill.find(peer.first) == actingbackfill.end()) { + object_copies += peer.second.stats.stats.sum.num_objects; + misplaced += peer.second.stats.stats.sum.num_objects; ++num_misplaced; + } } if (object_copies) dout(20) << __func__ << " objects not part of up/acting " << object_copies << dendl;