Commit 7e4911c9 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

bdev: Make malloc bdev use the new zero copy mechanism



Change-Id: I8aea5dee3ad30814ffd061c4afa7729ad8d47cdf
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/386167


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 84850dac
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -310,6 +310,20 @@ static int _bdev_malloc_submit_request(struct spdk_io_channel *ch, struct spdk_b
					 bdev_io->u.bdev.offset_blocks * block_size,
					 bdev_io->u.bdev.num_blocks * block_size);

	case SPDK_BDEV_IO_TYPE_ZCOPY:
		if (bdev_io->u.bdev.zcopy.start) {
			void *buf;
			size_t len;

			buf = ((struct malloc_disk *)bdev_io->bdev->ctxt)->malloc_buf +
			      bdev_io->u.bdev.offset_blocks * block_size;
			len = bdev_io->u.bdev.num_blocks * block_size;
			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);
		return 0;
	default:
		return -1;
	}
@@ -333,6 +347,7 @@ bdev_malloc_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
	case SPDK_BDEV_IO_TYPE_RESET:
	case SPDK_BDEV_IO_TYPE_UNMAP:
	case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
	case SPDK_BDEV_IO_TYPE_ZCOPY:
		return true;

	default: