From a4e5ad2ff42732f51bf588e16bfe79e21a75a5e6 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Wed, 21 Dec 2016 17:32:52 +0800 Subject: [PATCH] mds: don't journal inode when merging subtrees 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 --- src/mds/MDCache.cc | 27 --------------------------- src/mds/Migrator.cc | 12 ++++++------ 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 1b95f8459c763..c0519aad644b9 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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()); - 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); diff --git a/src/mds/Migrator.cc b/src/mds/Migrator.cc index c1cbc4cb870ad..d08dd47c4aee7 100644 --- a/src/mds/Migrator.cc +++ b/src/mds/Migrator.cc @@ -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); -- 2.39.5