From b8b0fd2543ceb2978a75772969c7a8afb35453a9 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Thu, 27 Feb 2020 16:07:50 +0100 Subject: [PATCH] osd: refactor PrimaryLogPG::earliest_backfill(). Signed-off-by: Radoslaw Zarzynski --- src/osd/PrimaryLogPG.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index eeb5a69e0d8..21244c62de1 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -1799,13 +1799,9 @@ void PrimaryLogPG::do_request( hobject_t PrimaryLogPG::earliest_backfill() const { hobject_t e = hobject_t::get_max(); - for (set::const_iterator i = get_backfill_targets().begin(); - i != get_backfill_targets().end(); - ++i) { - pg_shard_t bt = *i; + for (const pg_shard_t& bt : get_backfill_targets()) { const pg_info_t &pi = recovery_state.get_peer_info(bt); - if (pi.last_backfill < e) - e = pi.last_backfill; + e = std::min(pi.last_backfill, e); } return e; } -- 2.39.5