]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: refactor loops for better readability 34559/head
authorKefu Chai <kchai@redhat.com>
Wed, 15 Apr 2020 00:07:29 +0000 (08:07 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 15 Apr 2020 00:07:31 +0000 (08:07 +0800)
implement the suggestion proposed in #19076

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mon/OSDMonitor.cc

index b2ac411f2dc1ebbd792b8369792d04bd0c719711..6cb994b68c94f421aa33cfecec743d2774f42810 100644 (file)
@@ -405,10 +405,10 @@ void LastEpochClean::dump(Formatter *f) const
 {
   f->open_array_section("per_pool");
 
-  for (auto& it : report_by_pool) {
+  for (auto& [pool, lec] : report_by_pool) {
     f->open_object_section("pool");
-    f->dump_unsigned("poolid", it.first);
-    f->dump_unsigned("floor", it.second.floor);
+    f->dump_unsigned("poolid", pool);
+    f->dump_unsigned("floor", lec.floor);
     f->close_section();
   }
 
@@ -2240,10 +2240,10 @@ epoch_t OSDMonitor::get_min_last_epoch_clean() const
   auto floor = last_epoch_clean.get_lower_bound(osdmap);
   // also scan osd epochs
   // don't trim past the oldest reported osd epoch
-  for (auto& osd_epoch : osd_epochs) {
-    if (osd_epoch.second < floor &&
-        osdmap.is_out(osd_epoch.first)) {
-      floor = osd_epoch.second;
+  for (auto [osd, epoch] : osd_epochs) {
+    if (epoch < floor &&
+        osdmap.is_out(osd)) {
+      floor = epoch;
     }
   }
   return floor;