]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: track dentries that should be trimmed quickly in separate list
authorYan, Zheng <zyan@redhat.com>
Mon, 10 Apr 2017 11:54:47 +0000 (19:54 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 11 May 2017 06:13:23 +0000 (14:13 +0800)
To trim a null dentry quickly, current method is moving it to bottom
of LRU list. The method depends on the cache size config and if there
is non-null dentry at the bottom of LRU list (MDCache::trim() keeps
trimming null dentries regardless of cache size config. It stops when
encountering a non-null dentry). MDS can move dentry of any type to
bottom of the LRU, so the method does not work as expected. Besides,
it's hard to extend the code to trim other type of dentry quickly.

The fix is use separate list to track dentries that should be trimmed
quickly. Both null dentries and non-auth stray dentries are added to
the list.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/CDentry.cc
src/mds/CDentry.h
src/mds/CDir.cc
src/mds/CDir.h
src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/MDLog.cc
src/mds/Migrator.cc
src/mds/Server.cc
src/mds/StrayManager.cc
src/mds/journal.cc

index 7eeba7e753cd591e834caef7cf02e173fb955965..44dc6d52a522b32405c98d896b900b98fc260ff5 100644 (file)
@@ -88,7 +88,9 @@ ostream& operator<<(ostream& out, const CDentry& dn)
 
   out << " inode=" << dn.get_linkage()->get_inode();
 
-  if (dn.is_new()) out << " state=new";
+  out << " state=" << dn.get_state();
+  if (dn.is_new()) out << "|new";
+  if (dn.state_test(CDentry::STATE_BOTTOMLRU)) out << "|bottomlru";
 
   if (dn.get_num_ref()) {
     out << " |";
index 175ce4fc1e7662a48301c059b759529b83aa36d7..01e3d3c4992041daa9ee9f8e753e3e97263a7c0a 100644 (file)
@@ -86,8 +86,10 @@ public:
   static const int STATE_BADREMOTEINO = (1<<3);
   static const int STATE_EVALUATINGSTRAY = (1<<4);
   static const int STATE_PURGINGPINNED =  (1<<5);
+  static const int STATE_BOTTOMLRU =    (1<<6);
   // stray dentry needs notification of releasing reference
   static const int STATE_STRAY =       STATE_NOTIFYREF;
+  static const int MASK_STATE_IMPORT_KEPT = STATE_BOTTOMLRU;
 
   // -- pins --
   static const int PIN_INODEPIN =     1;  // linked inode is pinned
@@ -289,7 +291,7 @@ public:
     ::decode(replica_map, blp);
 
     // twiddle
-    state = 0;
+    state &= MASK_STATE_IMPORT_KEPT;
     state_set(CDentry::STATE_AUTH);
     if (nstate & STATE_DIRTY)
       _mark_dirty(ls);
index 03ba644631ecc431eb02faaaea934d8de42a9db0..eb813c9a7e06af7d3b03e54f25f3d244a8577a17 100644 (file)
@@ -328,7 +328,9 @@ CDentry* CDir::add_null_dentry(const string& dname,
   CDentry* dn = new CDentry(dname, inode->hash_dentry_name(dname), first, last);
   if (is_auth()) 
     dn->state_set(CDentry::STATE_AUTH);
-  cache->lru.lru_insert_mid(dn);
+
+  cache->bottom_lru.lru_insert_mid(dn);
+  dn->state_set(CDentry::STATE_BOTTOMLRU);
 
   dn->dir = this;
   dn->version = get_projected_version();
@@ -369,7 +371,12 @@ CDentry* CDir::add_primary_dentry(const string& dname, CInode *in,
   CDentry* dn = new CDentry(dname, inode->hash_dentry_name(dname), first, last);
   if (is_auth()) 
     dn->state_set(CDentry::STATE_AUTH);
-  cache->lru.lru_insert_mid(dn);
+  if (is_auth() || !inode->is_stray()) {
+    cache->lru.lru_insert_mid(dn);
+  } else {
+    cache->bottom_lru.lru_insert_mid(dn);
+    dn->state_set(CDentry::STATE_BOTTOMLRU);
+  }
 
   dn->dir = this;
   dn->version = get_projected_version();
@@ -482,7 +489,10 @@ void CDir::remove_dentry(CDentry *dn)
   if (dn->is_dirty())
     dn->mark_clean();
 
-  cache->lru.lru_remove(dn);
+  if (dn->state_test(CDentry::STATE_BOTTOMLRU))
+    cache->bottom_lru.lru_remove(dn);
+  else
+    cache->lru.lru_remove(dn);
   delete dn;
 
   // unpin?
@@ -503,6 +513,12 @@ void CDir::link_remote_inode(CDentry *dn, inodeno_t ino, unsigned char d_type)
 
   dn->get_linkage()->set_remote(ino, d_type);
 
+  if (dn->state_test(CDentry::STATE_BOTTOMLRU)) {
+    cache->bottom_lru.lru_remove(dn);
+    cache->lru.lru_insert_mid(dn);
+    dn->state_clear(CDentry::STATE_BOTTOMLRU);
+  }
+
   if (dn->last == CEPH_NOSNAP) {
     num_head_items++;
     num_head_null--;
@@ -522,6 +538,13 @@ void CDir::link_primary_inode(CDentry *dn, CInode *in)
   in->set_primary_parent(dn);
 
   link_inode_work(dn, in);
+
+  if (dn->state_test(CDentry::STATE_BOTTOMLRU) &&
+      (is_auth() || !inode->is_stray())) {
+    cache->bottom_lru.lru_remove(dn);
+    cache->lru.lru_insert_mid(dn);
+    dn->state_clear(CDentry::STATE_BOTTOMLRU);
+  }
   
   if (dn->last == CEPH_NOSNAP) {
     num_head_items++;
@@ -557,7 +580,7 @@ void CDir::link_inode_work( CDentry *dn, CInode *in)
     in->move_to_realm(inode->find_snaprealm());
 }
 
-void CDir::unlink_inode(CDentry *dn)
+void CDir::unlink_inode(CDentry *dn, bool adjust_lru)
 {
   if (dn->get_linkage()->is_primary()) {
     dout(12) << "unlink_inode " << *dn << " " << *dn->get_linkage()->get_inode() << dendl;
@@ -567,6 +590,12 @@ void CDir::unlink_inode(CDentry *dn)
 
   unlink_inode_work(dn);
 
+  if (adjust_lru && !dn->state_test(CDentry::STATE_BOTTOMLRU)) {
+    cache->lru.lru_remove(dn);
+    cache->bottom_lru.lru_insert_mid(dn);
+    dn->state_set(CDentry::STATE_BOTTOMLRU);
+  }
+
   if (dn->last == CEPH_NOSNAP) {
     num_head_items--;
     num_head_null++;
@@ -726,15 +755,6 @@ void CDir::try_remove_dentries_for_stray()
     mark_clean();
 }
 
-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)
 {
   assert(dn->last != CEPH_NOSNAP);
index 3a65a82b3e0be94bac1365348267ebc7cbb69913..4c90292df33b7fe99eb6219969a5ff7ad9ebf9f9 100644 (file)
@@ -450,7 +450,7 @@ protected:
   void link_remote_inode( CDentry *dn, inodeno_t ino, unsigned char d_type);
   void link_remote_inode( CDentry *dn, CInode *in );
   void link_primary_inode( CDentry *dn, CInode *in );
-  void unlink_inode( CDentry *dn );
+  void unlink_inode(CDentry *dn, bool adjust_lru=true);
   void try_remove_unlinked_dn(CDentry *dn);
 
   void add_to_bloom(CDentry *dn);
@@ -465,7 +465,6 @@ private:
   void remove_null_dentries();
   void purge_stale_snap_data(const std::set<snapid_t>& snaps);
 public:
-  void touch_dentries_bottom();
   void try_remove_dentries_for_stray();
   bool try_trim_snap_dentry(CDentry *dn, const std::set<snapid_t>& snaps);
 
index fcdcc2c57c470bab91eac4a0526543251975150e..eee9c0a61abe0173a9a1b59a429fe89c823ed4f3 100644 (file)
@@ -205,6 +205,9 @@ MDCache::MDCache(MDSRank *m, PurgeQueue &purge_queue_) :
   lru.lru_set_max(g_conf->mds_cache_size);
   lru.lru_set_midpoint(g_conf->mds_cache_mid);
 
+  bottom_lru.lru_set_max(0);
+  bottom_lru.lru_set_midpoint(0);
+
   decayrate.set_halflife(g_conf->mds_decay_halflife);
 
   did_shutdown_log_cap = false;
@@ -3656,7 +3659,7 @@ void MDCache::remove_inode_recursive(CInode *in)
       CDentry::linkage_t *dnl = dn->get_linkage();
       if (dnl->is_primary()) {
        CInode *tin = dnl->get_inode();
-       subdir->unlink_inode(dn);
+       subdir->unlink_inode(dn, false);
        remove_inode_recursive(tin);
       }
       subdir->remove_dentry(dn);
@@ -6410,7 +6413,8 @@ bool MDCache::trim(int max, int count)
     if (max <= 0)
       return false;
   }
-  dout(7) << "trim max=" << max << "  cur=" << lru.lru_get_size() << dendl;
+  dout(7) << "trim max=" << max << "  cur=" << lru.lru_get_size()
+         << "/" << bottom_lru.lru_get_size() << dendl;
 
   // process delayed eval_stray()
   stray_manager.advance_delayed();
@@ -6420,22 +6424,26 @@ bool MDCache::trim(int max, int count)
   int unexpirable = 0;
   list<CDentry*> unexpirables;
 
+  for (;;) {
+    CDentry *dn = static_cast<CDentry*>(bottom_lru.lru_expire());
+    if (!dn)
+      break;
+    if (trim_dentry(dn, expiremap)) {
+      unexpirables.push_back(dn);
+      ++unexpirable;
+    }
+  }
+
+  for(auto dn : unexpirables)
+    bottom_lru.lru_insert_mid(dn);
+  unexpirables.clear();
+
   // trim dentries from the LRU: only enough to satisfy `max`,
-  // unless we see null dentries at the bottom of the LRU,
-  // in which case trim all those.
-  bool trimming_nulls = true;
-  while (trimming_nulls || lru.lru_get_size() + unexpirable > (unsigned)max) {
+  while (lru.lru_get_size() + unexpirable > (unsigned)max) {
     CDentry *dn = static_cast<CDentry*>(lru.lru_expire());
     if (!dn) {
       break;
     }
-    if (!dn->get_linkage()->is_null()) {
-      trimming_nulls = false;
-      if (lru.lru_get_size() + unexpirable < (unsigned)max) {
-       unexpirables.push_back(dn);
-       break;
-      }
-    }
     if ((is_standby_replay && dn->get_linkage()->inode &&
         dn->get_linkage()->inode->item_open_file.is_on_list()) ||
        trim_dentry(dn, expiremap)) {
@@ -6443,10 +6451,9 @@ bool MDCache::trim(int max, int count)
       ++unexpirable;
     }
   }
-  for(list<CDentry*>::iterator i = unexpirables.begin();
-      i != unexpirables.end();
-      ++i)
-    lru.lru_insert_mid(*i);
+  for(auto dn : unexpirables)
+    lru.lru_insert_mid(dn);
+  unexpirables.clear();
 
   // trim non-auth, non-bound subtrees
   for (map<CDir*, set<CDir*> >::iterator p = subtrees.begin();
@@ -6583,7 +6590,7 @@ bool MDCache::trim_dentry(CDentry *dn, map<mds_rank_t, MCacheExpire*>& expiremap
   // unlink the dentry
   if (dnl->is_remote()) {
     // just unlink.
-    dir->unlink_inode(dn);
+    dir->unlink_inode(dn, false);
   } else if (dnl->is_primary()) {
     // expire the inode, too.
     CInode *in = dnl->get_inode();
@@ -6753,7 +6760,7 @@ bool MDCache::trim_inode(CDentry *dn, CInode *in, CDir *con, map<mds_rank_t, MCa
     
   // unlink
   if (dn)
-    dn->get_dir()->unlink_inode(dn);
+    dn->get_dir()->unlink_inode(dn, false);
   remove_inode(in);
   return false;
 }
@@ -6790,14 +6797,23 @@ void MDCache::trim_non_auth()
   CDentry *first_auth = 0;
   
   // trim non-auth items from the lru
-  while (lru.lru_get_size() > 0) {
-    CDentry *dn = static_cast<CDentry*>(lru.lru_expire());
-    if (!dn) break;
+  for (;;) {
+    CDentry *dn = NULL;
+    if (bottom_lru.lru_get_size() > 0)
+      dn = static_cast<CDentry*>(bottom_lru.lru_expire());
+    if (!dn && lru.lru_get_size() > 0)
+      dn = static_cast<CDentry*>(lru.lru_expire());
+    if (!dn)
+       break;
+
     CDentry::linkage_t *dnl = dn->get_linkage();
 
     if (dn->is_auth()) {
       // add back into lru (at the top)
-      lru.lru_insert_top(dn);
+      if (dn->state_test(CDentry::STATE_BOTTOMLRU))
+       bottom_lru.lru_insert_mid(dn);
+      else
+       lru.lru_insert_top(dn);
 
       if (dnl->is_remote() && dnl->get_inode() && !dnl->get_inode()->is_auth())
        dn->unlink_remote(dnl);
@@ -6816,7 +6832,7 @@ void MDCache::trim_non_auth()
       // unlink the dentry
       dout(10) << " removing " << *dn << dendl;
       if (dnl->is_remote()) {
-       dir->unlink_inode(dn);
+       dir->unlink_inode(dn, false);
       } 
       else if (dnl->is_primary()) {
        CInode *in = dnl->get_inode();
@@ -6828,7 +6844,7 @@ void MDCache::trim_non_auth()
          assert(!subdir->is_subtree_root());
          in->close_dirfrag(subdir->dirfrag().frag);
        }
-       dir->unlink_inode(dn);
+       dir->unlink_inode(dn, false);
        remove_inode(in);
       } 
       else {
@@ -6854,7 +6870,8 @@ void MDCache::trim_non_auth()
        ++p) 
     p->first->put(CDir::PIN_SUBTREETEMP);
 
-  if (lru.lru_get_size() == 0) {
+  if (lru.lru_get_size() == 0 &&
+      bottom_lru.lru_get_size() == 0) {
     // root, stray, etc.?
     ceph::unordered_map<vinodeno_t,CInode*>::iterator p = inode_map.begin();
     while (p != inode_map.end()) {
@@ -6929,7 +6946,7 @@ bool MDCache::trim_non_auth_subtree(CDir *dir)
       }
       if (!keep_inode) { // remove it!
         dout(20) << "trim_non_auth_subtree(" << dir << ") removing inode " << in << " with dentry" << dn << dendl;
-        dir->unlink_inode(dn);
+        dir->unlink_inode(dn, false);
         remove_inode(in);
        assert(!dir->has_bloom());
         dir->remove_dentry(dn);
@@ -6943,7 +6960,7 @@ bool MDCache::trim_non_auth_subtree(CDir *dir)
     } else { // just remove it
       dout(20) << "trim_non_auth_subtree(" << dir << ") removing dentry " << dn << dendl;
       if (dnl->is_remote())
-        dir->unlink_inode(dn);
+        dir->unlink_inode(dn, false);
       dir->remove_dentry(dn);
     }
   }
@@ -7430,7 +7447,7 @@ void MDCache::shutdown_check()
   mds->timer.add_event_after(g_conf->mds_shutdown_check, new C_MDC_ShutdownCheck(this));
 
   // this
-  dout(0) << "lru size now " << lru.lru_get_size() << dendl;
+  dout(0) << "lru size now " << lru.lru_get_size() << "/" << bottom_lru.lru_get_size() << dendl;
   dout(0) << "log len " << mds->mdlog->get_num_events() << dendl;
 
 
@@ -7482,7 +7499,7 @@ bool MDCache::shutdown_pass()
 
   // trim cache
   trim(0);
-  dout(5) << "lru size now " << lru.lru_get_size() << dendl;
+  dout(5) << "lru size now " << lru.lru_get_size() << "/" << bottom_lru.lru_get_size() << dendl;
 
   // SUBTREES
   int num_auth_subtree = 0;
@@ -7586,8 +7603,8 @@ bool MDCache::shutdown_pass()
   }
 
   // trim what we can from the cache
-  if (lru.lru_get_size() > 0) {
-    dout(7) << "there's still stuff in the cache: " << lru.lru_get_size() << dendl;
+  if (lru.lru_get_size() > 0 || bottom_lru.lru_get_size() > 0) {
+    dout(7) << "there's still stuff in the cache: " << lru.lru_get_size() << "/" << bottom_lru.lru_get_size()  << dendl;
     show_cache();
     //dump();
     return false;
@@ -10482,7 +10499,6 @@ void MDCache::handle_dentry_unlink(MDentryUnlink *m)
            !in->state_test(CInode::STATE_EXPORTINGCAPS))
          migrator->export_caps(in);
        
-       touch_dentry_bottom(straydn); // move stray to end of lru
        straydn = NULL;
       } else {
        assert(!straydn);
@@ -10490,9 +10506,6 @@ void MDCache::handle_dentry_unlink(MDentryUnlink *m)
        dn->dir->unlink_inode(dn);
       }
       assert(dnl->is_null());
-      
-      // move to bottom of lru
-      touch_dentry_bottom(dn);
     }
   }
 
index 28ebc48ec8a661068912a80125e3b9b4f78a29d6..3e46cb1a007c13a9e0f829892b5fc9f7a6b301c9 100644 (file)
@@ -114,6 +114,7 @@ class MDCache {
 
   // -- my cache --
   LRU lru;   // dentry lru for expiring items from cache
+  LRU bottom_lru; // dentries that should be trimmed ASAP
  protected:
   ceph::unordered_map<vinodeno_t,CInode*> inode_map;  // map of inodes by ino
   CInode *root;                            // root inode
@@ -766,28 +767,19 @@ public:
   }
 public:
   void touch_dentry(CDentry *dn) {
-    // touch ancestors
-    if (dn->get_dir()->get_inode()->get_projected_parent_dn())
-      touch_dentry(dn->get_dir()->get_inode()->get_projected_parent_dn());
-    
-    // touch me
-    if (dn->is_auth())
-      lru.lru_touch(dn);
-    else
-      lru.lru_midtouch(dn);
+    if (dn->state_test(CDentry::STATE_BOTTOMLRU)) {
+      bottom_lru.lru_midtouch(dn);
+    } else {
+      if (dn->is_auth())
+       lru.lru_touch(dn);
+      else
+       lru.lru_midtouch(dn);
+    }
   }
   void touch_dentry_bottom(CDentry *dn) {
+    if (dn->state_test(CDentry::STATE_BOTTOMLRU))
+      return;
     lru.lru_bottouch(dn);
-    if (dn->get_projected_linkage()->is_primary() &&
-       dn->get_dir()->inode->is_stray()) {
-      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:
 
index 7b2826e97007610f8c51babeea6d5b94965fd594..dedc0c8a4c198983ce0e07bbfa9a2310476a6164 100644 (file)
@@ -849,7 +849,7 @@ void MDLog::replay(MDSInternalContextBase *c)
   // empty?
   if (journaler->get_read_pos() == journaler->get_write_pos()) {
     dout(10) << "replay - journal empty, done." << dendl;
-    mds->mdcache->trim(-1);
+    mds->mdcache->trim();
     if (c) {
       c->complete(0);
     }
index 140a615925451dbfb9995b39124a973a620e9719..f15e7d03c3deca235f4cb034ba0457a44c719429 100644 (file)
@@ -1500,13 +1500,6 @@ void Migrator::finish_export_inode(CInode *in, utime_t now, mds_rank_t peer,
   in->finish_export(now);
   
   finish_export_inode_caps(in, peer, peer_imported);
-
-  // *** other state too?
-
-  // move to end of LRU so we drop out of cache quickly!
-  if (in->get_parent_dn()) 
-    cache->lru.lru_bottouch(in->get_parent_dn());
-
 }
 
 uint64_t Migrator::encode_export_dir(bufferlist& exportbl,
index 253d15008a4e10fb1045109a5aa24dc0f04c80a5..008beb4d24d2a815215336a4440c69627aa7d916 100644 (file)
@@ -5189,6 +5189,7 @@ void Server::_link_remote(MDRequestRef& mdr, bool inc, CDentry *dn, CInode *targ
     mdcache->predirty_journal_parents(mdr, &le->metablob, targeti, dn->get_dir(), PREDIRTY_DIR, -1);
     mdcache->journal_cow_dentry(mdr.get(), &le->metablob, dn);
     le->metablob.add_null_dentry(dn, true);
+    dn->push_projected_linkage();
   }
 
   journal_and_reply(mdr, targeti, dn, le, new C_MDS_link_remote_finish(this, mdr, inc, dn, targeti));
@@ -5214,6 +5215,7 @@ void Server::_link_remote_finish(MDRequestRef& mdr, bool inc,
   } else {
     // unlink main dentry
     dn->get_dir()->unlink_inode(dn);
+    dn->pop_projected_linkage();
     dn->mark_dirty(dn->get_projected_version(), mdr->ls);  // dirty old dentry
   }
 
@@ -7066,7 +7068,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
     if (destdnl->is_primary()) {
       assert(straydn);
       dout(10) << "straydn is " << *straydn << dendl;
-      destdn->get_dir()->unlink_inode(destdn);
+      destdn->get_dir()->unlink_inode(destdn, false);
 
       straydn->pop_projected_linkage();
       if (mdr->is_slave() && !mdr->more()->slave_update_journaled)
@@ -7085,7 +7087,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
        //oldin->open_snaprealm();  might be sufficient..       
       }
     } else if (destdnl->is_remote()) {
-      destdn->get_dir()->unlink_inode(destdn);
+      destdn->get_dir()->unlink_inode(destdn, false);
       if (oldin->is_auth())
        oldin->pop_and_dirty_projected_inode(mdr->ls);
     }
@@ -7119,7 +7121,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
   } else { // primary
     if (linkmerge) {
       dout(10) << "merging primary onto remote link" << dendl;
-      destdn->get_dir()->unlink_inode(destdn);
+      destdn->get_dir()->unlink_inode(destdn, false);
     }
     destdnl = destdn->pop_projected_linkage();
     if (mdr->is_slave() && !mdr->more()->slave_update_journaled)
index f4d3ac4efc7f986540a44e088e44017a56f9fc2e..8b239ea5bea1fc46b21d7e676c1396b7ea610289 100644 (file)
@@ -237,9 +237,11 @@ void StrayManager::_purge_stray_logged(CDentry *dn, version_t pdv, LogSegment *l
 
   assert(!in->state_test(CInode::STATE_RECOVERING));
 
+  bool new_dn = dn->is_new();
+
   // unlink
   assert(dn->get_projected_linkage()->is_null());
-  dn->dir->unlink_inode(dn);
+  dn->dir->unlink_inode(dn, !new_dn);
   dn->pop_projected_linkage();
   dn->mark_dirty(pdv, ls);
 
@@ -250,12 +252,10 @@ void StrayManager::_purge_stray_logged(CDentry *dn, version_t pdv, LogSegment *l
   dn->put(CDentry::PIN_PURGING);
 
   // drop dentry?
-  if (dn->is_new()) {
+  if (new_dn) {
     dout(20) << " dn is new, removing" << dendl;
     dn->mark_clean();
     dn->dir->remove_dentry(dn);
-  } else {
-    in->mdcache->touch_dentry_bottom(dn);  // drop dn as quickly as possible.
   }
 
   // drop inode
@@ -431,10 +431,6 @@ bool StrayManager::_eval_stray(CDentry *dn, bool delay)
   assert(!dn->state_test(CDentry::STATE_PURGING));
 
   if (!dn->is_auth()) {
-    // has to be mine
-    // move to bottom of lru so that we trim quickly!
-
-    in->mdcache->touch_dentry_bottom(dn);
     return false;
   }
 
index 53dd3f466f131bfed54df59d8510eada640bd121..dfb4b03ffa8763b8d5825bf26f6eff87721e51c6 100644 (file)
@@ -1311,8 +1311,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
            dout(0) << ss.str() << dendl;
            mds->clog->warn(ss);
          }
-         dir->unlink_inode(dn);
-          mds->mdcache->touch_dentry_bottom(dn);
+         dir->unlink_inode(dn, false);
        }
        if (unlinked.count(in))
          linked.insert(in);
@@ -1324,9 +1323,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
        if (dn->get_linkage()->get_inode() != in && in->get_parent_dn()) {
          dout(10) << "EMetaBlob.replay unlinking " << *in << dendl;
          unlinked[in] = in->get_parent_dir();
-          CDentry *unlinked_dn = in->get_parent_dn();
          in->get_parent_dir()->unlink_inode(in->get_parent_dn());
-          mds->mdcache->touch_dentry_bottom(unlinked_dn);
        }
        if (dn->get_linkage()->get_inode() != in) {
          if (!dn->get_linkage()->is_null()) { // note: might be remote.  as with stray reintegration.
@@ -1338,8 +1335,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
              dout(0) << ss.str() << dendl;
              mds->clog->warn(ss);
            }
-           dir->unlink_inode(dn);
-            mds->mdcache->touch_dentry_bottom(dn);
+           dir->unlink_inode(dn, false);
          }
          if (unlinked.count(in))
            linked.insert(in);
@@ -1384,8 +1380,7 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
               << " " << *dn->get_linkage()->get_inode() << " should be remote " << p->ino;
            dout(0) << ss.str() << dendl;
          }
-         dir->unlink_inode(dn);
-          mds->mdcache->touch_dentry_bottom(dn);
+         dir->unlink_inode(dn, false);
        }
        dir->link_remote_inode(dn, p->ino, p->d_type);
        dn->set_version(p->dnv);
@@ -1420,7 +1415,6 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
            if (dn->get_linkage()->is_primary())
              unlinked[in] = dir;
            dir->unlink_inode(dn);
-            mds->mdcache->touch_dentry_bottom(dn);
          }
        }
        dn->set_version(p->dnv);
@@ -1434,7 +1428,6 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
 
       // Make null dentries the first things we trim
       dout(10) << "EMetaBlob.replay pushing to bottom of lru " << *dn << dendl;
-      mds->mdcache->touch_dentry_bottom(dn);
     }
   }
 
@@ -1643,7 +1636,6 @@ void EMetaBlob::replay(MDSRank *mds, LogSegment *logseg, MDSlaveUpdate *slaveup)
       if (parent) {
         dout(10) << "EMetaBlob.replay unlinked from dentry " << *parent << dendl;
         assert(parent->get_linkage()->is_null());
-        mds->mdcache->touch_dentry_bottom(parent);
       }
     } else {
       dout(10) << "EMetaBlob.replay destroyed " << *p << ", not in cache" << dendl;