From da553f16e5c50ea99ba71e327e5efeb82ac4bf5c Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Tue, 18 Jul 2017 06:41:09 +0800 Subject: [PATCH] os/bluestore/BlueStore: Avoid double counting state_kv_queued_lat. In fact, if txc in kv_submitting queue it also in kv_committing. For those txc, we should avoid double counting state_kv_queued_lat. Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueStore.cc | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 8e68e06bc5f..99f1189e5a5 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -8344,26 +8344,29 @@ void BlueStore::_kv_sync_thread() t->set(PREFIX_SUPER, "blobid_max", bl); dout(10) << __func__ << " new_blobid_max " << new_blobid_max << dendl; } - for (auto txc : kv_submitting) { - assert(txc->state == TransContext::STATE_KV_QUEUED); - txc->log_state_latency(logger, l_bluestore_state_kv_queued_lat); - int r = cct->_conf->bluestore_debug_omit_kv_commit ? 0 : db->submit_transaction(txc->t); - assert(r == 0); - _txc_applied_kv(txc); - --txc->osr->kv_committing_serially; - txc->state = TransContext::STATE_KV_SUBMITTED; - if (txc->osr->kv_submitted_waiters) { - std::lock_guard l(txc->osr->qlock); - if (txc->osr->_is_all_kv_submitted()) { - txc->osr->qcond.notify_all(); + + for (auto txc : kv_committing) { + if (txc->state == TransContext::STATE_KV_QUEUED) { + txc->log_state_latency(logger, l_bluestore_state_kv_queued_lat); + int r = cct->_conf->bluestore_debug_omit_kv_commit ? 0 : db->submit_transaction(txc->t); + assert(r == 0); + _txc_applied_kv(txc); + --txc->osr->kv_committing_serially; + txc->state = TransContext::STATE_KV_SUBMITTED; + if (txc->osr->kv_submitted_waiters) { + std::lock_guard l(txc->osr->qlock); + if (txc->osr->_is_all_kv_submitted()) { + txc->osr->qcond.notify_all(); + } } + + } else { + assert(txc->state == TransContext::STATE_KV_SUBMITTED); + txc->log_state_latency(logger, l_bluestore_state_kv_queued_lat); } - } - for (auto txc : kv_committing) { if (txc->had_ios) { --txc->osr->txc_with_unstable_io; } - txc->log_state_latency(logger, l_bluestore_state_kv_queued_lat); } // release throttle *before* we commit. this allows new ops -- 2.39.5