module/raid: simplify raid_bdev_queue_io_wait()
Pass raid_io instead of bdev_io to raid_bdev_queue_io_wait() and its callbacks to eliminate unnecessary type conversions. Pass bdev and io_channel directly as parameters instead of passing a base device index. Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Change-Id: Iecbf351ec1598b29709e7ccff2efb1776faf11f9 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471086 Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
235cc2c956
commit
ae70d6a4a6
@ -315,35 +315,30 @@ raid_bdev_base_io_completion(struct spdk_bdev_io *bdev_io, bool success, void *c
|
||||
* raid_bdev_queue_io_wait function processes the IO which failed to submit.
|
||||
* It will try to queue the IOs after storing the context to bdev wait queue logic.
|
||||
* params:
|
||||
* raid_bdev_io - pointer to raid bdev_io
|
||||
* pd_idx - base_dev index in raid_bdev
|
||||
* cb_fn - callback when the spdk_bdev_io for base_bdev becomes available
|
||||
* raid_io - pointer to raid_bdev_io
|
||||
* bdev - the block device that the IO is submitted to
|
||||
* ch - io channel
|
||||
* cb_fn - callback when the spdk_bdev_io for bdev becomes available
|
||||
* returns:
|
||||
* none
|
||||
*/
|
||||
void
|
||||
raid_bdev_queue_io_wait(struct spdk_bdev_io *raid_bdev_io, uint8_t pd_idx,
|
||||
spdk_bdev_io_wait_cb cb_fn)
|
||||
raid_bdev_queue_io_wait(struct raid_bdev_io *raid_io, struct spdk_bdev *bdev,
|
||||
struct spdk_io_channel *ch, spdk_bdev_io_wait_cb cb_fn)
|
||||
{
|
||||
struct raid_bdev_io *raid_io = (struct raid_bdev_io *)raid_bdev_io->driver_ctx;
|
||||
struct raid_bdev *raid_bdev = raid_io->raid_bdev;
|
||||
|
||||
raid_io->waitq_entry.bdev = raid_bdev->base_bdev_info[pd_idx].bdev;
|
||||
raid_io->waitq_entry.bdev = bdev;
|
||||
raid_io->waitq_entry.cb_fn = cb_fn;
|
||||
raid_io->waitq_entry.cb_arg = raid_bdev_io;
|
||||
spdk_bdev_queue_io_wait(raid_bdev->base_bdev_info[pd_idx].bdev,
|
||||
raid_io->raid_ch->base_channel[pd_idx],
|
||||
&raid_io->waitq_entry);
|
||||
raid_io->waitq_entry.cb_arg = raid_io;
|
||||
spdk_bdev_queue_io_wait(bdev, ch, &raid_io->waitq_entry);
|
||||
}
|
||||
|
||||
static void
|
||||
raid_bdev_submit_reset_request(struct raid_bdev_io *raid_io);
|
||||
|
||||
static void
|
||||
_raid_bdev_submit_reset_request(void *_bdev_io)
|
||||
_raid_bdev_submit_reset_request(void *_raid_io)
|
||||
{
|
||||
struct spdk_bdev_io *bdev_io = _bdev_io;
|
||||
struct raid_bdev_io *raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
|
||||
struct raid_bdev_io *raid_io = _raid_io;
|
||||
|
||||
raid_bdev_submit_reset_request(raid_io);
|
||||
}
|
||||
@ -382,7 +377,7 @@ raid_bdev_submit_reset_request(struct raid_bdev_io *raid_io)
|
||||
if (ret == 0) {
|
||||
raid_io->base_bdev_io_submitted++;
|
||||
} else if (ret == -ENOMEM) {
|
||||
raid_bdev_queue_io_wait(bdev_io, i,
|
||||
raid_bdev_queue_io_wait(raid_io, base_info->bdev, base_ch,
|
||||
_raid_bdev_submit_reset_request);
|
||||
return;
|
||||
} else {
|
||||
|
@ -275,7 +275,7 @@ raid0_submit_null_payload_request(struct raid_bdev_io *raid_io);
|
||||
void
|
||||
raid_bdev_base_io_completion(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg);
|
||||
void
|
||||
raid_bdev_queue_io_wait(struct spdk_bdev_io *raid_bdev_io, uint8_t pd_idx,
|
||||
spdk_bdev_io_wait_cb cb_fn);
|
||||
raid_bdev_queue_io_wait(struct raid_bdev_io *raid_io, struct spdk_bdev *bdev,
|
||||
struct spdk_io_channel *ch, spdk_bdev_io_wait_cb cb_fn);
|
||||
|
||||
#endif /* SPDK_BDEV_RAID_INTERNAL_H */
|
||||
|
@ -66,7 +66,12 @@ raid0_bdev_io_completion(struct spdk_bdev_io *bdev_io, bool success, void *cb_ar
|
||||
}
|
||||
|
||||
static void
|
||||
raid0_waitq_io_process(void *ctx);
|
||||
_raid0_submit_rw_request(void *_raid_io)
|
||||
{
|
||||
struct raid_bdev_io *raid_io = _raid_io;
|
||||
|
||||
raid0_submit_rw_request(raid_io);
|
||||
}
|
||||
|
||||
/*
|
||||
* brief:
|
||||
@ -139,7 +144,8 @@ raid0_submit_rw_request(struct raid_bdev_io *raid_io)
|
||||
}
|
||||
|
||||
if (ret == -ENOMEM) {
|
||||
raid_bdev_queue_io_wait(bdev_io, pd_idx, raid0_waitq_io_process);
|
||||
raid_bdev_queue_io_wait(raid_io, base_info->bdev, base_ch,
|
||||
_raid0_submit_rw_request);
|
||||
} else if (ret != 0) {
|
||||
SPDK_ERRLOG("bdev io submit error not due to ENOMEM, it should not happen\n");
|
||||
assert(false);
|
||||
@ -147,25 +153,6 @@ raid0_submit_rw_request(struct raid_bdev_io *raid_io)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* brief:
|
||||
* raid0_waitq_io_process function is the callback function
|
||||
* registered by raid bdev module to bdev when bdev_io was unavailable
|
||||
* for raid0 bdevs.
|
||||
* params:
|
||||
* ctx - pointer to raid_bdev_io
|
||||
* returns:
|
||||
* none
|
||||
*/
|
||||
static void
|
||||
raid0_waitq_io_process(void *ctx)
|
||||
{
|
||||
struct spdk_bdev_io *bdev_io = ctx;
|
||||
struct raid_bdev_io *raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
|
||||
|
||||
raid0_submit_rw_request(raid_io);
|
||||
}
|
||||
|
||||
/* raid0 IO range */
|
||||
struct raid_bdev_io_range {
|
||||
uint64_t strip_size;
|
||||
@ -262,10 +249,9 @@ _raid0_split_io_range(struct raid_bdev_io_range *io_range, uint8_t disk_idx,
|
||||
}
|
||||
|
||||
static void
|
||||
_raid0_submit_null_payload_request(void *_bdev_io)
|
||||
_raid0_submit_null_payload_request(void *_raid_io)
|
||||
{
|
||||
struct spdk_bdev_io *bdev_io = _bdev_io;
|
||||
struct raid_bdev_io *raid_io = (struct raid_bdev_io *)bdev_io->driver_ctx;
|
||||
struct raid_bdev_io *raid_io = _raid_io;
|
||||
|
||||
raid0_submit_null_payload_request(raid_io);
|
||||
}
|
||||
@ -336,7 +322,7 @@ raid0_submit_null_payload_request(struct raid_bdev_io *raid_io)
|
||||
if (ret == 0) {
|
||||
raid_io->base_bdev_io_submitted++;
|
||||
} else if (ret == -ENOMEM) {
|
||||
raid_bdev_queue_io_wait(bdev_io, disk_idx,
|
||||
raid_bdev_queue_io_wait(raid_io, base_info->bdev, base_ch,
|
||||
_raid0_submit_null_payload_request);
|
||||
return;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user