]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD/PG: fix calc of misplaced objects 18528/head
authorKefu Chai <kchai@redhat.com>
Wed, 25 Oct 2017 06:29:18 +0000 (14:29 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 25 Oct 2017 06:29:40 +0000 (14:29 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/osd/PG.cc

index 988114056bbedabff69c34abfd58580caca0c4d1..01c2dc8286b3dc3b585f1864164448b5d15621bc 100644 (file)
@@ -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;