From f688302df713480e583a0e97f9601246279e3be9 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 4 Oct 2016 15:28:31 -0400 Subject: [PATCH] os/bluestore: fix has_aios -> has_pending_aios This is only called from safe callers (with exclusive access), so we don't need a lock. It also should only return true for *pending* aios--not aios we've already submitted! Signed-off-by: Sage Weil --- src/os/bluestore/BlockDevice.h | 5 ++--- src/os/bluestore/BlueFS.cc | 2 +- src/os/bluestore/BlueStore.cc | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/os/bluestore/BlockDevice.h b/src/os/bluestore/BlockDevice.h index f3ba54af4fb..305d86f1d79 100644 --- a/src/os/bluestore/BlockDevice.h +++ b/src/os/bluestore/BlockDevice.h @@ -52,9 +52,8 @@ struct IOContext { IOContext(const IOContext& other); IOContext &operator=(const IOContext& other); - bool has_aios() { - std::lock_guard l(lock); - return num_pending.load() || num_running.load(); + bool has_pending_aios() { + return num_pending.load(); } void aio_wait(); diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 2d84c1e80fd..4dc02d662b8 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1544,7 +1544,7 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) for (unsigned i = 0; i < MAX_BDEV; ++i) { if (bdev[i]) { assert(h->iocv[i]); - if (h->iocv[i]->has_aios()) { + if (h->iocv[i]->has_pending_aios()) { bdev[i]->aio_submit(h->iocv[i]); } } diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 92ce9f5d905..29d240df09c 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5887,7 +5887,7 @@ void BlueStore::_txc_state_proc(TransContext *txc) switch (txc->state) { case TransContext::STATE_PREPARE: txc->log_state_latency(logger, l_bluestore_state_prepare_lat); - if (txc->ioc.has_aios()) { + if (txc->ioc.has_pending_aios()) { txc->state = TransContext::STATE_AIO_WAIT; _txc_aio_submit(txc); return; @@ -5946,7 +5946,7 @@ void BlueStore::_txc_state_proc(TransContext *txc) case TransContext::STATE_WAL_APPLYING: txc->log_state_latency(logger, l_bluestore_state_wal_applying_lat); - if (txc->ioc.has_aios()) { + if (txc->ioc.has_pending_aios()) { txc->state = TransContext::STATE_WAL_AIO_WAIT; _txc_aio_submit(txc); return; -- 2.39.5