From: Igor Fedotov Date: Mon, 17 Apr 2017 12:44:01 +0000 (-0700) Subject: os/bluestore: get rid off duplicate lock acquisition at txc_finish() X-Git-Tag: v12.0.3~189^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=adf719cff22a96162986e1fe7914359ce35862ee;p=ceph.git os/bluestore: get rid off duplicate lock acquisition at txc_finish() Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 92afe79c9c08..e09dbac3f28b 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -7583,41 +7583,12 @@ void BlueStore::_txc_finish(TransContext *txc) } OpSequencerRef osr = txc->osr; - { - std::lock_guard l(osr->qlock); - txc->state = TransContext::STATE_DONE; - } - - bool empty = _osr_reap_done(osr.get()); - if (empty && osr->zombie) { - dout(10) << __func__ << " reaping empty zombie osr " << osr << dendl; - osr->_unregister(); - } -} - -void BlueStore::_txc_release_alloc(TransContext *txc) -{ - // update allocator with full released set - if (!cct->_conf->bluestore_debug_no_reuse_blocks) { - dout(10) << __func__ << " " << txc << " " << txc->released << dendl; - for (interval_set::iterator p = txc->released.begin(); - p != txc->released.end(); - ++p) { - alloc->release(p.get_start(), p.get_len()); - } - } - - txc->allocated.clear(); - txc->released.clear(); -} - -bool BlueStore::_osr_reap_done(OpSequencer *osr) -{ CollectionRef c; bool empty = false; { std::lock_guard l(osr->qlock); - dout(20) << __func__ << " osr " << osr << dendl; + txc->state = TransContext::STATE_DONE; + while (!osr->q.empty()) { TransContext *txc = &osr->q.front(); dout(20) << __func__ << " txc " << txc << " " << txc->get_state_name() @@ -7650,12 +7621,31 @@ bool BlueStore::_osr_reap_done(OpSequencer *osr) empty = true; } } - if (c) { c->trim_cache(); } - return empty; + + if (empty && osr->zombie) { + dout(10) << __func__ << " reaping empty zombie osr " << osr << dendl; + osr->_unregister(); + } +} + +void BlueStore::_txc_release_alloc(TransContext *txc) +{ + // update allocator with full released set + if (!cct->_conf->bluestore_debug_no_reuse_blocks) { + dout(10) << __func__ << " " << txc << " " << txc->released << dendl; + for (interval_set::iterator p = txc->released.begin(); + p != txc->released.end(); + ++p) { + alloc->release(p.get_start(), p.get_len()); + } + } + + txc->allocated.clear(); + txc->released.clear(); } void BlueStore::_osr_drain_preceding(TransContext *txc) diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 0f79784f061e..8cacc6f7aac6 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1601,7 +1601,7 @@ public: void discard() override { // Note that we may have txc's in flight when the parent Sequencer // goes away. Reflect this with zombie==registered==true and let - // _osr_reap_done or _osr_drain_all clean up later. + // _osr_drain_all clean up later. assert(!zombie); zombie = true; parent = nullptr; @@ -1915,7 +1915,6 @@ private: void _txc_finish(TransContext *txc); void _txc_release_alloc(TransContext *txc); - bool _osr_reap_done(OpSequencer *osr); void _osr_drain_preceding(TransContext *txc); void _osr_drain_all(); void _osr_unregister_all();