raid: break out read/write code into separate function
This is needed for next patch which needs to defer reads when getting an io buf. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: If31e7d76384c7fd05cc77a3b2124ee4e9354823e Reviewed-on: https://review.gerrithub.io/420676 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
9928e9d98a
commit
cabe0203da
@ -581,10 +581,8 @@ raid_bdev_waitq_io_process(void *ctx)
|
||||
|
||||
/*
|
||||
* brief:
|
||||
* raid_bdev_submit_request function is the submit_request function pointer of
|
||||
* raid bdev function table. This is used to submit the io on raid_bdev to below
|
||||
* layers. If iowaitq is not empty, it will queue the parent bdev_io to the end
|
||||
* of the queue.
|
||||
* _raid_bdev_submit_rw_request function is the submit_request function for
|
||||
* read/write requests
|
||||
* params:
|
||||
* ch - pointer to raid bdev io channel
|
||||
* bdev_io - pointer to parent bdev_io on raid bdev device
|
||||
@ -592,7 +590,7 @@ raid_bdev_waitq_io_process(void *ctx)
|
||||
* none
|
||||
*/
|
||||
static void
|
||||
raid_bdev_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||
_raid_bdev_submit_rw_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||
{
|
||||
struct raid_bdev_io_channel *raid_bdev_io_channel;
|
||||
struct raid_bdev_io *raid_bdev_io;
|
||||
@ -601,14 +599,12 @@ raid_bdev_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
||||
uint64_t end_strip = 0;
|
||||
int ret;
|
||||
|
||||
switch (bdev_io->type) {
|
||||
case SPDK_BDEV_IO_TYPE_READ:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||
if (bdev_io->u.bdev.iovcnt != 1) {
|
||||
SPDK_ERRLOG("iov vector count is not 1\n");
|
||||
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* IO parameters used during io split and io completion
|
||||
*/
|
||||
@ -633,6 +629,26 @@ raid_bdev_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
||||
if (ret != 0) {
|
||||
raid_bdev_io_submit_fail_process(raid_bdev, bdev_io, raid_bdev_io, ret);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* brief:
|
||||
* raid_bdev_submit_request function is the submit_request function pointer of
|
||||
* raid bdev function table. This is used to submit the io on raid_bdev to below
|
||||
* layers.
|
||||
* params:
|
||||
* ch - pointer to raid bdev io channel
|
||||
* bdev_io - pointer to parent bdev_io on raid bdev device
|
||||
* returns:
|
||||
* none
|
||||
*/
|
||||
static void
|
||||
raid_bdev_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||
{
|
||||
switch (bdev_io->type) {
|
||||
case SPDK_BDEV_IO_TYPE_READ:
|
||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||
_raid_bdev_submit_rw_request(ch, bdev_io);
|
||||
break;
|
||||
|
||||
case SPDK_BDEV_IO_TYPE_FLUSH:
|
||||
|
Loading…
Reference in New Issue
Block a user