From: Ritesh Harjani (IBM) Date: Mon, 3 Mar 2025 17:11:14 +0000 (+0000) Subject: iomap: Lift blocksize restriction on atomic writes X-Git-Tag: v6.15-rc1~249^2~2^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=786e3080cbe916f6a4c0987124d4f930c1814a97;p=thirdparty%2Fkernel%2Flinux.git iomap: Lift blocksize restriction on atomic writes Filesystems like ext4 can submit writes in multiples of blocksizes. But we still can't allow the writes to be split. Hence let's check if the iomap_length() is same as iter->len or not. It is the role of the FS to ensure that a single mapping may be created for an atomic write. The FS will also continue to check size and alignment legality. Signed-off-by: "Ritesh Harjani (IBM)" jpg: Tweak commit message Reviewed-by: "Darrick J. Wong" Signed-off-by: John Garry Link: https://lore.kernel.org/r/20250303171120.2837067-7-john.g.garry@oracle.com Signed-off-by: Christian Brauner --- diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c index c594f2cf3ab47..5299f70428efb 100644 --- a/fs/iomap/direct-io.c +++ b/fs/iomap/direct-io.c @@ -351,7 +351,7 @@ static int iomap_dio_bio_iter(struct iomap_iter *iter, struct iomap_dio *dio) u64 copied = 0; size_t orig_count; - if (atomic_hw && length != fs_block_size) + if (atomic_hw && length != iter->len) return -EINVAL; if ((pos | length) & (bdev_logical_block_size(iomap->bdev) - 1) ||