lib/bdev: spdk_bdev_abort supports queued I/O due to out of memory

Add abort queued I/O due to out of memory into bdev_io_do_submit().
Any bdev I/O is queued due to out of memory only on the submitted
channel.

Aborting queued I/O due to out of memory is necessary only if
shared_resource->nomem_io is not empty.

Checking if shared_resource->nomem_io is not empty has been done
in this function.

However add the abort operation without and before checking if
shared_resource->nomem_io is not empty because the following patch
will abort queued I/O due to buffer pool capacity.

The purpose is to improve readability by consolidating all abort
operations into a single place.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I69a40f096aff13b84c1ed345fa8bd0dd80cef0e1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2249
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
This commit is contained in:
Shuhei Matsumoto 2020-05-12 03:36:15 +09:00 committed by Tomasz Zawadzki
parent f048f3d3d3
commit 0d31e2bae6

View File

@ -1678,6 +1678,16 @@ bdev_io_do_submit(struct spdk_bdev_channel *bdev_ch, struct spdk_bdev_io *bdev_i
struct spdk_io_channel *ch = bdev_ch->channel;
struct spdk_bdev_shared_resource *shared_resource = bdev_ch->shared_resource;
if (spdk_unlikely(bdev_io->type == SPDK_BDEV_IO_TYPE_ABORT)) {
struct spdk_bdev_io *bio_to_abort = bdev_io->u.abort.bio_to_abort;
if (bdev_abort_queued_io(&shared_resource->nomem_io, bio_to_abort)) {
_bdev_io_complete_in_submit(bdev_ch, bdev_io,
SPDK_BDEV_IO_STATUS_SUCCESS);
return;
}
}
if (spdk_likely(TAILQ_EMPTY(&shared_resource->nomem_io))) {
bdev_ch->io_outstanding++;
shared_resource->io_outstanding++;