RE: [RFC PATCH] xfs: add a per-filesystem switch to force atomic CoW

From: Wayne Gao

Date: Thu Nov 26 2026 - 09:20:59 EST


John

Actually this PR is not for dynamically change atomic limits, it is just only support XFS atomic request have one option to use the COW instead of HW atomic if the request size = HW atomic size. This is only for benchmark comparison.

-----Original Message-----
From: John Garry <john.garry@xxxxxxxxx>
Sent: Wednesday, November 25, 2026 5:18 PM
To: Dave Chinner <dgc@xxxxxxxxxx>
Cc: Wayne Gao <Wayne.Gao1@xxxxxxxxxxxx>; cem@xxxxxxxxxx; linux-xfs@xxxxxxxxxxxxxxx; linux-api@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
Subject: Re: [RFC PATCH] xfs: add a per-filesystem switch to force atomic CoW

[You don't often get email from john.garry@xxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

Caution: External Email


On 11/24/26 20:05, Dave Chinner wrote:
>>> Ok, so you want it for your test/dev environment, not production?
>>>
>>> I thought we could already change the block device characteristics
>>> (i.e. support hw atomic wirite or not) at the block device level?
>> The block layer just accepts whatever atomic properties is reported
>> by the block driver and there is no method in the block layer to
>> change these limits or turn them off.
> Isn't that a bit of an oversight? Lots of the hardware related IO
> 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 - similarly these we just use the atomic limits reported in the disk.
> That seems to be inconsistent with how we manage other hardware
> 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


CONFIDENTIALITY NOTICE: This email and any files attached may contain confidential information and may be restricted from disclosure by corporate confidentiality guidelines, or applicable state and federal law. It is intended solely for the use of the person or entity to whom the email was addressed. If you are not the intended recipient of this message, be advised that any dissemination, distribution, or use of the contents of this message is strictly prohibited. Please delete this email from your system if you are not the intended recipient.