Message ID | 20240904152605.4055570-10-kbusch@meta.com |
---|---|
State | Superseded |
Headers | show |
Series | block integrity merging and counting | expand |
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.
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 --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;