From: Igor Fedotov Date: Thu, 20 Apr 2017 14:46:21 +0000 (-0700) Subject: os/bluestore: get rid off Onode::flush_txn set. X-Git-Tag: v12.0.3~189^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ad9d87c87a6495677fec03850734a1f68bdeed17;p=ceph.git os/bluestore: get rid off Onode::flush_txn set. It looks like flushing_count counter is enough. Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index e09dbac3f28b..363184eb2f31 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -2853,13 +2853,14 @@ BlueStore::BlobRef BlueStore::ExtentMap::split_blob( void BlueStore::Onode::flush() { - if (flushing_count) { + if (flushing_count.load()) { + ldout(c->store->cct, 20) << __func__ << " cnt:" << flushing_count << dendl; std::unique_lock l(flush_lock); - ldout(c->store->cct, 20) << flush_txns << dendl; - while (!flush_txns.empty()) + while (flushing_count.load()) { flush_cond.wait(l); + } } - ldout(c->store->cct, 20) << "done" << dendl; + ldout(c->store->cct, 20) << __func__ << " done" << dendl; } // ======================================================= @@ -5634,9 +5635,9 @@ void BlueStore::_reap_collections() dout(10) << __func__ << " " << c << " " << c->cid << dendl; if (c->onode_map.map_any([&](OnodeRef o) { assert(!o->exists); - if (!o->flush_txns.empty()) { + if (o->flushing_count.load()) { dout(10) << __func__ << " " << c << " " << c->cid << " " << o->oid - << " flush_txns " << o->flush_txns << dendl; + << " flush_txns " << o->flushing_count << dendl; return false; } return true; @@ -7427,9 +7428,6 @@ void BlueStore::_txc_write_nodes(TransContext *txc, KeyValueDB::Transaction t) << extent_part << " bytes inline extents)" << dendl; t->set(PREFIX_OBJ, o->key.c_str(), o->key.size(), bl); - - std::lock_guard l(o->flush_lock); - o->flush_txns.insert(txc); o->flushing_count++; } @@ -7437,8 +7435,6 @@ void BlueStore::_txc_write_nodes(TransContext *txc, KeyValueDB::Transaction t) auto p = txc->modified_objects.begin(); while (p != txc->modified_objects.end()) { if (txc->onodes.count(*p) == 0) { - std::lock_guard l((*p)->flush_lock); - (*p)->flush_txns.insert(txc); (*p)->flushing_count++; ++p; } else { @@ -7529,13 +7525,10 @@ void BlueStore::_txc_applied_kv(TransContext *txc) { 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 + dout(20) << __func__ << " onode " << o << " had " << o->flushing_count << dendl; - assert(o->flush_txns.count(txc)); - o->flush_txns.erase(txc); - o->flushing_count--; - if (o->flush_txns.empty()) { + if (--o->flushing_count == 0) { + std::lock_guard l(o->flush_lock); o->flush_cond.notify_all(); } } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 8cacc6f7aac6..cc0e83fd5a5a 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -982,7 +982,6 @@ public: std::atomic flushing_count = {0}; std::mutex flush_lock; ///< protect flush_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)