Commit b535d15d authored by Denis Barakhtanov's avatar Denis Barakhtanov Committed by Jim Harris
Browse files

bdev/daos: fix write of multiple iovs



bdev_daos_writev() had a typo where local variable `io` wasn't advancing
in a loop over iovs. To avoid such issues in the future, function argument `iov`
is used instead, there's no need for original value and it seems less error prone.

bdev_daos_readv() was updated as well to be consistent with bdev_daos_write()

Signed-off-by: default avatarDenis Barakhtanov <denis.barahtanov@croit.io>
Change-Id: I06d39f207c7b881aca950c5721f250c17d41c328
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15581


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent b7a612b1
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -160,7 +160,6 @@ bdev_daos_writev(struct bdev_daos *daos, struct bdev_daos_io_channel *ch,
		 struct iovec *iov, int iovcnt, uint64_t nbytes, uint64_t offset)
{
	int rc;
	struct iovec *io = iov;

	SPDK_DEBUGLOG(bdev_daos, "write %d iovs size %lu to off: %#lx\n",
		      iovcnt, nbytes, offset);
@@ -183,7 +182,7 @@ bdev_daos_writev(struct bdev_daos *daos, struct bdev_daos_io_channel *ch,
	}

	for (int i = 0; i < iovcnt; i++, iov++) {
		d_iov_set(&(task->diovs[i]), io->iov_base, io->iov_len);
		d_iov_set(&(task->diovs[i]), iov->iov_base, iov->iov_len);
	}

	task->sgl.sg_nr = iovcnt;
@@ -207,7 +206,6 @@ bdev_daos_readv(struct bdev_daos *daos, struct bdev_daos_io_channel *ch,
		struct iovec *iov, int iovcnt, uint64_t nbytes, uint64_t offset)
{
	int rc;
	struct iovec *io = iov;

	SPDK_DEBUGLOG(bdev_daos, "read %d iovs size %lu to off: %#lx\n",
		      iovcnt, nbytes, offset);
@@ -229,8 +227,8 @@ bdev_daos_readv(struct bdev_daos *daos, struct bdev_daos_io_channel *ch,
		return -EINVAL;
	}

	for (int i = 0; i < iovcnt; i++, io++) {
		d_iov_set(&(task->diovs[i]), io->iov_base, io->iov_len);
	for (int i = 0; i < iovcnt; i++, iov++) {
		d_iov_set(&(task->diovs[i]), iov->iov_base, iov->iov_len);
	}

	task->sgl.sg_nr = iovcnt;