From: Yan, Zheng Date: Wed, 4 Sep 2013 02:05:10 +0000 (+0800) Subject: mds: touch dentry bottom recursively X-Git-Tag: v0.71~90^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=298c39f2f596bf94e0b287b543e3aa6286ae453f;p=ceph.git mds: touch dentry bottom recursively 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 --- diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 2b991d78fdec..c7527419e477 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -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& snaps) { diff --git a/src/mds/CDir.h b/src/mds/CDir.h index 7cf2b6a43d7d..86da4e5dfd30 100644 --- a/src/mds/CDir.h +++ b/src/mds/CDir.h @@ -357,6 +357,7 @@ private: void remove_null_dentries(); void purge_stale_snap_data(const set& snaps); public: + void touch_dentries_bottom(); bool try_trim_snap_dentry(CDentry *dn, const set& snaps); diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 9d59b70249a3..7bbbacee234d 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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); } } diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index b4b57da84b2b..1673ad8076ad 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -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 ls; + in->get_dirfrags(ls); + for (list::iterator p = ls.begin(); p != ls.end(); ++p) + (*p)->touch_dentries_bottom(); + } + } } protected: