From ff71ad472e94e14f392c618b6eb5e8608afec94f Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Wed, 7 Aug 2019 13:30:23 +0800 Subject: [PATCH] os/bluestore: add kv_drain_preceding_waiters indicate drain_preceding. Condition: (txc->state == TransContext::STATE_PREPARE && deferred_aggressive) isn't correctly for drain_preceding. So represent this event by adding this parameter. Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueStore.cc | 7 +++---- src/os/bluestore/BlueStore.h | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 94ed213485e7f..b94b11d551c40 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -10263,8 +10263,7 @@ void BlueStore::_txc_finish(TransContext *txc) dout(20) << __func__ << " txc " << txc << " " << txc->get_state_name() << dendl; if (txc->state != TransContext::STATE_DONE) { - if (txc->state == TransContext::STATE_PREPARE && - deferred_aggressive) { + if (osr->kv_drain_preceding_waiters && txc->state == TransContext::STATE_PREPARE) { // for _osr_drain_preceding() notify = true; } @@ -10385,7 +10384,7 @@ void BlueStore::_osr_drain_preceding(TransContext *txc) { OpSequencer *osr = txc->osr.get(); dout(10) << __func__ << " " << txc << " osr " << osr << dendl; - ++deferred_aggressive; // FIXME: maybe osr-local aggressive flag? + osr->kv_drain_preceding_waiters++; { // submit anything pending deferred_lock.lock(); @@ -10404,7 +10403,7 @@ void BlueStore::_osr_drain_preceding(TransContext *txc) } } osr->drain_preceding(txc); - --deferred_aggressive; + osr->kv_drain_preceding_waiters--; dout(10) << __func__ << " " << osr << " done" << dendl; } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index e7668c2e8a55f..e165e5f0c4b18 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1613,6 +1613,8 @@ public: std::atomic_int kv_submitted_waiters = {0}; + std::atomic_int kv_drain_preceding_waiters = {0}; + std::atomic_bool zombie = {false}; ///< in zombie_osr set (collection going away) OpSequencer(BlueStore *store, const coll_t& c) -- 2.39.5