block: accumulate memory segment gaps per bio
authorKeith Busch <kbusch@kernel.org>
Tue, 14 Oct 2025 15:04:55 +0000 (08:04 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 7 Nov 2025 01:11:58 +0000 (18:11 -0700)
commit2f6b2565d43cdb5087cac23d530cca84aa3d897e
treeb985942dfe23e833c5f10d7156ea98ad455b64c9
parent0739c2c6a015604a7c01506bea28200a2cc2e08c
block: accumulate memory segment gaps per bio

The blk-mq dma iterator has an optimization for requests that align to
the device's iommu merge boundary. This boundary may be larger than the
device's virtual boundary, but the code had been depending on that queue
limit to know ahead of time if the request is guaranteed to align to
that optimization.

Rather than rely on that queue limit, which many devices may not report,
save the lowest set bit of any boundary gap between each segment in the
bio while checking the segments. The request stores the value for
merging and quickly checking per io if the request can use iova
optimizations.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c
block/blk-map.c
block/blk-merge.c
block/blk-mq-dma.c
block/blk-mq.c
include/linux/bio.h
include/linux/blk-mq.h
include/linux/blk_types.h