On 23/04/2025 09:25, Christoph Hellwig wrote:
On Tue, Apr 22, 2025 at 12:27:36PM +0000, John Garry wrote:
Add xfs_file_dio_write_atomic() for dedicated handling of atomic writes.
The function works based on two operating modes:
- HW offload, i.e. REQ_ATOMIC-based
- CoW based with out-of-places write and atomic extent remapping
The preferred method is HW offload as it will be faster. If HW offload is
not possible, then we fallback to the CoW-based method.
HW offload would not be possible for the write length exceeding the HW
offload limit, the write spanning multiple extents, unaligned disk blocks,
etc.
Apart from the write exceeding the HW offload limit, other conditions for
HW offload can only be detected in the iomap handling for the write. As
such, we use a fallback method to issue the write if we detect in the
->iomap_begin() handler that HW offload is not possible. Special code
-ENOPROTOOPT is returned from ->iomap_begin() to inform that HW offload
not possible.
This text could use a little rewrite starting with the fact that the
hardware offload now isn't required to start with and entirely
optional and then flow from the there to state when we can use it
instead of when we can't use it.
ok, sure
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
Thanks!