Commit bc16c932 authored by Vitaliy Mysak's avatar Vitaliy Mysak Committed by Darek Stojaczyk
Browse files

OCF: add unmap io support



Add unmap to supported io types for vbdev_ocf

Change-Id: I59fd11eaaaf09f4c2e0b9b6c6aa772fda9dfffe5
Signed-off-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/435742


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent b4c4cfba
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -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
+4 −2
Original line number Diff line number Diff line
@@ -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: