diff options
-rw-r--r-- | src/mds/CDir.cc | 8 | ||||
-rw-r--r-- | src/mds/CDir.h | 1 | ||||
-rw-r--r-- | src/mds/MDCache.cc | 4 | ||||
-rw-r--r-- | src/mds/MDCache.h | 9 |
4 files changed, 20 insertions, 2 deletions
diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index 2b991d78fde..c7527419e47 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<snapid_t>& snaps) { diff --git a/src/mds/CDir.h b/src/mds/CDir.h index 7cf2b6a43d7..86da4e5dfd3 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<snapid_t>& snaps); public: + void touch_dentries_bottom(); bool try_trim_snap_dentry(CDentry *dn, const set<snapid_t>& snaps); diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 9d59b70249a..7bbbacee234 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 b4b57da84b2..1673ad8076a 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<CDir*> ls; + in->get_dirfrags(ls); + for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p) + (*p)->touch_dentries_bottom(); + } + } } protected: |