From e2d1dfb4faffcd1cc548d34305ca4363de94e901 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Sat, 6 Jun 2020 15:20:45 +0900 Subject: [PATCH] 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: Shuhei Matsumoto 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: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Aleksey Marchuk --- module/bdev/malloc/bdev_malloc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/module/bdev/malloc/bdev_malloc.c b/module/bdev/malloc/bdev_malloc.c index 0710fb2fa..53156dc3a 100644 --- a/module/bdev/malloc/bdev_malloc.c +++ b/module/bdev/malloc/bdev_malloc.c @@ -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: