Commit 0d31e2ba authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I69a40f096aff13b84c1ed345fa8bd0dd80cef0e1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2249


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarMichael Haeuptle <michaelhaeuptle@gmail.com>
parent f048f3d3
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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++;