Linux block layer
 help / color / mirror / Atom feed
* [PATCH] block: save page offset gaps in cloned bio
@ 2026-08-17 16:59 Keith Busch
  2026-08-18 15:09 ` Eric Auger
  2026-08-19  5:23 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2026-08-17 16:59 UTC (permalink / raw)
  To: linux-block; +Cc: axboe, hch, Keith Busch, Eric Auger

From: Keith Busch <kbusch@kernel.org>

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. The split remainder meanwhile can reset its gaps to 0
since it advanced beyond it and will start accounting from there.

Fixes: 2f6b2565d43c ("block: accumulate memory segment gaps per bio")
Reported-by: Eric Auger <eauger@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 block/bio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/bio.c b/block/bio.c
index 898b2f5ef8c81..33aa439c1bae2 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -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;
 
@@ -1971,6 +1972,7 @@ struct bio *bio_split(struct bio *bio, int sectors,
 		bio_integrity_trim(split);
 
 	bio_advance(bio, split->bi_iter.bi_size);
+	bio->bi_bvec_gap_bit = 0;
 
 	if (bio_flagged(bio, BIO_TRACE_COMPLETION))
 		bio_set_flag(split, BIO_TRACE_COMPLETION);
-- 
2.53.0-Meta


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: save page offset gaps in cloned bio
  2026-08-17 16:59 [PATCH] block: save page offset gaps in cloned bio Keith Busch
@ 2026-08-18 15:09 ` Eric Auger
  2026-08-19  5:23 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Auger @ 2026-08-18 15:09 UTC (permalink / raw)
  To: Keith Busch, linux-block; +Cc: axboe, hch, Keith Busch

Hi Keith,

On 8/17/26 6:59 PM, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> 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. The split remainder meanwhile can reset its gaps to 0
> since it advanced beyond it and will start accounting from there.
> 
> Fixes: 2f6b2565d43c ("block: accumulate memory segment gaps per bio")
> Reported-by: Eric Auger <eauger@redhat.com>
> Signed-off-by: Keith Busch <kbusch@kernel.org>

Tested-by: Eric Auger <eric.auger@redhat.com>

Many Thanks!

Eric

> ---
>  block/bio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/block/bio.c b/block/bio.c
> index 898b2f5ef8c81..33aa439c1bae2 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -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;
>  
> @@ -1971,6 +1972,7 @@ struct bio *bio_split(struct bio *bio, int sectors,
>  		bio_integrity_trim(split);
>  
>  	bio_advance(bio, split->bi_iter.bi_size);
> +	bio->bi_bvec_gap_bit = 0;
>  
>  	if (bio_flagged(bio, BIO_TRACE_COMPLETION))
>  		bio_set_flag(split, BIO_TRACE_COMPLETION);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block: save page offset gaps in cloned bio
  2026-08-17 16:59 [PATCH] block: save page offset gaps in cloned bio Keith Busch
  2026-08-18 15:09 ` Eric Auger
@ 2026-08-19  5:23 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-08-19  5:23 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-block, axboe, hch, Keith Busch, Eric Auger

On Mon, Aug 17, 2026 at 09:59:08AM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> 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.

Makes sense.

> The split remainder meanwhile can reset its gaps to 0
> since it advanced beyond it and will start accounting from there.

I don't really understand this part, though.  As in I don't even
understand what you mean here..


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-19  5:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 16:59 [PATCH] block: save page offset gaps in cloned bio Keith Busch
2026-08-18 15:09 ` Eric Auger
2026-08-19  5:23 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox