]> www.infradead.org Git - users/hch/misc.git/commitdiff
blk-mq: set the nr_integrity_segments from bio
authorKeith Busch <kbusch@kernel.org>
Fri, 13 Sep 2024 18:28:47 +0000 (11:28 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 13 Sep 2024 18:31:45 +0000 (12:31 -0600)
This value is used for merging considerations, so it needs to be
accurate.

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-3-kbusch@meta.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index ef3a2ed499563e9ea9cb784e4ca1372bb22173d9..82219f0e9a25680af56ae3bc41745e40dfdaf1fb 100644 (file)
@@ -2544,6 +2544,9 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio,
        rq->__sector = bio->bi_iter.bi_sector;
        rq->write_hint = bio->bi_write_hint;
        blk_rq_bio_prep(rq, bio, nr_segs);
+       if (bio_integrity(bio))
+               rq->nr_integrity_segments = blk_rq_count_integrity_sg(rq->q,
+                                                                     bio);
 
        /* This can't fail, since GFP_NOIO includes __GFP_DIRECT_RECLAIM. */
        err = blk_crypto_rq_bio_prep(rq, bio, GFP_NOIO);