]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/CInode: Optimize only pinned by subtrees check 36288/head
authorMark Nelson <mnelson@redhat.com>
Fri, 24 Jul 2020 05:29:15 +0000 (05:29 +0000)
committerMark Nelson <mnelson@redhat.com>
Tue, 28 Jul 2020 02:38:26 +0000 (02:38 +0000)
Fixes: https://tracker.ceph.com/issues/46727
Signed-off-by: Mark Nelson <mnelson@redhat.com>
src/mds/CInode.h
src/mds/MDCache.cc

index 1e055cf99f9db3011d47152a70ac16db2abaaa7d..60da4fb98765f2603b6586cba22dfb77a994fd0f 100644 (file)
@@ -579,6 +579,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 6bbe7e8638eb3cc418cde6c9f4a30230e216a584..ff877c150ca2ec22876d712d466814ff50f2f68f 100644 (file)
@@ -6837,9 +6837,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.