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

bdev/nvme: reorganize queued_next_sge()



No functional change, but removes a few assumptions
that will be invalid in a future patch that fixes a
bug in this function.  Primarily we no longer assume
that this function will always increment the
iovpos and reset iov_offset to 0.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I770f2f24c37626063e113af850a2af792aed332a
parent 77c57e2f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -648,7 +648,6 @@ queued_next_sge(void *ref, void **address, uint32_t *length)
	assert(bio->iovpos < bio->iovcnt);

	iov = &bio->iovs[bio->iovpos];
	bio->iovpos++;

	*address = iov->iov_base;
	*length = iov->iov_len;
@@ -657,6 +656,11 @@ queued_next_sge(void *ref, void **address, uint32_t *length)
		assert(bio->iov_offset <= iov->iov_len);
		*address += bio->iov_offset;
		*length -= bio->iov_offset;
	}

	bio->iov_offset += *length;
	if (bio->iov_offset == iov->iov_len) {
		bio->iovpos++;
		bio->iov_offset = 0;
	}