module/raid: remove redundant functions
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Change-Id: I8d872e4cf8911f20e9d2758ec9c6a5e397d231c4 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471083 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
485c79126c
commit
77b8618ecc
@ -368,6 +368,8 @@ _raid_bdev_submit_reset_request_next(void *_bdev_io)
|
|||||||
raid_bdev = (struct raid_bdev *)bdev_io->bdev->ctxt;
|
raid_bdev = (struct raid_bdev *)bdev_io->bdev->ctxt;
|
||||||
raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
|
raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
|
||||||
|
|
||||||
|
raid_io->base_bdev_io_expected = raid_bdev->num_base_bdevs;
|
||||||
|
|
||||||
while (raid_io->base_bdev_io_submitted < raid_bdev->num_base_bdevs) {
|
while (raid_io->base_bdev_io_submitted < raid_bdev->num_base_bdevs) {
|
||||||
i = raid_io->base_bdev_io_submitted;
|
i = raid_io->base_bdev_io_submitted;
|
||||||
ret = spdk_bdev_reset(raid_bdev->base_bdev_info[i].desc,
|
ret = spdk_bdev_reset(raid_bdev->base_bdev_info[i].desc,
|
||||||
@ -383,47 +385,6 @@ _raid_bdev_submit_reset_request_next(void *_bdev_io)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* brief:
|
|
||||||
* _raid_bdev_submit_reset_request function is the submit_request function for
|
|
||||||
* reset requests
|
|
||||||
* 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_reset_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
|
||||||
{
|
|
||||||
struct raid_bdev_io *raid_io;
|
|
||||||
struct raid_bdev *raid_bdev;
|
|
||||||
|
|
||||||
raid_bdev = (struct raid_bdev *)bdev_io->bdev->ctxt;
|
|
||||||
raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
|
|
||||||
raid_io->base_bdev_io_expected = raid_bdev->num_base_bdevs;
|
|
||||||
_raid_bdev_submit_reset_request_next(bdev_io);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* brief:
|
|
||||||
* _raid_bdev_submit_null_payload_request function is the submit_request function
|
|
||||||
* for io requests with range but without payload, like UNMAP and FLUSH.
|
|
||||||
* 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_null_payload_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
|
||||||
{
|
|
||||||
SPDK_DEBUGLOG(SPDK_LOG_BDEV_RAID, "raid_bdev: type %d, range (0x%lx, 0x%lx)\n",
|
|
||||||
bdev_io->type, bdev_io->u.bdev.offset_blocks, bdev_io->u.bdev.num_blocks);
|
|
||||||
|
|
||||||
raid0_submit_null_payload_request(bdev_io);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* brief:
|
* brief:
|
||||||
* Callback function to spdk_bdev_io_get_buf.
|
* Callback function to spdk_bdev_io_get_buf.
|
||||||
@ -443,7 +404,7 @@ raid_bdev_get_buf_cb(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
raid0_start_rw_request(ch, bdev_io);
|
raid0_submit_rw_request(bdev_io);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -473,16 +434,16 @@ raid_bdev_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
|||||||
bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen);
|
bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen);
|
||||||
break;
|
break;
|
||||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||||
raid0_start_rw_request(ch, bdev_io);
|
raid0_submit_rw_request(bdev_io);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPDK_BDEV_IO_TYPE_RESET:
|
case SPDK_BDEV_IO_TYPE_RESET:
|
||||||
_raid_bdev_submit_reset_request(ch, bdev_io);
|
_raid_bdev_submit_reset_request_next(bdev_io);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPDK_BDEV_IO_TYPE_FLUSH:
|
case SPDK_BDEV_IO_TYPE_FLUSH:
|
||||||
case SPDK_BDEV_IO_TYPE_UNMAP:
|
case SPDK_BDEV_IO_TYPE_UNMAP:
|
||||||
_raid_bdev_submit_null_payload_request(ch, bdev_io);
|
raid0_submit_null_payload_request(bdev_io);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -266,7 +266,7 @@ __RAID_MODULE_REGISTER(__LINE__)(void) \
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
raid0_start_rw_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io);
|
raid0_submit_rw_request(struct spdk_bdev_io *bdev_io);
|
||||||
void
|
void
|
||||||
raid0_submit_null_payload_request(void *_bdev_io);
|
raid0_submit_null_payload_request(void *_bdev_io);
|
||||||
void
|
void
|
||||||
|
@ -74,12 +74,11 @@ raid0_waitq_io_process(void *ctx);
|
|||||||
* member disk for raid0 bdevs.
|
* member disk for raid0 bdevs.
|
||||||
* params:
|
* params:
|
||||||
* bdev_io - parent bdev io
|
* bdev_io - parent bdev io
|
||||||
* start_strip - start strip number of this io
|
|
||||||
* returns:
|
* returns:
|
||||||
* none
|
* none
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
raid0_submit_rw_request(struct spdk_bdev_io *bdev_io, uint64_t start_strip)
|
raid0_submit_rw_request(struct spdk_bdev_io *bdev_io)
|
||||||
{
|
{
|
||||||
struct raid_bdev_io *raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
|
struct raid_bdev_io *raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
|
||||||
struct raid_bdev_io_channel *raid_ch = raid_io->raid_ch;
|
struct raid_bdev_io_channel *raid_ch = raid_io->raid_ch;
|
||||||
@ -90,6 +89,18 @@ raid0_submit_rw_request(struct spdk_bdev_io *bdev_io, uint64_t start_strip)
|
|||||||
uint64_t pd_blocks;
|
uint64_t pd_blocks;
|
||||||
uint8_t pd_idx;
|
uint8_t pd_idx;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
uint64_t start_strip;
|
||||||
|
uint64_t end_strip;
|
||||||
|
|
||||||
|
start_strip = bdev_io->u.bdev.offset_blocks >> raid_bdev->strip_size_shift;
|
||||||
|
end_strip = (bdev_io->u.bdev.offset_blocks + bdev_io->u.bdev.num_blocks - 1) >>
|
||||||
|
raid_bdev->strip_size_shift;
|
||||||
|
if (start_strip != end_strip && raid_bdev->num_base_bdevs > 1) {
|
||||||
|
assert(false);
|
||||||
|
SPDK_ERRLOG("I/O spans strip boundary!\n");
|
||||||
|
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pd_strip = start_strip / raid_bdev->num_base_bdevs;
|
pd_strip = start_strip / raid_bdev->num_base_bdevs;
|
||||||
pd_idx = start_strip % raid_bdev->num_base_bdevs;
|
pd_idx = start_strip % raid_bdev->num_base_bdevs;
|
||||||
@ -144,46 +155,8 @@ static void
|
|||||||
raid0_waitq_io_process(void *ctx)
|
raid0_waitq_io_process(void *ctx)
|
||||||
{
|
{
|
||||||
struct spdk_bdev_io *bdev_io = ctx;
|
struct spdk_bdev_io *bdev_io = ctx;
|
||||||
struct raid_bdev *raid_bdev;
|
|
||||||
uint64_t start_strip;
|
|
||||||
|
|
||||||
/*
|
raid0_submit_rw_request(bdev_io);
|
||||||
* Try to submit childs of parent bdev io. If failed due to resource
|
|
||||||
* crunch then break the loop and don't try to process other queued IOs.
|
|
||||||
*/
|
|
||||||
raid_bdev = (struct raid_bdev *)bdev_io->bdev->ctxt;
|
|
||||||
start_strip = bdev_io->u.bdev.offset_blocks >> raid_bdev->strip_size_shift;
|
|
||||||
raid0_submit_rw_request(bdev_io, start_strip);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* brief:
|
|
||||||
* raid0_start_rw_request function is the submit_request function for
|
|
||||||
* read/write requests for raid0 bdevs.
|
|
||||||
* params:
|
|
||||||
* ch - pointer to raid bdev io channel
|
|
||||||
* bdev_io - pointer to parent bdev_io on raid bdev device
|
|
||||||
* returns:
|
|
||||||
* none
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
raid0_start_rw_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
|
||||||
{
|
|
||||||
struct raid_bdev *raid_bdev;
|
|
||||||
uint64_t start_strip = 0;
|
|
||||||
uint64_t end_strip = 0;
|
|
||||||
|
|
||||||
raid_bdev = (struct raid_bdev *)bdev_io->bdev->ctxt;
|
|
||||||
start_strip = bdev_io->u.bdev.offset_blocks >> raid_bdev->strip_size_shift;
|
|
||||||
end_strip = (bdev_io->u.bdev.offset_blocks + bdev_io->u.bdev.num_blocks - 1) >>
|
|
||||||
raid_bdev->strip_size_shift;
|
|
||||||
if (start_strip != end_strip && raid_bdev->num_base_bdevs > 1) {
|
|
||||||
assert(false);
|
|
||||||
SPDK_ERRLOG("I/O spans strip boundary!\n");
|
|
||||||
spdk_bdev_io_complete(bdev_io, SPDK_BDEV_IO_STATUS_FAILED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
raid0_submit_rw_request(bdev_io, start_strip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* raid0 IO range */
|
/* raid0 IO range */
|
||||||
|
Loading…
Reference in New Issue
Block a user