From 9ee0c842f2ab345fcddd21c698fef049fc2a155b Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 13 Mar 2017 22:49:37 -0400 Subject: [PATCH] os/bluestore: add OpSequencer::drain() Currently this is the same as flush, but more precisely it is an internal method that means all txc's must complete. Update _wal_apply() to use it instead of flush(), which is part of the public Sequencer interface. Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 4 ++-- src/os/bluestore/BlueStore.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 4fae0a27fa3..374e55c5736 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -7775,8 +7775,8 @@ int BlueStore::_deferred_replay() txc->state = TransContext::STATE_KV_DONE; _txc_state_proc(txc); } - dout(20) << __func__ << " flushing osr" << dendl; - osr->flush(); + dout(20) << __func__ << " draining osr" << dendl; + osr->drain(); dout(10) << __func__ << " completed " << count << " events" << dendl; return 0; } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index a9ee843954f..2e428d1cea3 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1554,13 +1554,19 @@ public: q.push_back(*txc); } - void flush() { + void flush() override { + std::unique_lock l(qlock); + while (!q.empty()) + qcond.wait(l); + } + + void drain() { std::unique_lock l(qlock); while (!q.empty()) qcond.wait(l); } - bool flush_commit(Context *c) { + bool flush_commit(Context *c) override { std::lock_guard l(qlock); if (q.empty()) { return true; -- 2.47.3