On 20/03/2025 07:00, Christoph Hellwig wrote:
On Wed, Mar 19, 2025 at 11:44:02AM +0000, John Garry wrote:
XFS supports atomic writes - or untorn writes - based on different methods:
- HW offload in the disk
- Software emulation
The value reported in stx_atomic_write_unit_max will be the max of the
software emulation method.
I don't think emulation is a good word. A file system implementing
file systems things is not emulation.
Sure, I am still in the mindset that a filesystem-based atomic write is
a 2nd-class citizen and just trying to emulate what can be done in the disk.
We want STATX_WRITE_ATOMIC to get this new member in addition to the
already-existing members, so mention that a value of 0 means that
stx_atomic_write_unit_max holds this limit.
Does that actually work? Can userspace assume all unknown statx
fields are padded to zero? If so my dio read align change could have
done away with the extra flag.
I will double check that, but if we needed to add another mask just for
getting this, then yuck.
But is there value in reporting this limit? I am not sure. I am not sure
what the user would do with this info.
Maybe, for example, they want to write 1K consecutive 16K pages, each
atomically, and decide to do a big 16M atomic write but find that it is
slow as bdev atomic limit is < 16M.
Maybe I should just update the documentation to mention that for XFS
they should check the mounted bdev atomic limits.