linux-kernelorg-stable/io_uring
Caleb Sander Mateos 2d0e88f3fd io_uring/rsrc: don't use blk_rq_nr_phys_segments() as number of bvecs
io_buffer_register_bvec() currently uses blk_rq_nr_phys_segments() as
the number of bvecs in the request. However, bvecs may be split into
multiple segments depending on the queue limits. Thus, the number of
segments may overestimate the number of bvecs. For ublk devices, the
only current users of io_buffer_register_bvec(), virt_boundary_mask,
seg_boundary_mask, max_segments, and max_segment_size can all be set
arbitrarily by the ublk server process.
Set imu->nr_bvecs based on the number of bvecs the rq_for_each_bvec()
loop actually yields. However, continue using blk_rq_nr_phys_segments()
as an upper bound on the number of bvecs when allocating imu to avoid
needing to iterate the bvecs a second time.

Link: https://lore.kernel.org/io-uring/20251111191530.1268875-1-csander@purestorage.com/
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: 27cb27b6d5 ("io_uring: add support for kernel registered bvecs")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-11-12 08:25:33 -07:00
..
Kconfig
Makefile
advise.c
advise.h
alloc_cache.c
alloc_cache.h
cancel.c
cancel.h
cmd_net.c
epoll.c
epoll.h
eventfd.c
eventfd.h
fdinfo.c io_uring/sqpoll: switch away from getrusage() for CPU accounting 2025-10-22 10:51:20 -06:00
fdinfo.h
filetable.c io_uring: correct __must_hold annotation in io_install_fixed_file 2025-10-23 07:25:07 -06:00
filetable.h
fs.c
fs.h
futex.c
futex.h
io-wq.c
io-wq.h
io_uring.c io_uring: Fix code indentation error 2025-10-22 10:56:11 -06:00
io_uring.h
kbuf.c io_uring: fix buffer auto-commit for multishot uring_cmd 2025-10-23 19:41:31 -06:00
kbuf.h
memmap.c io_uring: fix types for region size calulation 2025-11-05 11:45:07 -07:00
memmap.h
mock_file.c
msg_ring.c
msg_ring.h
napi.c
napi.h
net.c io_uring: Fix code indentation error 2025-10-22 10:56:11 -06:00
net.h
nop.c
nop.h
notif.c
notif.h
opdef.c
opdef.h
openclose.c
openclose.h
poll.c
poll.h
query.c io_uring/query: return number of available queries 2025-11-10 14:59:35 -07:00
query.h
refs.h
register.c io_uring/zcrx: remove sync refill uapi 2025-11-03 08:55:58 -07:00
register.h
rsrc.c io_uring/rsrc: don't use blk_rq_nr_phys_segments() as number of bvecs 2025-11-12 08:25:33 -07:00
rsrc.h
rw.c io_uring/rw: ensure allocated iovec gets cleared for early failure 2025-11-10 14:59:08 -07:00
rw.h
slist.h
splice.c
splice.h
sqpoll.c io_uring/sqpoll: be smarter on when to update the stime usage 2025-10-22 10:55:33 -06:00
sqpoll.h io_uring/sqpoll: switch away from getrusage() for CPU accounting 2025-10-22 10:51:20 -06:00
statx.c
statx.h
sync.c
sync.h
tctx.c
tctx.h
timeout.c
timeout.h
truncate.c
truncate.h
uring_cmd.c
uring_cmd.h
waitid.c io_uring: fix incorrect unlikely() usage in io_waitid_prep() 2025-10-20 09:22:09 -06:00
waitid.h
xattr.c
xattr.h
zcrx.c io_uring/zcrx: remove sync refill uapi 2025-11-03 08:55:58 -07:00
zcrx.h io_uring/zcrx: remove sync refill uapi 2025-11-03 08:55:58 -07:00