From: Yan, Zheng Date: Mon, 31 Mar 2014 01:20:30 +0000 (+0800) Subject: mds: trim non-auth subtree more aggressively X-Git-Tag: v0.79~27^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ff44a99a59c1f8312bc94a20f3797ab450af706c;p=ceph.git mds: trim non-auth subtree more aggressively When a non-auth dirfrag is pinned by uncommitted slave update, there still can be non-auth child dirfrags that are trimmable. Signed-off-by: Yan, Zheng --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index dcac6ecccb17..b75bab0b19fd 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -6690,10 +6690,8 @@ bool MDCache::trim_non_auth_subtree(CDir *dir) { dout(10) << "trim_non_auth_subtree(" << dir << ") " << *dir << dendl; - if (!can_trim_non_auth_dirfrag(dir)) - return true; + bool keep_dir = !can_trim_non_auth_dirfrag(dir); - bool keep_dir = false; CDir::map_t::iterator j = dir->begin(); CDir::map_t::iterator i = j; while (j != dir->end()) { @@ -6710,12 +6708,10 @@ bool MDCache::trim_non_auth_subtree(CDir *dir) for (list::iterator subdir = subdirs.begin(); subdir != subdirs.end(); ++subdir) { - if ((*subdir)->is_subtree_root() || - !can_trim_non_auth_dirfrag(*subdir)) { + if ((*subdir)->is_subtree_root()) { keep_inode = true; - dout(10) << "trim_non_auth_subtree(" << dir << ") subdir " << *subdir << "is kept!" << dendl; - } - else { + dout(10) << "trim_non_auth_subtree(" << dir << ") keeping " << **subdir << dendl; + } else { if (trim_non_auth_subtree(*subdir)) keep_inode = true; else { @@ -6734,8 +6730,9 @@ bool MDCache::trim_non_auth_subtree(CDir *dir) dir->remove_dentry(dn); } else { dout(20) << "trim_non_auth_subtree(" << dir << ") keeping inode " << in << " with dentry " << dn <is_null()) { // keep null dentry for slave rollback + dout(20) << "trim_non_auth_subtree(" << dir << ") keeping dentry " << dn <is_remote()) @@ -6747,7 +6744,7 @@ bool MDCache::trim_non_auth_subtree(CDir *dir) * We've now checked all our children and deleted those that need it. * Now return to caller, and tell them if *we're* a keeper. */ - return keep_dir; + return keep_dir || dir->get_num_any(); } /*