From 60b93a71d12ca775e31df05d6ecf22f2e8cbbcea Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Tue, 2 Oct 2012 16:55:50 +0800 Subject: [PATCH] mds: Trim non auth subtree directory Trim non auth subtree directory if all its dentries were trimmed and it's not bound of auth subtree. Signed-off-by: Yan, Zheng --- src/mds/MDCache.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 1348b3e1f42d..6894a9d5ef69 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -5412,6 +5412,17 @@ bool MDCache::trim(int max) ++i) lru.lru_insert_mid(*i); + // trim non-auth, non-bound subtrees + for (map >::iterator p = subtrees.begin(); + p != subtrees.end();) { + CDir *dir = p->first; + p++; + if (!dir->is_auth() && !dir->get_inode()->is_auth()) { + if (dir->get_num_ref() == 1) // subtree pin + trim_dirfrag(dir, 0, expiremap); + } + } + // trim root? if (max == 0 && root) { list ls; -- 2.47.3