From: Radoslaw Zarzynski Date: Thu, 9 Jul 2020 14:28:27 +0000 (+0200) Subject: osd: refactor needs_recovery() and needs_backfill() of PeeringState. X-Git-Tag: wip-pdonnell-testing-20200918.022351~657^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c6cc18de4eed1b1fefc9896b56a5226dc309112c;p=ceph-ci.git osd: refactor needs_recovery() and needs_backfill() of PeeringState. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index f783659d439..5daf8fbb49e 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -1355,11 +1355,10 @@ bool PeeringState::needs_recovery() const } ceph_assert(!acting_recovery_backfill.empty()); - auto end = acting_recovery_backfill.end(); - auto a = acting_recovery_backfill.begin(); - for (; a != end; ++a) { - if (*a == get_primary()) continue; - pg_shard_t peer = *a; + for (const pg_shard_t& peer : acting_recovery_backfill) { + if (peer == get_primary()) { + continue; + } auto pm = peer_missing.find(peer); if (pm == peer_missing.end()) { psdout(10) << __func__ << " osd." << peer << " doesn't have missing set" @@ -1383,11 +1382,9 @@ bool PeeringState::needs_backfill() const // We can assume that only possible osds that need backfill // are on the backfill_targets vector nodes. - auto end = backfill_targets.end(); - auto a = backfill_targets.begin(); - for (; a != end; ++a) { - pg_shard_t peer = *a; + for (const pg_shard_t& peer : backfill_targets) { auto pi = peer_info.find(peer); + ceph_assert(pi != peer_info.end()); if (!pi->second.last_backfill.is_max()) { psdout(10) << __func__ << " osd." << peer << " has last_backfill " << pi->second.last_backfill << dendl;