]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: touch dentry bottom recursively
authorYan, Zheng <zheng.z.yan@intel.com>
Wed, 4 Sep 2013 02:05:10 +0000 (10:05 +0800)
committerYan, Zheng <zheng.z.yan@intel.com>
Thu, 19 Sep 2013 06:01:02 +0000 (14:01 +0800)
Deleted directory inode's dirfrags may contain some null dentries.
When touch_dentry_bottom() is called, also move these null dentries
to the tail of LRU.

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

index 2b991d78fdecbf62cae0aa332170d655c4c6cbb0..c7527419e4771f20763bf7994393d824a5ba3f1a 100644 (file)
@@ -655,6 +655,14 @@ void CDir::remove_null_dentries() {
   assert(get_num_any() == items.size());
 }
 
+void CDir::touch_dentries_bottom() {
+  dout(12) << "touch_dentries_bottom " << *this << dendl;
+
+  for (CDir::map_t::iterator p = items.begin();
+       p != items.end();
+       ++p)
+    inode->mdcache->touch_dentry_bottom(p->second);
+}
 
 bool CDir::try_trim_snap_dentry(CDentry *dn, const set<snapid_t>& snaps)
 {
index 7cf2b6a43d7d97f7314782f0c418148e3c3f68b0..86da4e5dfd30485a7e60195e0fdc7c849579ab37 100644 (file)
@@ -357,6 +357,7 @@ private:
   void remove_null_dentries();
   void purge_stale_snap_data(const set<snapid_t>& snaps);
 public:
+  void touch_dentries_bottom();
   bool try_trim_snap_dentry(CDentry *dn, const set<snapid_t>& snaps);
 
 
index 9d59b70249a313a153522ddb05ada88fe17094ac..7bbbacee234de7653689ca5d5d20e831a889aab3 100644 (file)
@@ -10640,7 +10640,7 @@ void MDCache::handle_dentry_unlink(MDentryUnlink *m)
            !in->state_test(CInode::STATE_EXPORTINGCAPS))
          migrator->export_caps(in);
        
-       lru.lru_bottouch(straydn);  // move stray to end of lru
+       touch_dentry_bottom(straydn); // move stray to end of lru
        straydn = NULL;
       } else {
        assert(!straydn);
@@ -10650,7 +10650,7 @@ void MDCache::handle_dentry_unlink(MDentryUnlink *m)
       assert(dnl->is_null());
       
       // move to bottom of lru
-      lru.lru_bottouch(dn);
+      touch_dentry_bottom(dn);
     }
   }
 
index b4b57da84b2b34038d732ad06b48cb8f17653f88..1673ad8076ad2acd415fec5cf87b1a9b24237bd5 100644 (file)
@@ -646,6 +646,15 @@ public:
   }
   void touch_dentry_bottom(CDentry *dn) {
     lru.lru_bottouch(dn);
+    if (dn->get_projected_linkage()->is_primary()) {
+      CInode *in = dn->get_projected_linkage()->get_inode();
+      if (in->has_dirfrags()) {
+       list<CDir*> ls;
+       in->get_dirfrags(ls);
+       for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p)
+         (*p)->touch_dentries_bottom();
+      }
+    }
   }
 protected: