On Mon, Mar 10, 2025 at 10:44:47AM +0000, John Garry wrote: > On 09/03/2025 21:51, Dave Chinner wrote: > > 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. > > I'd prefer IOMAP_REQ_ATOMIC instead (of IOMAP_BDEV_ATOMIC), as we are using > REQ_ATOMIC for those BIOs only. Anything which the block layer and below > does with REQ_ATOMIC is its business, as long as it guarantees atomic > submission. But I am not overly keen on that name, as it clashes with block > layer names (naturally). I don't like encoding "REQ_ATOMIC" in iomap flags. If we're changing the names, they ought to reflect who's making the guarantees: IOMAP_DIO_BDEV_ATOMIC vs. IOMAP_DIO_FS_ATOMIC. Not sure why the flags lost the "_DIO" part. --D > And IOMAP_FS_ATOMIC seems a bit vague, but I can't think of anything else. > > Darrick, any opinion on this? > > Cheers, > John >