From: Xiubo Li Date: Wed, 30 Dec 2020 09:17:56 +0000 (+0800) Subject: client: simplify the iterating code X-Git-Tag: v14.2.22~25^2~2^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de53324e2ed213b54996d5a5345721a9feffd98a;p=ceph.git client: simplify the iterating code Signed-off-by: Xiubo Li (cherry picked from commit 1bea6e5135148169baaf656563bb1acbe6a593b6) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 62a4a2b0566d5..06d3b510fa7e0 100755 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -4738,18 +4738,12 @@ void Client::update_snap_trace(const bufferlist& bl, SnapRealm **realm_ret, bool put_snap_realm(realm); } - for (map::iterator q = dirty_realms.begin(); - q != dirty_realms.end(); - ++q) { - SnapRealm *realm = q->first; + for (auto &[realm, snapc] : dirty_realms) { // if there are new snaps ? - if (has_new_snaps(q->second, realm->get_snap_context())) { + if (has_new_snaps(snapc, realm->get_snap_context())) { ldout(cct, 10) << " flushing caps on " << *realm << dendl; - xlist::iterator r = realm->inodes_with_caps.begin(); - while (!r.end()) { - Inode *in = *r; - ++r; - queue_cap_snap(in, q->second); + for (auto&& in : realm->inodes_with_caps) { + queue_cap_snap(in, snapc); } } else { ldout(cct, 10) << " no new snap on " << *realm << dendl;