Commit c60ae3c3 authored by Jim Harris's avatar Jim Harris
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I3b1eceac9b1cdd26130e59e1d400c9869a19f881

Reviewed-on: https://review.gerrithub.io/420677


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent cabe0203
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -647,6 +647,14 @@ raid_bdev_submit_request(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_i
{
	switch (bdev_io->type) {
	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:
		_raid_bdev_submit_rw_request(ch, bdev_io);
		break;
+7 −0
Original line number Diff line number Diff line
@@ -165,6 +165,13 @@ reset_globals(void)
	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 */
void
spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status status)