bdev/raid: enable flush support

FLUSH io_type shares a same process with UNMAP, except
that in the end, it calls spdk_bdev_flush_blocks function.

Change-Id: I4529bf29b7cd9f16d10f2edc99a20d25213c9c71
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446492
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Xiaodong Liu 2019-02-28 21:00:11 +08:00 committed by Changpeng Liu
parent 32c888e575
commit d77608212b
2 changed files with 16 additions and 5 deletions

View File

@ -742,6 +742,13 @@ _raid_bdev_submit_null_payload_request_next(void *_bdev_io)
raid_bdev_base_io_completion, bdev_io);
break;
case SPDK_BDEV_IO_TYPE_FLUSH:
ret = spdk_bdev_flush_blocks(raid_bdev->base_bdev_info[disk_idx].desc,
raid_ch->base_channel[disk_idx],
offset_in_disk, nblocks_in_disk,
raid_bdev_base_io_completion, bdev_io);
break;
default:
SPDK_ERRLOG("submit request, invalid io type with null payload %u\n", bdev_io->type);
assert(false);
@ -835,15 +842,11 @@ raid_bdev_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
raid_bdev_start_rw_request(ch, bdev_io);
break;
case SPDK_BDEV_IO_TYPE_FLUSH:
/* TODO: support flush if requirement comes */
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_SUCCESS);
break;
case SPDK_BDEV_IO_TYPE_RESET:
_raid_bdev_submit_reset_request(ch, bdev_io);
break;
case SPDK_BDEV_IO_TYPE_FLUSH:
case SPDK_BDEV_IO_TYPE_UNMAP:
_raid_bdev_submit_null_payload_request(ch, bdev_io);
break;

View File

@ -306,6 +306,14 @@ spdk_bdev_unmap_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
return g_bdev_io_submit_status;
}
int
spdk_bdev_flush_blocks(struct spdk_bdev_desc *desc, struct spdk_io_channel *ch,
uint64_t offset_blocks, uint64_t num_blocks,
spdk_bdev_io_completion_cb cb, void *cb_arg)
{
return 0;
}
bool
spdk_bdev_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type io_type)
{