On 28/02/2025 15:39, Darrick J. Wong wrote:
One last little nit here: if the filesystem doesn't have reflink, you
can't use copy on write as a fallback.
/*
* The atomic write fallback uses out of place writes
* implemented with the COW code, so we must fail the
* atomic write if that is not supported.
*/
if (!xfs_has_reflink(ip->i_mount))
return -EOPNOTSUPP;
dio_flags = IOMAP_DIO_ATOMIC_SW | IOMAP_DIO_FORCE_WAIT;
Currently the awu max is limited to 1x FS block if no reflink, and then we
check the write length against awu max in xfs_file_write_iter() for
IOCB_ATOMIC. And the xfs iomap would not request a SW-based atomic write for
1x FS block. So in a around-about way we are checking it.
So let me know if you would still like that additional check - it seems
sensible to add it.
Yes, please. The more guardrails the better, particularly when someone
gets around to enabling software-only RWF_ATOMIC.
ok, but I think that adding it at the start of
xfs_atomic_write_sw_iomap_begin() is a better place (to add it).
It seems a bit neater (than adding it here) with the retry handling and
locking/unlocking, and would save adding it in another possible future
callsite for xfs_atomic_write_sw_iomap_begin().
Cheers,
John