OCF: add unmap io support
Add unmap to supported io types for vbdev_ocf Change-Id: I59fd11eaaaf09f4c2e0b9b6c6aa772fda9dfffe5 Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com> Reviewed-on: https://review.gerrithub.io/c/435742 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
b4c4cfba7f
commit
bc16c9320f
@ -372,8 +372,21 @@ vbdev_ocf_dobj_submit_io(struct ocf_io *io)
|
||||
static void
|
||||
vbdev_ocf_dobj_submit_discard(struct ocf_io *io)
|
||||
{
|
||||
/* TODO [unmap support] */
|
||||
io->end(io, 0);
|
||||
struct vbdev_ocf_base *base = ocf_data_obj_get_priv(io->obj);
|
||||
struct ocf_io_ctx *io_ctx = ocf_get_io_ctx(io);
|
||||
int status = 0;
|
||||
|
||||
prepare_submit(io);
|
||||
|
||||
status = spdk_bdev_unmap(
|
||||
base->desc, io_ctx->ch,
|
||||
io->addr, io->bytes,
|
||||
vbdev_ocf_dobj_submit_io_cb, io);
|
||||
if (status) {
|
||||
/* Since callback is not called, we need to do it manually to free io structures */
|
||||
SPDK_ERRLOG("Submission failed with status=%d\n", status);
|
||||
vbdev_ocf_dobj_submit_io_cb(NULL, false, io);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -266,6 +266,8 @@ io_submit_to_ocf(struct spdk_bdev_io *bdev_io, struct ocf_io *io)
|
||||
ocf_io_configure(io, offset, len, OCF_WRITE, 0, OCF_WRITE_FLUSH);
|
||||
return ocf_submit_flush(io);
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
ocf_io_configure(io, offset, len, 0, 0, 0);
|
||||
return ocf_submit_discard(io);
|
||||
case SPDK_BDEV_IO_TYPE_RESET:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
|
||||
default:
|
||||
@ -337,9 +339,9 @@ vbdev_ocf_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
||||
break;
|
||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||
case SPDK_BDEV_IO_TYPE_FLUSH:
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
io_handle(ch, bdev_io);
|
||||
break;
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
case SPDK_BDEV_IO_TYPE_RESET:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
|
||||
default:
|
||||
@ -359,8 +361,8 @@ vbdev_ocf_io_type_supported(void *opaque, enum spdk_bdev_io_type io_type)
|
||||
case SPDK_BDEV_IO_TYPE_READ:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||
case SPDK_BDEV_IO_TYPE_FLUSH:
|
||||
return spdk_bdev_io_type_supported(vbdev->core.bdev, io_type);
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
return spdk_bdev_io_type_supported(vbdev->core.bdev, io_type);
|
||||
case SPDK_BDEV_IO_TYPE_RESET:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user