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: Denis Barakhtanov <denis.barahtanov@croit.io>
Change-Id: I06d39f207c7b881aca950c5721f250c17d41c328
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15581
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Denis Barakhtanov 2022-11-23 13:12:54 +11:00 committed by Jim Harris
parent b7a612b149
commit b535d15d84

View File

@ -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;