Commit 2d0e88f
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/[email protected]/
Signed-off-by: Caleb Sander Mateos <[email protected]>
Fixes: 27cb27b ("io_uring: add support for kernel registered bvecs")
Reviewed-by: Ming Lei <[email protected]>
Reviewed-by: Chaitanya Kulkarni <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>1 parent 6a77267 commit 2d0e88f
1 file changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
943 | 943 | | |
944 | 944 | | |
945 | 945 | | |
946 | | - | |
947 | | - | |
| 946 | + | |
| 947 | + | |
948 | 948 | | |
949 | 949 | | |
950 | 950 | | |
| |||
965 | 965 | | |
966 | 966 | | |
967 | 967 | | |
968 | | - | |
969 | | - | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
970 | 973 | | |
971 | 974 | | |
972 | 975 | | |
| |||
977 | 980 | | |
978 | 981 | | |
979 | 982 | | |
980 | | - | |
981 | 983 | | |
982 | 984 | | |
983 | 985 | | |
984 | 986 | | |
985 | 987 | | |
986 | 988 | | |
987 | | - | |
988 | 989 | | |
989 | | - | |
| 990 | + | |
| 991 | + | |
990 | 992 | | |
991 | 993 | | |
992 | 994 | | |
| |||
0 commit comments