From 6a865f805b723525358ed8e79bb3d41709e98bf3 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Fri, 24 Jul 2020 05:29:15 +0000 Subject: [PATCH] mds/CInode: Optimize only pinned by subtrees check Fixes: https://tracker.ceph.com/issues/46727 Signed-off-by: Mark Nelson --- src/mds/CInode.h | 3 +++ src/mds/MDCache.cc | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 1e055cf99f9db..60da4fb98765f 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -579,6 +579,9 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter 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. -- 2.39.5