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

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

index 22cdc6e7bef32f64bdca73692a63280896b547de..b5d6465cc1f3c6637380e31e45fba18920f9f1ac 100644 (file)
@@ -575,6 +575,9 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
     get_subtree_dirfrags(v);
     return v;
   }
+  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 88eece19f00bb485c42581b7cc838641626986bd..d131edccb878c8dc03049cdab2c0f774ea404fc1 100644 (file)
@@ -6819,9 +6819,9 @@ std::pair<bool, uint64_t> MDCache::trim(uint64_t count)
       }
     } else if (!diri->is_auth() && dir->get_num_ref() <= 1) {
       // only subtree pin
-      auto&& ls = diri->get_subtree_dirfrags();
-      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.
       // This simplify the cache rejoin code.