On 28/02/2025 01:19, Darrick J. Wong wrote:
+ if (ret == -EAGAIN && !(iocb->ki_flags & IOCB_NOWAIT) &&
+ !(dio_flags & IOMAP_DIO_ATOMIC_SW)) {
+ xfs_iunlock(ip, iolock);
+ dio_flags = IOMAP_DIO_ATOMIC_SW | IOMAP_DIO_FORCE_WAIT;
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.
Cheers,
John