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: Jim Harris <james.r.harris@intel.com> Change-Id: I770f2f24c37626063e113af850a2af792aed332a
This commit is contained in:
parent
77c57e2ff8
commit
aac30ff3f4
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user