bdev: simplify NOMEM control flow

Flip the status != NOMEM check around so that the logic is easier to
follow.

Change-Id: I607e8b5f0cfaa3598a623d0fc3642b11bd42decd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/404175
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Daniel Verkamp 2018-03-16 10:40:47 -07:00
parent da58800f21
commit b20b983b05

View File

@ -2144,11 +2144,8 @@ spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status sta
} else {
assert(shared_ch->io_outstanding > 0);
shared_ch->io_outstanding--;
if (spdk_likely(status != SPDK_BDEV_IO_STATUS_NOMEM)) {
if (spdk_unlikely(!TAILQ_EMPTY(&shared_ch->nomem_io))) {
_spdk_bdev_ch_retry_io(bdev_ch);
}
} else {
if (spdk_unlikely(status == SPDK_BDEV_IO_STATUS_NOMEM)) {
TAILQ_INSERT_HEAD(&shared_ch->nomem_io, bdev_io, link);
/*
* Wait for some of the outstanding I/O to complete before we
@ -2160,6 +2157,10 @@ spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status sta
(int64_t)shared_ch->io_outstanding - NOMEM_THRESHOLD_COUNT);
return;
}
if (spdk_unlikely(!TAILQ_EMPTY(&shared_ch->nomem_io))) {
_spdk_bdev_ch_retry_io(bdev_ch);
}
}
if (status == SPDK_BDEV_IO_STATUS_SUCCESS) {