Skip to content

Commit 0d7cb52

Browse files
keithbuschaxboe
authored andcommitted
blk-integrity: consider entire bio list for merging
If a bio is merged to a request, the entire bio list is merged, so don't temporarily detach it from its list when counting segments. In most cases, bi_next will already be NULL, so detaching is usually a no-op. But if the bio does have a list, the current code is miscounting the segments for the resulting merge. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Keith Busch <kbusch@kernel.org> Link: https://lore.kernel.org/r/20240913182854.2445457-5-kbusch@meta.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent d148d75 commit 0d7cb52

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

block/blk-integrity.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req,
134134
struct bio *bio)
135135
{
136136
int nr_integrity_segs;
137-
struct bio *next = bio->bi_next;
138137

139138
if (blk_integrity_rq(req) == 0 && bio_integrity(bio) == NULL)
140139
return true;
@@ -145,10 +144,7 @@ bool blk_integrity_merge_bio(struct request_queue *q, struct request *req,
145144
if (bio_integrity(req->bio)->bip_flags != bio_integrity(bio)->bip_flags)
146145
return false;
147146

148-
bio->bi_next = NULL;
149147
nr_integrity_segs = blk_rq_count_integrity_sg(q, bio);
150-
bio->bi_next = next;
151-
152148
if (req->nr_integrity_segments + nr_integrity_segs >
153149
q->limits.max_integrity_segments)
154150
return false;

0 commit comments

Comments
 (0)