]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't journal inode when merging subtrees
authorYan, Zheng <zyan@redhat.com>
Wed, 21 Dec 2016 09:32:52 +0000 (17:32 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 10 Jan 2017 07:23:30 +0000 (15:23 +0800)
When doing subtree migration or cross subtree rename, we rdlock
fragtreelock of subtree boundaries' inodes. rdlock fragtreelock
has already journaled dirfragtree updates. I can't see why we
need to journal it again when merging subtrees.

The resaon I want to remove this code is that it can journal
unconnected dirfrag in the Migrator::export_reverse() case.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/mds/MDCache.cc
src/mds/Migrator.cc

index 1b95f8459c763db75b3a45d50a0c2145f65a005c..c0519aad644b908af0b3dfad367d08daf8733b14 100644 (file)
@@ -946,33 +946,6 @@ void MDCache::try_subtree_merge_at(CDir *dir, bool do_eval)
 
     if (do_eval)
       eval_subtree_root(dir->get_inode());
-
-    // journal inode? 
-    //  (this is a large hammer to ensure that dirfragtree updates will
-    //   hit the disk before the relevant dirfrags ever close)
-    if (dir->inode->is_auth() &&
-       dir->inode->can_auth_pin() &&
-       (mds->is_clientreplay() || mds->is_active() || mds->is_stopping())) {
-      CInode *in = dir->inode;
-      dout(10) << "try_subtree_merge_at journaling merged bound " << *in << dendl;
-      
-      in->auth_pin(this);
-
-      // journal write-behind.
-      inode_t *pi = in->project_inode();
-      pi->version = in->pre_dirty();
-      
-      auto mut(std::make_shared<MutationImpl>());
-      mut->ls = mds->mdlog->get_current_segment();
-      EUpdate *le = new EUpdate(mds->mdlog, "subtree merge writebehind");
-      mds->mdlog->start_entry(le);
-
-      le->metablob.add_dir_context(in->get_parent_dn()->get_dir());
-      journal_dirty_inode(mut.get(), &le->metablob, in);
-      
-      mds->mdlog->submit_entry(le, new C_MDC_SubtreeMergeWB(this, in, mut));
-      mds->mdlog->flush();
-    }
   } 
 
   show_subtrees(15);
index c1cbc4cb870ad6237bf0640fa69675913eede0db..d08dd47c4aee788bcd880c9a819d62f4e26aace9 100644 (file)
@@ -322,7 +322,7 @@ void Migrator::export_try_cancel(CDir *dir, bool notify_peer)
     }
     dir->unfreeze_tree();
     cache->adjust_subtree_auth(dir, mds->get_nodeid());
-    cache->try_subtree_merge(dir);  // NOTE: this may journal subtree_map as side effect
+    cache->try_subtree_merge(dir);
     if (notify_peer && mds->mdsmap->is_clientreplay_or_active_or_stopping(it->second.peer)) // tell them.
       mds->send_message_mds(new MExportDirCancel(dir->dirfrag(), it->second.tid), it->second.peer);
     break;
@@ -493,7 +493,7 @@ void Migrator::handle_mds_failure_or_stop(mds_rank_t who)
          
          // adjust auth back to the exporter
          cache->adjust_subtree_auth(dir, q->second.peer);
-         cache->try_subtree_merge(dir);   // NOTE: may journal subtree_map as side-effect
+         cache->try_subtree_merge(dir);
 
          // bystanders?
          if (q->second.bystanders.empty()) {
@@ -1676,7 +1676,7 @@ void Migrator::export_reverse(CDir *dir)
 
   // adjust auth, with possible subtree merge.
   cache->adjust_subtree_auth(dir, mds->get_nodeid());
-  cache->try_subtree_merge(dir);  // NOTE: may journal subtree_map as side-effect
+  cache->try_subtree_merge(dir);
 
   // notify bystanders
   export_notify_abort(dir, bounds);
@@ -1847,7 +1847,7 @@ void Migrator::export_finish(CDir *dir)
   // adjust auth, with possible subtree merge.
   //  (we do this _after_ removing EXPORTBOUND pins, to allow merges)
   cache->adjust_subtree_auth(dir, it->second.peer);
-  cache->try_subtree_merge(dir);  // NOTE: may journal subtree_map as sideeffect
+  cache->try_subtree_merge(dir);
 
   // no more auth subtree? clear scatter dirty
   if (!dir->get_inode()->is_auth() &&
@@ -2493,7 +2493,7 @@ void Migrator::import_reverse(CDir *dir)
   // log our failure
   mds->mdlog->start_submit_entry(new EImportFinish(dir, false));       // log failure
 
-  cache->try_subtree_merge(dir);  // NOTE: this may journal subtree map as side effect
+  cache->try_subtree_merge(dir);
 
   cache->trim(-1, num_dentries); // try trimming dentries
 
@@ -2710,7 +2710,7 @@ void Migrator::import_finish(CDir *dir, bool notify, bool last)
 
   mds->mdlog->start_submit_entry(new EImportFinish(dir, true));
 
-  cache->try_subtree_merge(dir);   // NOTE: this may journal subtree_map as sideffect
+  cache->try_subtree_merge(dir);
 
   // process delayed expires
   cache->process_delayed_expire(dir);