From: Sage Weil Date: Wed, 8 Mar 2017 19:48:12 +0000 (-0500) Subject: os/bluestore: make flush() only wait for kv commit X-Git-Tag: v12.0.1~12^2~36 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3238162bd98801e0bfe1e81a511559a1cb22dfdb;p=ceph.git 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 3bc22778429..af1b51b8a0a 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 19dbd220fe4..d9e0ebd00fa 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)