From: Yan, Zheng Date: Tue, 2 Oct 2012 08:55:50 +0000 (+0800) Subject: mds: Trim non auth subtree directory X-Git-Tag: v0.54~124^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=60b93a71d12ca775e31df05d6ecf22f2e8cbbcea;p=ceph.git 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 --- 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;