From 3238162bd98801e0bfe1e81a511559a1cb22dfdb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 8 Mar 2017 14:48:12 -0500 Subject: [PATCH] os/bluestore: make flush() only wait for kv commit The only remaining flush() users only need to see previous txc's applied to the kv db (e.g., _omap_clear needs to see the records to delete them). Signed-off-by: Sage Weil # Conflicts: # src/os/bluestore/BlueStore.h --- src/os/bluestore/BlueStore.cc | 30 +++++++++++++++--------------- src/os/bluestore/BlueStore.h | 6 ++++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 3bc22778429b7..af1b51b8a0a99 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -7341,6 +7341,21 @@ void BlueStore::_txc_finish_kv(TransContext *txc) { dout(20) << __func__ << " txc " << txc << dendl; + for (auto ls : { &txc->onodes, &txc->modified_objects }) { + for (auto& o : *ls) { + std::lock_guard l(o->flush_lock); + dout(20) << __func__ << " onode " << o << " had " << o->flush_txns + << dendl; + assert(o->flush_txns.count(txc)); + o->flush_txns.erase(txc); + o->flushing_count--; + if (o->flush_txns.empty()) { + o->flush_cond.notify_all(); + } + } + ls->clear(); // clear out refs + } + // warning: we're calling onreadable_sync inside the sequencer lock if (txc->onreadable_sync) { txc->onreadable_sync->complete(0); @@ -7384,21 +7399,6 @@ void BlueStore::_txc_finish(TransContext *txc) } txc->shared_blobs_written.clear(); - for (auto ls : { &txc->onodes, &txc->modified_objects }) { - for (auto& o : *ls) { - std::lock_guard l(o->flush_lock); - dout(20) << __func__ << " onode " << o << " had " << o->flush_txns - << dendl; - assert(o->flush_txns.count(txc)); - o->flush_txns.erase(txc); - o->flushing_count--; - if (o->flush_txns.empty()) { - o->flush_cond.notify_all(); - } - } - ls->clear(); // clear out refs - } - while (!txc->removed_collections.empty()) { _queue_reap_collection(txc->removed_collections.front()); txc->removed_collections.pop_front(); diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 19dbd220fe4e8..d9e0ebd00faef 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -948,10 +948,12 @@ public: ExtentMap extent_map; + // track txc's that have not been committed to kv store (and whose + // effects cannot be read via the kvdb read methods) std::atomic flushing_count = {0}; std::mutex flush_lock; ///< protect flush_txns - std::condition_variable flush_cond; ///< wait here for unapplied txns - set flush_txns; ///< committing or deferred txns + std::condition_variable flush_cond; ///< wait here for uncommitted txns + set flush_txns; ///< unapplied txns Onode(Collection *c, const ghobject_t& o, const mempool::bluestore_meta_other::string& k) -- 2.39.5