block: add size alignment to bio_iov_iter_get_pages
authorKeith Busch <kbusch@kernel.org>
Wed, 27 Aug 2025 14:12:52 +0000 (07:12 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 9 Sep 2025 16:27:01 +0000 (10:27 -0600)
commit743bf2e0c49c835cb7c4e4ac7d5a2610587047be
tree5fb6f60c7e805262bdb5cfc389bae81012de3154
parentfec2e705729dc93de5399d8b139e4746805c3d81
block: add size alignment to bio_iov_iter_get_pages

The block layer tries to align bio vectors to the block device's logical
block size. Some cases don't have a block device, or we may need to
align to something larger, which we can't derive it from the queue
limits. Have the caller specify what they want, or allow any length
alignment if nothing was specified. Since the most common use case
relies on the block device's limits, a helper function is provided.

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/fops.c
fs/iomap/direct-io.c
include/linux/bio.h
include/linux/blkdev.h