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 <sage@redhat.com>
IOContext(const IOContext& other);
IOContext &operator=(const IOContext& other);
- bool has_aios() {
- std::lock_guard<std::mutex> l(lock);
- return num_pending.load() || num_running.load();
+ bool has_pending_aios() {
+ return num_pending.load();
}
void aio_wait();
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]);
}
}
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;
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;