Skip to content

Commit 2a51c32

Browse files
minhbq-99axboe
authored andcommitted
io_uring/rsrc: simplify the bvec iter count calculation
As we don't use iov_iter_advance() but our own logic in io_import_fixed(), we can remove the logic that over-sets the iter's count to len + offset then adjusts it later to len. This helps to make the code cleaner. Signed-off-by: Bui Quang Minh <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent d62c2f0 commit 2a51c32

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

io_uring/rsrc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
882882
* and advance us to the beginning.
883883
*/
884884
offset = buf_addr - imu->ubuf;
885-
iov_iter_bvec(iter, ddir, imu->bvec, imu->nr_bvecs, offset + len);
885+
iov_iter_bvec(iter, ddir, imu->bvec, imu->nr_bvecs, len);
886886

887887
if (offset) {
888888
/*
@@ -904,7 +904,6 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
904904
const struct bio_vec *bvec = imu->bvec;
905905

906906
if (offset < bvec->bv_len) {
907-
iter->count -= offset;
908907
iter->iov_offset = offset;
909908
} else {
910909
unsigned long seg_skip;
@@ -915,7 +914,6 @@ int io_import_fixed(int ddir, struct iov_iter *iter,
915914

916915
iter->bvec += seg_skip;
917916
iter->nr_segs -= seg_skip;
918-
iter->count -= bvec->bv_len + offset;
919917
iter->iov_offset = offset & ((1UL << imu->folio_shift) - 1);
920918
}
921919
}

0 commit comments

Comments
 (0)