]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iomap: Support SW-based atomic writes
authorJohn Garry <john.g.garry@oracle.com>
Mon, 3 Mar 2025 17:11:13 +0000 (17:11 +0000)
committerChristian Brauner <brauner@kernel.org>
Thu, 6 Mar 2025 10:00:12 +0000 (11:00 +0100)
commit794ca29dcc924cd3f16d12b6fba61074c992b8fd
tree83edf4d14edc5f9f43b5b3269ddfe4359c4275eb
parentb4de0e9be963b95c46c4a5426e94059923d236d6
iomap: Support SW-based atomic writes

Currently atomic write support requires dedicated HW support. This imposes
a restriction on the filesystem that disk blocks need to be aligned and
contiguously mapped to FS blocks to issue atomic writes.

XFS has no method to guarantee FS block alignment for regular,
non-RT files. As such, atomic writes are currently limited to 1x FS block
there.

To deal with the scenario that we are issuing an atomic write over
misaligned or discontiguous data blocks - and raise the atomic write size
limit - support a SW-based software emulated atomic write mode. For XFS,
this SW-based atomic writes would use CoW support to issue emulated untorn
writes.

It is the responsibility of the FS to detect discontiguous atomic writes
and switch to IOMAP_DIO_ATOMIC_SW mode and retry the write. Indeed,
SW-based atomic writes could be used always when the mounted bdev does
not support HW offload, but this strategy is not initially expected to be
used.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Link: https://lore.kernel.org/r/20250303171120.2837067-6-john.g.garry@oracle.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Documentation/filesystems/iomap/operations.rst
fs/iomap/direct-io.c
include/linux/iomap.h