-
Notifications
You must be signed in to change notification settings - Fork 0
blk-mq: add blk_rq_nr_bvec() helper #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: linus-master_base
Are you sure you want to change the base?
Conversation
|
Upstream branch: e9a6fb0 |
|
Upstream branch: e9a6fb0 |
7c75abd to
47331e3
Compare
f699346 to
83d3e2f
Compare
|
Upstream branch: 6da43bb |
47331e3 to
3460485
Compare
83d3e2f to
00d5e5c
Compare
|
Upstream branch: f824272 |
3460485 to
2a62137
Compare
00d5e5c to
d782508
Compare
|
Upstream branch: f824272 |
2a62137 to
9afb527
Compare
d782508 to
6099a4d
Compare
|
Upstream branch: e7c375b |
9afb527 to
9aab496
Compare
6099a4d to
5121c4d
Compare
|
Upstream branch: e7c375b |
9aab496 to
cfc01e6
Compare
5121c4d to
4458758
Compare
|
Upstream branch: 8b69055 |
cfc01e6 to
1c8f6fb
Compare
4458758 to
6f43942
Compare
|
Upstream branch: fd95357 |
Add a new helper function blk_rq_nr_bvec() that returns the number of bvecs in a request. This count represents the number of iterations rq_for_each_bvec() would perform on a request. Drivers need to pre-allocate bvec arrays before iterating through a request's bvecs. Currently, they manually count bvecs using rq_for_each_bvec() in a loop, which is repetitive. The new helper centralizes this logic. This pattern exists in loop and zloop drivers, where multi-bio requests require copying bvecs into a contiguous array before creating an iov_iter for file operations. Update loop and zloop drivers to use the new helper, eliminating duplicate code. This patch also provides a clear API to avoid any potential misuse of blk_nr_phys_segments() for calculating the bvecs since, one bvec can have more than one segments and use of blk_nr_phys_segments() can lead to extra memory allocation :- [ 6155.673749] nullb_bio: 128K bio as ONE bvec: sector=0, size=131072 [ 6155.673846] null_blk: #### null_handle_data_transfer:1375 [ 6155.673850] null_blk: nr_bvec=1 blk_rq_nr_phys_segments=2 [ 6155.674263] null_blk: #### null_handle_data_transfer:1375 [ 6155.674267] null_blk: nr_bvec=1 blk_rq_nr_phys_segments=1 Signed-off-by: Chaitanya Kulkarni <[email protected]>
1c8f6fb to
3f564d1
Compare
Pull request for series with
subject: blk-mq: add blk_rq_nr_bvec() helper
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1022178