Re: [RFC PATCH] xfs: add a per-filesystem switch to force atomic CoW
From: John Garry
Date: Wed Nov 25 2026 - 04:18:23 EST
On 11/24/26 20:05, Dave Chinner wrote:
Isn't that a bit of an oversight? Lots of the hardware related IOOk, so you want it for your test/dev environment, not production?The block layer just accepts whatever atomic properties is reported by the
I thought we could already change the block device characteristics (i.e. support hw
atomic wirite or not) at the block device level?
block driver and there is no method in the block layer to change these
limits or turn them off.
capabilities are configurable in the bdev queue (e.g. max io sizes,
max discard/unmap sizes, max queue depth, etc).
Generally anything which affects atomic limits is fixed. As you mentioned, there is max io sizes, which can be configured from sysfs - however, for HW atomics we ignore max_sectors and just pay attention to max_hw_sectors.
For any normal IO, the block layer can slice and dice the IO any way it wants. HW atomics are not like this, and the IO must be submitted as a single bio/request. For any dynamically changing HW atomic limits, we would always have the TOCTOU challenge, i.e. bdev limits can change between checking atomic limits and submitting an atomic IO.
Sure, they are initially populated by the hardware values, but the
user can then override them (e.g. via udev rules) and that means we
don't have need to add 'override the <bdev queue property>'
management interfaces to every filesystem that supports those
specific bdev hardware offloads.
Then for the only block drivers which today support atomic - NVMe and SCSI -That seems to be inconsistent with how we manage other hardware
similarly these we just use the atomic limits reported in the disk.
offload size limits on block devices. These are -not- filesystem
properties, and we should not be trying to manage them at the
filesystem level.
As mentioned, HW atomic IO is special in this regard. Now for XFS we do read the limits once at mount time. We could read the limits dynamically instead, but it still has the TOCTOU problem, above.
Thanks,
John