From: Daejun Park <daejun7.park@samsung.com>
To: John Garry <john.garry@linux.dev>,
Carlos Maiolino <cem@kernel.org>,
"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>
Cc: Pankaj Raghav Partha Sarathy <p.raghav@samsung.com>,
Pankaj Raghav <pankaj.raghav@linux.dev>,
"Darrick J. Wong" <djwong@kernel.org>,
Christoph Hellwig <hch@lst.de>,
Dave Chinner <david@fromorbit.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Daejun Park <daejun7.park@samsung.com>
Subject: RE:(2) (2) [PATCH v2] xfs: check the disk address for hardware atomic writes
Date: Mon, 16 Nov 2026 16:39:03 +0900 [thread overview]
Message-ID: <20261116073903epcms2p13ca5bac24c591ae487f0b30dc45b87f8@epcms2p1> (raw)
In-Reply-To: <b34aac03-0d43-4ed1-9561-cb6e0e9c582f@linux.dev>
On Fri, Nov 13, 2026 at 09:45:22AM +0000, John Garry wrote:
> hmm.. I am still not confident that this the best fix. And if it is,
> then I think that we should still change the size pre-check in
> xfs_file_dio_write_atomic(). Here's a combined change which I am
> thinking of:
[...]
> bt_awu_max is the HW max, and you are saying that it is not aligned with
> the AG size (and so need a disk alignment check). However, opt max
> should be (aligned to AG size), so we could check that vs size instead.
Thanks, agreed. v3 will check the size instead of the disk address,
in both xfs_file_dio_write_atomic() and
xfs_bmap_hw_atomic_write_possible(). The limit is the one max_opt
applies: the smaller of bt_awu_max and the largest power-of-two factor
of the group size. Below that limit the existing br_startblock check is
enough, so v3 drops the disk address check.
v3 puts this limit in a helper that xfs_get_atomic_write_max_opt() also
uses, so max_opt and the checks use the same hardware limit. The checks
call the helper rather than max_opt, since max_opt is 0 on a filesystem
without reflink. When I tried max_opt there, the one-block atomic
writes went to COW and failed with -EINVAL. The helper returns
bt_awu_max when there are no groups, which is the rt device without
rtgroups.
> BTW, with your proposed change, since HW size is not aligned to AG size
> and we only check the size vs HW size for HW offload, it is in theory
> possible to have an atomic write which straddles the AG and is rejected,
> right?
Userspace does not see a rejection. Such a write maps to two extents,
so xfs_bmap_hw_atomic_write_possible() returns false and the write goes
through COW. This is the same in v2 and v3. In v3, a write sent to the
hardware is also aligned and no larger than the group alignment, so it
cannot cross a group boundary.
Best regards,
Daejun
next prev parent reply other threads:[~2026-11-16 7:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 0:41 Daejun Park via B4 Relay
2026-11-12 8:29 ` John Garry
2026-11-12 13:49 ` Christoph Hellwig
2026-11-12 21:38 ` Pankaj Raghav (Samsung)
[not found] ` <CGME20261112082952epcas2p1f902c4243d451635ff27fe1a1c5035fe@epcms2p5>
2026-11-13 2:55 ` Daejun Park
2026-11-13 9:45 ` (2) " John Garry
[not found] ` <CGME20261112082952epcas2p1f902c4243d451635ff27fe1a1c5035fe@epcms2p1>
2026-11-16 7:39 ` Daejun Park [this message]
2026-11-16 8:11 ` (2) " John Garry
[not found] ` <CGME20261112082952epcas2p1f902c4243d451635ff27fe1a1c5035fe@epcms2p7>
2026-11-16 9:54 ` Daejun Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261116073903epcms2p13ca5bac24c591ae487f0b30dc45b87f8@epcms2p1 \
--to=daejun7.park@samsung.com \
--cc=cem@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=john.garry@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=p.raghav@samsung.com \
--cc=pankaj.raghav@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®