summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2026-09-09 09:08:53 +0300
committerJens Axboe <axboe@kernel.dk>2026-09-14 07:42:09 -0600
commitc7715a942e9daffe566bb87274714c170d06e256 (patch)
treedfd9017609dab1408061a0224ae899267bc238b7
parent3e756cc861e5a6c9ed428bb9918b4c5daaf42ee3 (diff)
downloadlinux-next-c7715a942e9daffe566bb87274714c170d06e256.tar.gz
linux-next-c7715a942e9daffe566bb87274714c170d06e256.zip
iomap: respect maximum I/O size in iomap_dio_bio_iter_one
Respect the maximum I/O size set for PI-enabled I/O in iomap_dio_bio_iter_one, otherwise bio_integrity_alloc_buf could under-allocate the integrity buffer when the initial kmalloc fails. Currently this should not be triggered as file systems that limit the size for PI always use bounce buffering, but this will change soon. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Link: https://patch.msgid.link/20260909060924.1102037-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/iomap/direct-io.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index bc726d47b7dc..91f5b67718a5 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -336,6 +336,7 @@ static ssize_t iomap_dio_bio_iter_one(struct iomap_iter *iter,
struct iomap_dio *dio, loff_t pos, unsigned int alignment,
blk_opf_t op)
{
+ unsigned int maxsize = iomap_max_bio_size(&iter->iomap);
unsigned int nr_vecs;
struct bio *bio;
ssize_t ret;
@@ -353,14 +354,12 @@ static ssize_t iomap_dio_bio_iter_one(struct iomap_iter *iter,
bio->bi_private = dio;
bio->bi_end_io = iomap_dio_bio_end_io;
-
if (dio->flags & IOMAP_DIO_BOUNCE)
- ret = bio_iov_iter_bounce(bio, dio->submit.iter,
- iomap_max_bio_size(&iter->iomap), alignment);
+ ret = bio_iov_iter_bounce(bio, dio->submit.iter, maxsize,
+ alignment);
else
- ret = bio_iov_iter_get_pages(bio, dio->submit.iter,
- BIO_MAX_SIZE, bdev_dma_alignment(bio->bi_bdev),
- alignment - 1);
+ ret = bio_iov_iter_get_pages(bio, dio->submit.iter, maxsize,
+ bdev_dma_alignment(bio->bi_bdev), alignment - 1);
if (unlikely(ret))
goto out_put_bio;
ret = bio->bi_iter.bi_size;