block: save page offset gaps in cloned bio
PATCH v2 1/1 block: save page offset gaps in cloned bio
From: Keith Busch <[email protected]>
The cloned bio needs to inherit the accumulated gaps between vectors so that we can know if this bio can subscribe to the iova coalescing optimization.
When cloning for a split, the gap only applies to the front bio since that's as far as has been processed. The remaining bio can reset its gaps to 0 since it advanced past the checked vectors, and will start its accounting from there on the next split check.
---v1->v2:
Added code comment explaining the reinitialization, and a more clear change log.
block/bio.c | 9 +++++++++ 1 file changed, 9 insertions(+)
block/bio.c +9 -0
@@ -859,6 +859,7 @@ static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp) bio->bi_ioprio = bio_src->bi_ioprio; bio->bi_write_hint = bio_src->bi_write_hint; bio->bi_write_stream = bio_src->bi_write_stream; + bio->bi_bvec_gap_bit = bio_src->bi_bvec_gap_bit; bio->bi_iter = bio_src->bi_iter; bio->bi_io_vec = bio_src->bi_io_vec;
@@ -1972,6 +1973,14 @@ struct bio *bio_split(struct bio *bio, int sectors,bio_advance (bio, split->bi_iter.bi_size); +/* +* The gap bit is set when splitting to limits and only applies to the +* front bio that was split off. The remaining bio will calcualte its +* gap value when it is subsequently split to limits, so it is safe to +* re-initialize the value back to 0. +*/ + bio->bi_bvec_gap_bit =0 ; +if (bio_flagged (bio,BIO_TRACE_COMPLETION ))bio_set_flag (split,BIO_TRACE_COMPLETION );
Signature · 1 line
2.53.0-Meta
Looks good:
Hi,
Quoted 11 lines · Keith Busch
From: Keith Busch <[email protected]>
The cloned bio needs to inherit the accumulated gaps between vectors so that we can know if this bio can subscribe to the iova coalescing optimization.
When cloning for a split, the gap only applies to the front bio since that's as far as has been processed. The remaining bio can reset its gaps to 0 since it advanced past the checked vectors, and will start its accounting from there on the next split check.
Quoted 4 lines
Fixes 2f6b2565d43c ("block: accumulate memory segment gaps per bio")Reported-by Eric Auger <[email protected]>Tested-by Eric Auger <[email protected]>Signed-off-by Keith Busch <[email protected]>
gentle ping on that fix. Could someone pull it?
Without it we see NVME I/O errors
Thank you in advance
Eric
Quoted 35 lines
---
v1->v2:
Added code comment explaining the reinitialization, and a more clear change log.block/bio.c | 9 +++++++++ 1 file changed, 9 insertions(+)block/bio.c +9
-0@@ -859,6 +859,7 @@ static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp) bio->bi_ioprio = bio_src->bi_ioprio; bio->bi_write_hint = bio_src->bi_write_hint; bio->bi_write_stream = bio_src->bi_write_stream; + bio->bi_bvec_gap_bit = bio_src->bi_bvec_gap_bit; bio->bi_iter = bio_src->bi_iter; bio->bi_io_vec = bio_src->bi_io_vec;@@ -1972,6 +1973,14 @@ struct bio *bio_split(struct bio *bio, int sectors,bio_advance (bio, split->bi_iter.bi_size); +/* +* The gap bit is set when splitting to limits and only applies to the +* front bio that was split off. The remaining bio will calcualte its +* gap value when it is subsequently split to limits, so it is safe to +* re-initialize the value back to 0. +*/ + bio->bi_bvec_gap_bit =0 ; +if (bio_flagged (bio,BIO_TRACE_COMPLETION ))bio_set_flag (split,BIO_TRACE_COMPLETION );
Quoted 1 line · Eric Auger
gentle ping on that fix. Could someone pull it?
Yes, and these two pending patches as well:
https://lore.kernel.org/linux-block/[email protected]/
https://lore.kernel.org/linux-block/d919f5285d16afbec6c51ecdf201692a484566e5.1786637565.git.bvanassche@acm.org/
Jens Axboe
maintainerQuoted 6 lines · Keith Busch
Quoted 1 line · Eric Auger
gentle ping on that fix. Could someone pull it?
Yes, and these two pending patches as well:
Done, those two.
Quoted 1 line
No longer applies.
Signature · 1 line
Jens Axboe
Quoted 10 lines · Keith Busch
The cloned bio needs to inherit the accumulated gaps between vectors so that we can know if this bio can subscribe to the iova coalescing optimization.
When cloning for a split, the gap only applies to the front bio since that's as far as has been processed. The remaining bio can reset its gaps to 0 since it advanced past the checked vectors, and will start its accounting from there on the next split check.
[...]
Applied, thanks!
[1/1] block: save page offset gaps in cloned bio
commit: 96c8ea3c5add7920b3c43840d1ea76b3354c8d2d
Best regards,
Signature · 1 line
Jens Axboe
Hi,
Quoted 11 lines · Jens Axboe
Quoted 9 lines · Keith Busch
The cloned bio needs to inherit the accumulated gaps between vectors so that we can know if this bio can subscribe to the iova coalescing optimization.
When cloning for a split, the gap only applies to the front bio since that's as far as has been processed. The remaining bio can reset its gaps to 0 since it advanced past the checked vectors, and will start its accounting from there on the next split check.
Quoted 6 lines
Quoted 1 line
[...]
Applied, thanks!
[1/1] block: save page offset gaps in cloned bio
commit: 96c8ea3c5add7920b3c43840d1ea76b3354c8d2d
Thanks!
Eric
Quoted 2 lines
Best regards,