]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/CInode: Optimize only pinned by subtrees check 36965/head
authorMark Nelson <mnelson@redhat.com>
Fri, 24 Jul 2020 05:29:15 +0000 (05:29 +0000)
committerVicente Cheng <freeze.bilsted@gmail.com>
Mon, 5 Oct 2020 15:34:19 +0000 (15:34 +0000)
Fixes: https://tracker.ceph.com/issues/46727
Signed-off-by: Mark Nelson <mnelson@redhat.com>
(cherry picked from commit 6a865f805b723525358ed8e79bb3d41709e98bf3)

Conflicts:
src/mds/MDCache.cc
  - use the nautilus code flow of trim instead master

src/mds/CInode.h
src/mds/MDCache.cc

index 6809d52fc5e23476f25186ed9b49fdb2df7ae01a..cbe8779a20188f2edb06ce72e8d31524508b07a5 100644 (file)
@@ -600,6 +600,9 @@ public:
         ls.push_back(dir);
     }
   }
+  int get_num_subtree_roots() const {
+    return num_subtree_roots;
+  }
 
   CDir *get_or_open_dirfrag(MDCache *mdcache, frag_t fg);
   CDir *add_dirfrag(CDir *dir);
index f771ca5455622df2c5b8077c8c731b09d5097838..629e53abb2747cfac2b0c037451a454bc5db4fed 100644 (file)
@@ -6706,9 +6706,7 @@ std::pair<bool, uint64_t> MDCache::trim(uint64_t count)
       if (!diri->is_auth()) {
        if (dir->get_num_ref() > 1)  // only subtree pin
          continue;
-       list<CDir*> ls;
-       diri->get_subtree_dirfrags(ls);
-       if (diri->get_num_ref() > (int)ls.size()) // only pinned by subtrees
+       if (diri->get_num_ref() > diri->get_num_subtree_roots())
          continue;
 
        // don't trim subtree root if its auth MDS is recovering.