]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfs: add large atomic writes checks in xfs_direct_write_iomap_begin()
authorJohn Garry <john.g.garry@oracle.com>
Wed, 7 May 2025 21:18:30 +0000 (14:18 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 7 May 2025 21:25:32 +0000 (14:25 -0700)
commit11ab31909d7cc177fab981cd0d6822a570244599
treec2e7de8dfcd5b7a6da706e28fe9f2d00bd7803e2
parentbd1d2c21d5d2496f01b2d1fce07ec2e0da05dd3e
xfs: add large atomic writes checks in xfs_direct_write_iomap_begin()

For when large atomic writes (> 1x FS block) are supported, there will be
various occasions when HW offload may not be possible.

Such instances include:
- unaligned extent mapping wrt write length
- extent mappings which do not cover the full write, e.g. the write spans
  sparse or mixed-mapping extents
- the write length is greater than HW offload can support
- no hardware support at all

In those cases, we need to fallback to the CoW-based atomic write mode. For
this, report special code -ENOPROTOOPT to inform the caller that HW
offload-based method is not possible.

In addition to the occasions mentioned, if the write covers an unallocated
range, we again judge that we need to rely on the CoW-based method when we
would need to allocate anything more than 1x block. This is because if we
allocate less blocks that is required for the write, then again HW
offload-based method would not be possible. So we are taking a pessimistic
approach to writes covering unallocated space.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
[djwong: various cleanups]
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.g.garry@oracle.com>
fs/xfs/xfs_iomap.c