diff mbox series

[PATCHv3,09/10] blk-integrity: consider entire bio list for merging

Message ID 20240904152605.4055570-10-kbusch@meta.com
State Superseded
Headers show
Series block integrity merging and counting | expand

Commit Message

Keith Busch Sept. 4, 2024, 3:26 p.m. UTC
From: Keith Busch <kbusch@kernel.org>

If a bio is merged to a req, the entire bio list is merged, so don't
temporarily unchain it when counting segments for consideration.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 block/blk-integrity.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Christoph Hellwig Sept. 10, 2024, 3:48 p.m. UTC | #1
On Wed, Sep 04, 2024 at 08:26:04AM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> If a bio is merged to a req, the entire bio list is merged, so don't
> temporarily unchain it when counting segments for consideration.

As far as I can tell we never do merge decisions on bio lists.  If
bi_next is non-NULL here it probably is due to scheduler lists or
something like it.
Keith Busch Sept. 10, 2024, 5:19 p.m. UTC | #2
On Tue, Sep 10, 2024 at 05:48:43PM +0200, Christoph Hellwig wrote:
> On Wed, Sep 04, 2024 at 08:26:04AM -0700, Keith Busch wrote:
> > From: Keith Busch <kbusch@kernel.org>
> > 
> > If a bio is merged to a req, the entire bio list is merged, so don't
> > temporarily unchain it when counting segments for consideration.
> 
> As far as I can tell we never do merge decisions on bio lists.  If
> bi_next is non-NULL here it probably is due to scheduler lists or
> something like it.

I think bi_next is always NULL, so the unlinking should be a no-op. But
just in case it isn't, the current unlinking will get the wrong segment
count from the resulting merge.
diff mbox series

Patch

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index f9367f3a04208..985de64409cf5 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -92,7 +92,6 @@  bool blk_integrity_merge_bio(struct request_queue *q, struct request *req,
 			     struct bio *bio)
 {
 	int nr_integrity_segs;
-	struct bio *next = bio->bi_next;
 
 	if (blk_integrity_rq(req) == 0 && bio_integrity(bio) == NULL)
 		return true;
@@ -103,10 +102,7 @@  bool blk_integrity_merge_bio(struct request_queue *q, struct request *req,
 	if (bio_integrity(req->bio)->bip_flags != bio_integrity(bio)->bip_flags)
 		return false;
 
-	bio->bi_next = NULL;
 	nr_integrity_segs = blk_rq_count_integrity_segs(bio);
-	bio->bi_next = next;
-
 	if (req->nr_integrity_segments + nr_integrity_segs >
 	    q->limits.max_integrity_segments)
 		return false;