From: Sage Weil Date: Tue, 14 Mar 2017 02:49:37 +0000 (-0400) Subject: os/bluestore: add OpSequencer::drain() X-Git-Tag: v12.0.1~12^2~32 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9ee0c842f2ab345fcddd21c698fef049fc2a155b;p=ceph.git 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 4fae0a27fa32..374e55c5736b 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 a9ee843954f8..2e428d1cea30 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;