From aedb6a19da257f10a90795857a2247781b89fe4e Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Tue, 31 Oct 2017 06:01:39 +0800 Subject: [PATCH] os/bluestore: remove "q.empyt()" check in _is_all_kv_submitted. Most call _is_all_kv_submitted under the situation: q.empty() is false. Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueStore.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index c1ee32f7d54..2fe22edd342 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1722,10 +1722,8 @@ public: } bool _is_all_kv_submitted() { - // caller must hold qlock - if (q.empty()) { - return true; - } + // caller must hold qlock & q.empty() must not empty + assert(!q.empty()); TransContext *txc = &q.back(); if (txc->state >= TransContext::STATE_KV_SUBMITTED) { return true; @@ -1740,7 +1738,7 @@ public: // may become true outside qlock, and we need to make // sure those threads see waiters and signal qcond. ++kv_submitted_waiters; - if (_is_all_kv_submitted()) { + if (q.empty() || _is_all_kv_submitted()) { --kv_submitted_waiters; return; } -- 2.39.5