]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: optimize function, get_force_dirfrag_bound_set by using get_dirfrags_under 33198/head
authorSimon Gao <simon29rock@gmail.com>
Tue, 11 Feb 2020 09:24:09 +0000 (17:24 +0800)
committerSimon Gao <simon29rock@gmail.com>
Mon, 17 Feb 2020 05:08:49 +0000 (13:08 +0800)
  The frags of inode have been simplified. so the var named all is always false.
  Using the func, get_dirfrags_under, simplifies the logic. We've optimized this function before.

Signed-off-by: Simon Gao <simon29rock@gmail.com>
src/mds/MDCache.cc

index ca9fd8d7ee9796f6d84e87181cbf44a57b8fc3c2..2aac3d99ce71e5445f51137dc9e64bf837e1271b 100644 (file)
@@ -1166,7 +1166,6 @@ void MDCache::get_force_dirfrag_bound_set(const vector<dirfrag_t>& dfs, set<CDir
       frag_vec_t leaves;
       diri->dirfragtree.get_leaves_under(fg, leaves);
       if (leaves.empty()) {
-       bool all = true;
        frag_t approx_fg = diri->dirfragtree[fg.value()];
         frag_vec_t approx_leaves;
        tmpdft.get_leaves_under(approx_fg, approx_leaves);
@@ -1174,20 +1173,13 @@ void MDCache::get_force_dirfrag_bound_set(const vector<dirfrag_t>& dfs, set<CDir
          if (p->second.get().count(leaf) == 0) {
            // not bound, so the resolve message is from auth MDS of the dirfrag
            force_dir_fragment(diri, leaf);
-           all = false;
          }
        }
-       if (all)
-         leaves.push_back(approx_fg);
-       else
-         diri->dirfragtree.get_leaves_under(fg, leaves);
-      }
-      dout(10) << "  frag " << fg << " contains " << leaves << dendl;
-      for (const auto& leaf : leaves) {
-       CDir *dir = diri->get_dirfrag(leaf);
-       if (dir)
-         bounds.insert(dir);
       }
+
+      auto&& [complete, sibs] = diri->get_dirfrags_under(fg);
+      for (const auto& sib : sibs)
+       bounds.insert(sib);
     }
   }
 }