From 16c4c8bb187027762ad3de5e6683999a758088e7 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Fri, 1 Nov 2019 13:42:16 -0700 Subject: [PATCH] mds: simplify type declarations This is a trivial refactor. Signed-off-by: Patrick Donnelly --- src/mds/MDCache.cc | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index b59a7a07612..1dae1c3e168 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -3959,15 +3959,13 @@ void MDCache::rejoin_send_rejoins() // if i am rejoining, send a rejoin to everyone. // otherwise, just send to others who are rejoining. - for (set::iterator p = recovery_set.begin(); - p != recovery_set.end(); - ++p) { - if (*p == mds->get_nodeid()) continue; // nothing to myself! - if (rejoin_sent.count(*p)) continue; // already sent a rejoin to this node! + for (const auto& rank : recovery_set) { + if (rank == mds->get_nodeid()) continue; // nothing to myself! + if (rejoin_sent.count(rank)) continue; // already sent a rejoin to this node! if (mds->is_rejoin()) - rejoins[*p] = make_message(MMDSCacheRejoin::OP_WEAK); - else if (mds->mdsmap->is_rejoin(*p)) - rejoins[*p] = make_message(MMDSCacheRejoin::OP_STRONG); + rejoins[rank] = make_message(MMDSCacheRejoin::OP_WEAK); + else if (mds->mdsmap->is_rejoin(rank)) + rejoins[rank] = make_message(MMDSCacheRejoin::OP_STRONG); } if (mds->is_rejoin()) { @@ -4092,7 +4090,7 @@ void MDCache::rejoin_send_rejoins() if (!q.first->is_auth()) { ceph_assert(q.second == q.first->authority().first); if (rejoins.count(q.second) == 0) continue; - const ref_t &rejoin = rejoins[q.second]; + const auto& rejoin = rejoins[q.second]; dout(15) << " " << *mdr << " authpin on " << *q.first << dendl; MDSCacheObjectInfo i; @@ -4115,7 +4113,7 @@ void MDCache::rejoin_send_rejoins() if (q.is_xlock() && !obj->is_auth()) { mds_rank_t who = obj->authority().first; if (rejoins.count(who) == 0) continue; - const ref_t &rejoin = rejoins[who]; + const auto& rejoin = rejoins[who]; dout(15) << " " << *mdr << " xlock on " << *lock << " " << *obj << dendl; MDSCacheObjectInfo i; @@ -4129,7 +4127,7 @@ void MDCache::rejoin_send_rejoins() } else if (q.is_remote_wrlock()) { mds_rank_t who = q.wrlock_target; if (rejoins.count(who) == 0) continue; - const ref_t &rejoin = rejoins[who]; + const auto& rejoin = rejoins[who]; dout(15) << " " << *mdr << " wrlock on " << *lock << " " << *obj << dendl; MDSCacheObjectInfo i; @@ -4700,7 +4698,7 @@ void MDCache::handle_cache_rejoin_strong(const cref_t &strong) const auto it = strong->strong_dentries.find(dirfrag); if (it != strong->strong_dentries.end()) { - const map& dmap = it->second; + const auto& dmap = it->second; for (const auto &q : dmap) { const string_snap_t& ss = q.first; const MMDSCacheRejoin::dn_strong& d = q.second; -- 2.39.5