On Mon, Mar 03, 2025 at 05:11:13PM +0000, John Garry wrote: > 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. So now seeing how these are are to be used, these aren't "hardware" and "software" atomic IOs. They are block layer vs filesystem atomic IOs. We can do atomic IOs in software in the block layer drivers (think loop or dm-thinp) rather than off-loading to storage hardware. Hence I think these really need to be named after the layer that will provide the atomic IO guarantees, because "hw" and "sw" as they are currently used are not correct. e.g something like IOMAP_FS_ATOMIC and IOMAP_BDEV_ATOMIC which indicates which layer should be providing the atomic IO constraints and guarantees. -Dave. -- Dave Chinner david@xxxxxxxxxxxxx