OCF: add flush io support
Add flush to supported io types for vbdev_ocf Change-Id: I7e53474670628f425cedbd24bc0679cfa6715a19 Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com> Reviewed-on: https://review.gerrithub.io/c/435739 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Chunyang Hui <chunyang.hui@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
2fde729fd7
commit
b4c4cfba7f
@ -283,6 +283,26 @@ prepare_submit(struct ocf_io *io)
|
||||
static void
|
||||
vbdev_ocf_dobj_submit_flush(struct ocf_io *io)
|
||||
{
|
||||
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;
|
||||
|
||||
if (base->is_cache) {
|
||||
io->end(io, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
prepare_submit(io);
|
||||
|
||||
status = spdk_bdev_flush(
|
||||
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
|
||||
|
@ -263,6 +263,8 @@ io_submit_to_ocf(struct spdk_bdev_io *bdev_io, struct ocf_io *io)
|
||||
ocf_io_configure(io, offset, len, dir, 0, 0);
|
||||
return ocf_submit_io(io);
|
||||
case SPDK_BDEV_IO_TYPE_FLUSH:
|
||||
ocf_io_configure(io, offset, len, OCF_WRITE, 0, OCF_WRITE_FLUSH);
|
||||
return ocf_submit_flush(io);
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
case SPDK_BDEV_IO_TYPE_RESET:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
|
||||
@ -334,10 +336,10 @@ vbdev_ocf_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
||||
bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen);
|
||||
break;
|
||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||
case SPDK_BDEV_IO_TYPE_FLUSH:
|
||||
io_handle(ch, bdev_io);
|
||||
break;
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
case SPDK_BDEV_IO_TYPE_FLUSH:
|
||||
case SPDK_BDEV_IO_TYPE_RESET:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
|
||||
default:
|
||||
@ -351,12 +353,14 @@ vbdev_ocf_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
||||
static bool
|
||||
vbdev_ocf_io_type_supported(void *opaque, enum spdk_bdev_io_type io_type)
|
||||
{
|
||||
struct vbdev_ocf *vbdev = opaque;
|
||||
|
||||
switch (io_type) {
|
||||
case SPDK_BDEV_IO_TYPE_READ:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||
return true;
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
case SPDK_BDEV_IO_TYPE_FLUSH:
|
||||
return spdk_bdev_io_type_supported(vbdev->core.bdev, io_type);
|
||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||
case SPDK_BDEV_IO_TYPE_RESET:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user