From 147f25a4547b98ae66b44f11c72e539e6648f2ba Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 14 Sep 2009 15:34:47 -0700 Subject: [PATCH] mds: flush log in caller(s), not scatter_writebehind Otherwise scatter_tick(), in particular, will call scatter_writebehind a zillion times and generate lots of small log flushes. Instead, flush at the end of the whole tick. --- src/mds/Locker.cc | 6 +++++- src/mds/journal.cc | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 614994518bbb1..bb7ac65aab7f5 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -487,6 +487,7 @@ void Locker::eval_gather(SimpleLock *lock, bool first, bool *need_issue) if (lock->is_updated()) { scatter_writebehind((ScatterLock*)lock); + mds->mdlog->flush(); return; } @@ -2562,6 +2563,7 @@ bool Locker::simple_sync(SimpleLock *lock, bool *need_issue) if (!gather && lock->is_updated()) { lock->get_parent()->auth_pin(lock); scatter_writebehind((ScatterLock*)lock); + mds->mdlog->flush(); return false; } @@ -2685,6 +2687,7 @@ void Locker::simple_lock(SimpleLock *lock, bool *need_issue) if (!gather && lock->is_updated()) { lock->get_parent()->auth_pin(lock); scatter_writebehind((ScatterLock*)lock); + mds->mdlog->flush(); return; } @@ -2824,7 +2827,6 @@ void Locker::scatter_writebehind(ScatterLock *lock) mds->mdlog->submit_entry(le); mds->mdlog->wait_for_sync(new C_Locker_ScatterWB(this, lock, mut)); - mds->mdlog->flush(); } void Locker::scatter_writebehind_finish(ScatterLock *lock, Mutation *mut) @@ -3003,6 +3005,7 @@ void Locker::scatter_tick() updated_scatterlocks.pop_front(); scatter_nudge(lock, 0); } + mds->mdlog->flush(); } @@ -3543,6 +3546,7 @@ void Locker::handle_file_lock(ScatterLock *lock, MLock *m) dout(7) << "handle_file_lock trying nudge on " << *lock << " on " << *lock->get_parent() << dendl; scatter_nudge(lock, 0); + mds->mdlog->flush(); } else { dout(7) << "handle_file_lock IGNORING nudge on non-auth " << *lock << " on " << *lock->get_parent() << dendl; diff --git a/src/mds/journal.cc b/src/mds/journal.cc index 2cb4750c0e1fa..4112be7202e48 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -273,6 +273,7 @@ C_Gather *LogSegment::try_to_expire(MDS *mds) if (gather) { dout(6) << "LogSegment(" << offset << ").try_to_expire waiting" << dendl; + mds->mdlog->flush(); } else { dout(6) << "LogSegment(" << offset << ").try_to_expire success" << dendl; } -- 2.39.5