Merge pull request #34559 from tchaikov/wip-19076-refactor

mon/OSDMonitor: refactor loops for better readability

Reviewed-by: Joao Eduardo Luis <joao@suse.de>
Reviewed-by: Brad Hubbard <bhubbard@redhat.com>
This commit is contained in:
Kefu Chai 2020-04-23 10:34:26 +08:00 committed by GitHub
commit e6fe7f44af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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;