Commit 01e7c02e authored by Jim Harris's avatar Jim Harris
Browse files

bdev: call spdk_bdev_io_get_buf before splitting



We cannot split an iov if a buffer hasn't been
allocated yet.  So always call spdk_bdev_io_get_buf
on reads before trying to split.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I2c26efb9dc6cb2c7c3e3b7ae5bab2c37844b9113

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent 0a4a217c
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1229,7 +1229,7 @@ _spdk_bdev_io_split_done(struct spdk_bdev_io *bdev_io, bool success, void *cb_ar
}

static void
_spdk_bdev_io_split(struct spdk_bdev_io *bdev_io)
_spdk_bdev_io_split(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
{
	assert(_spdk_bdev_io_type_can_split(bdev_io->type));

@@ -1287,7 +1287,12 @@ spdk_bdev_io_submit(struct spdk_bdev_io *bdev_io)
	assert(bdev_io->internal.status == SPDK_BDEV_IO_STATUS_PENDING);

	if (bdev->split_on_optimal_io_boundary && _spdk_bdev_io_should_split(bdev_io)) {
		_spdk_bdev_io_split(bdev_io);
		if (bdev_io->type == SPDK_BDEV_IO_TYPE_READ) {
			spdk_bdev_io_get_buf(bdev_io, _spdk_bdev_io_split,
					     bdev_io->u.bdev.num_blocks * bdev_io->bdev->blocklen);
		} else {
			_spdk_bdev_io_split(NULL, bdev_io);
		}
		return;
	}