We have provide correct byte counts to iov_iter, and it is enough to cap the iteration, not necessary to re-calculate exact nr_segs. Especially the previous two patches avoid to use bio->bi_vcnt as split hint, and don't use iov_iter->nr_segs to initialize bio->bi_vcnt. The iov_iter nr_segs re-calculation[1] is added for avoiding unnecessary bio split, which is fixed now by the previous two patches. [1] https://lkml.org/lkml/2025/4/16/351 Signed-off-by: Ming Lei --- io_uring/rsrc.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index a63474b331bf..ee6283676ba7 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1055,16 +1055,6 @@ static int io_import_kbuf(int ddir, struct iov_iter *iter, iov_iter_bvec(iter, ddir, imu->bvec, imu->nr_bvecs, count); iov_iter_advance(iter, offset); - - if (count < imu->len) { - const struct bio_vec *bvec = iter->bvec; - - while (len > bvec->bv_len) { - len -= bvec->bv_len; - bvec++; - } - iter->nr_segs = 1 + bvec - iter->bvec; - } return 0; } -- 2.47.0