]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Trim non auth subtree directory
authorYan, Zheng <zheng.z.yan@intel.com>
Tue, 2 Oct 2012 08:55:50 +0000 (16:55 +0800)
committerSage Weil <sage@inktank.com>
Tue, 2 Oct 2012 18:26:19 +0000 (11:26 -0700)
Trim non auth subtree directory if all its dentries were trimmed
and it's not bound of auth subtree.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
src/mds/MDCache.cc

index 1348b3e1f42d0c8d9036cf25e2789fc141f0a03f..6894a9d5ef6971a8341562bc0f59954cf5667239 100644 (file)
@@ -5412,6 +5412,17 @@ bool MDCache::trim(int max)
       ++i)
     lru.lru_insert_mid(*i);
 
+  // trim non-auth, non-bound subtrees
+  for (map<CDir*, set<CDir*> >::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<CDir*> ls;