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

bdev/malloc: Always return failure but support I/O type ABORT



Malloc bdev module does not manage submitted I/Os by any list,
and so cannot abort any submitted I/O. However malloc bdev module
can always fail any submitted abort request.

Hence let's update bdev_malloc_io_type_supported() to return true
for SPDK_BDEV_IO_TYPE_ABORT and update _bdev_malloc_submit_request()
to complete with failure for SPDK_BDEV_IO_TYPE_ABORT.

This will enable us to use delay bdev + malloc bdev to test I/O
abort feature conveniently.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If4c411f5ab8589291ac90c10264d3ef30c06df83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2797


Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 8ddeccad
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -261,8 +261,7 @@ static int _bdev_malloc_submit_request(struct spdk_io_channel *ch, struct spdk_b
				((struct malloc_disk *)bdev_io->bdev->ctxt)->malloc_buf +
				bdev_io->u.bdev.offset_blocks * block_size;
			bdev_io->u.bdev.iovs[0].iov_len = bdev_io->u.bdev.num_blocks * block_size;
			spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bdev_io->driver_ctx),
					      SPDK_BDEV_IO_STATUS_SUCCESS);
			spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_SUCCESS);
			return 0;
		}

@@ -321,8 +320,10 @@ static int _bdev_malloc_submit_request(struct spdk_io_channel *ch, struct spdk_b
			spdk_bdev_io_set_buf(bdev_io, buf, len);

		}
		spdk_bdev_io_complete(spdk_bdev_io_from_ctx(bdev_io->driver_ctx),
				      SPDK_BDEV_IO_STATUS_SUCCESS);
		spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_SUCCESS);
		return 0;
	case SPDK_BDEV_IO_TYPE_ABORT:
		spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
		return 0;
	default:
		return -1;
@@ -348,6 +349,7 @@ bdev_malloc_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
	case SPDK_BDEV_IO_TYPE_UNMAP:
	case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
	case SPDK_BDEV_IO_TYPE_ZCOPY:
	case SPDK_BDEV_IO_TYPE_ABORT:
		return true;

	default: