]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: simplify loops to range-for
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 11 Apr 2017 19:06:22 +0000 (15:06 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Thu, 13 Apr 2017 03:17:31 +0000 (23:17 -0400)
No functional change.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/MDBalancer.cc
src/mds/MDCache.cc
src/mds/Migrator.cc

index 4914e76551713774deb2ae926465ed4383ba3852..f52abe0f61c23fadb32ad9a8e10b915a9ff85a9a 100644 (file)
@@ -337,14 +337,10 @@ void MDBalancer::export_empties()
 {
   dout(5) << "export_empties checking for empty imports" << dendl;
 
-  for (map<CDir*,set<CDir*> >::iterator it = mds->mdcache->subtrees.begin();
-       it != mds->mdcache->subtrees.end();
-       ++it) {
-    CDir *dir = it->first;
-    if (!dir->is_auth() ||
-       dir->is_ambiguous_auth() ||
-       dir->is_freezing() ||
-       dir->is_frozen())
+  std::set<CDir *> subtrees;
+  mds->mdcache->get_fullauth_subtrees(subtrees);
+  for (auto &dir : subtrees) {
+    if (dir->is_freezing() || dir->is_frozen())
       continue;
 
     if (!dir->inode->is_base() &&
index 88832279d2fd060e0c29acedf7197608b60f0011..49577fc99b88767a6d1c758288b2496e587c0c74 100644 (file)
@@ -1257,19 +1257,15 @@ void MDCache::verify_subtree_bounds(CDir *dir, const set<CDir*>& bounds)
   if (bounds != subtrees[dir]) {
     dout(0) << "verify_subtree_bounds failed" << dendl;
     set<CDir*> b = bounds;
-    for (set<CDir*>::iterator p = subtrees[dir].begin();
-        p != subtrees[dir].end();
-        ++p) {
-      if (bounds.count(*p)) {
-       b.erase(*p);
+    for (auto &cd : subtrees[dir]) {
+      if (bounds.count(cd)) {
+       b.erase(cd);
        continue;
       }
-      dout(0) << "  missing bound " << **p << dendl;
+      dout(0) << "  missing bound " << *cd << dendl;
     }
-    for (set<CDir*>::iterator p = b.begin();
-        p != b.end();
-        ++p) 
-      dout(0) << "    extra bound " << **p << dendl;
+    for (const auto &cd : b)
+      dout(0) << "    extra bound " << *cd << dendl;
   }
   assert(bounds == subtrees[dir]);
 }
@@ -1281,10 +1277,8 @@ void MDCache::verify_subtree_bounds(CDir *dir, const list<dirfrag_t>& bounds)
 
   // make sure that any bounds i do have are properly noted as such.
   int failed = 0;
-  for (list<dirfrag_t>::const_iterator p = bounds.begin();
-       p != bounds.end();
-       ++p) {
-    CDir *bd = get_dirfrag(*p);
+  for (const auto &fg : bounds) {
+    CDir *bd = get_dirfrag(fg);
     if (!bd) continue;
     if (subtrees[dir].count(bd) == 0) {
       dout(0) << "verify_subtree_bounds failed: extra bound " << *bd << dendl;
index e55a3b266db0786c611b9b6a7ff18ea21ba40555..65b698118b3fad1f8ceeb47a7c6c6d829f33a151 100644 (file)
@@ -1700,10 +1700,7 @@ void Migrator::export_reverse(CDir *dir)
   }
   
   // unpin bounds
-  for (set<CDir*>::iterator p = bounds.begin();
-       p != bounds.end();
-       ++p) {
-    CDir *bd = *p;
+  for (const auto &bd : bounds) {
     bd->put(CDir::PIN_EXPORTBOUND);
     bd->state_clear(CDir::STATE_EXPORTBOUND);
   }