raid: get buffer on reads before sending child ios
For front-ends like iSCSI (and NVMe-oF in the future) which want the backend to specify the data buffer, the RAID module doesn't copy the pointer to the allocated buffer from the child IO back to the parent IO. It really can't copy the pointer - the child IO owns it and will free it. So the RAID module needs to allocate the buffer first and then pass it down. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I3b1eceac9b1cdd26130e59e1d400c9869a19f881 Reviewed-on: https://review.gerrithub.io/420677 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
cabe0203da
commit
c60ae3c356
@ -647,6 +647,14 @@ raid_bdev_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
|
|||||||
{
|
{
|
||||||
switch (bdev_io->type) {
|
switch (bdev_io->type) {
|
||||||
case SPDK_BDEV_IO_TYPE_READ:
|
case SPDK_BDEV_IO_TYPE_READ:
|
||||||
|
if (bdev_io->u.bdev.iovs[0].iov_base == NULL) {
|
||||||
|
spdk_bdev_io_get_buf(bdev_io, _raid_bdev_submit_rw_request,
|
||||||
|
bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen);
|
||||||
|
} else {
|
||||||
|
/* Just call it directly if iov_base is already populated. */
|
||||||
|
_raid_bdev_submit_rw_request(ch, bdev_io);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SPDK_BDEV_IO_TYPE_WRITE:
|
case SPDK_BDEV_IO_TYPE_WRITE:
|
||||||
_raid_bdev_submit_rw_request(ch, bdev_io);
|
_raid_bdev_submit_rw_request(ch, bdev_io);
|
||||||
break;
|
break;
|
||||||
|
@ -165,6 +165,13 @@ reset_globals(void)
|
|||||||
rpc_req_size = 0;
|
rpc_req_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spdk_bdev_io_get_buf(struct spdk_bdev_io *bdev_io, spdk_bdev_io_get_buf_cb cb,
|
||||||
|
uint64_t len)
|
||||||
|
{
|
||||||
|
CU_ASSERT(false);
|
||||||
|
}
|
||||||
|
|
||||||
/* Store the IO completion status in global variable to verify by various tests */
|
/* Store the IO completion status in global variable to verify by various tests */
|
||||||
void
|
void
|
||||||
spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status status)
|
spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status status)
|
||||||
|
Loading…
Reference in New Issue
Block a user