From: "Darrick J. Wong" <djwong@kernel.org>
To: John Garry <john.g.garry@oracle.com>
Cc: aalbersh@kernel.org, catherine.hoang@oracle.com,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/7] mkfs: allow users to configure the desired maximum atomic write size
Date: Wed, 2 Jul 2025 12:01:29 -0700 [thread overview]
Message-ID: <20250702190129.GA10009@frogsfrogsfrogs> (raw)
In-Reply-To: <b131893c-9952-4f23-8332-2191c3d1198c@oracle.com>
On Wed, Jul 02, 2025 at 09:50:04AM +0100, John Garry wrote:
> On 01/07/2025 19:08, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Allow callers of mkfs.xfs to specify a desired maximum atomic write
> > size. This value will cause the log size to be adjusted to support
> > software atomic writes, and the AG size to be aligned to support
> > hardware atomic writes.
> >
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
>
> thanks, regardless of comments below, FWIW:
>
> Reviewed-by: John Garry <john.g.garry@oracle.com>
>
> > goto validate;
> > @@ -4971,6 +4998,140 @@ calc_concurrency_logblocks(
> > return logblocks;
> > }
> > +#define MAX_RW_COUNT (INT_MAX & ~(getpagesize() - 1))
> > +
> > +/* Maximum atomic write IO size that the kernel allows. */
>
> FWIW, statx atomic write unit max is a 32b value, so we get a 2GB limit just
> from that factor
<nod> But we might as well mirror the kernel's calculations...
> > +static inline xfs_extlen_t calc_atomic_write_max(struct mkfs_params *cfg)
> > +{
> > + return rounddown_pow_of_two(MAX_RW_COUNT >> cfg->blocklog);
> > +}
> > +
> > +static inline unsigned int max_pow_of_two_factor(const unsigned int nr)
> > +{
> > + return 1 << (ffs(nr) - 1);
> > +}
> > +
> > +/*
> > + * If the data device advertises atomic write support, limit the size of data
> > + * device atomic writes to the greatest power-of-two factor of the AG size so
> > + * that every atomic write unit aligns with the start of every AG. This is
> > + * required so that the per-AG allocations for an atomic write will always be
> > + * aligned compatibly with the alignment requirements of the storage.
> > + *
> > + * If the data device doesn't advertise atomic writes, then there are no
> > + * alignment restrictions and the largest out-of-place write we can do
> > + * ourselves is the number of blocks that user files can allocate from any AG.
> > + */
> > +static inline xfs_extlen_t
> > +calc_perag_awu_max(
> > + struct mkfs_params *cfg,
> > + struct fs_topology *ft)
> > +{
> > + if (ft->data.awu_min > 0)
> > + return max_pow_of_two_factor(cfg->agsize);
> > + return cfg->agsize;
>
> out of curiosity, for out-of-place atomic writes, is there anything to stop
> the blocks being allocated across multiple AGs?
Nope. But they'll at least get the software fallback, same as if they
were writing to a severely fragmented filesystem.
--D
--D
next prev parent reply other threads:[~2025-07-02 19:01 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-01 18:03 [PATCHBOMB] xfsprogs: ports and new code for 6.16 Darrick J. Wong
2025-07-01 18:04 ` [PATCHSET 1/3] xfsprogs: new libxfs code from kernel 6.16 Darrick J. Wong
2025-07-01 18:05 ` [PATCH 1/6] xfs: add helpers to compute transaction reservation for finishing intent items Darrick J. Wong
2025-07-01 18:05 ` [PATCH 2/6] xfs: allow block allocator to take an alignment hint Darrick J. Wong
2025-07-01 18:06 ` [PATCH 3/6] xfs: commit CoW-based atomic writes atomically Darrick J. Wong
2025-07-01 18:06 ` [PATCH 4/6] libxfs: add helpers to compute log item overhead Darrick J. Wong
2025-07-01 18:06 ` [PATCH 5/6] xfs: add xfs_calc_atomic_write_unit_max() Darrick J. Wong
2025-07-01 18:06 ` [PATCH 6/6] xfs: allow sysadmins to specify a maximum atomic write limit at mount time Darrick J. Wong
2025-07-01 18:05 ` [PATCHSET 2/3] xfsprogs: atomic writes Darrick J. Wong
2025-07-01 18:07 ` [PATCH 1/7] libfrog: move statx.h from io/ to libfrog/ Darrick J. Wong
2025-07-02 9:13 ` John Garry
2025-07-01 18:07 ` [PATCH 2/7] xfs_db: create an untorn_max subcommand Darrick J. Wong
2025-07-09 15:39 ` John Garry
2025-07-09 16:35 ` Darrick J. Wong
2025-07-01 18:07 ` [PATCH 3/7] xfs_io: dump new atomic_write_unit_max_opt statx field Darrick J. Wong
2025-07-02 8:23 ` John Garry
2025-07-01 18:07 ` [PATCH 4/7] mkfs: don't complain about overly large auto-detected log stripe units Darrick J. Wong
2025-07-08 14:38 ` John Garry
2025-07-08 15:05 ` Darrick J. Wong
2025-07-08 15:07 ` John Garry
2025-07-01 18:08 ` [PATCH 5/7] mkfs: autodetect log stripe unit for external log devices Darrick J. Wong
2025-07-09 15:57 ` John Garry
2025-07-09 16:45 ` Darrick J. Wong
2025-07-01 18:08 ` [PATCH 6/7] mkfs: try to align AG size based on atomic write capabilities Darrick J. Wong
2025-07-02 9:03 ` John Garry
2025-07-02 19:00 ` Darrick J. Wong
2025-07-01 18:08 ` [PATCH 7/7] mkfs: allow users to configure the desired maximum atomic write size Darrick J. Wong
2025-07-02 8:50 ` John Garry
2025-07-02 19:01 ` Darrick J. Wong [this message]
2025-07-01 18:05 ` [PATCHSET 3/3] xfs_scrub: drop EXPERIMENTAL warning Darrick J. Wong
2025-07-01 18:09 ` [PATCH 1/1] xfs_scrub: remove EXPERIMENTAL warnings Darrick J. Wong
2025-07-03 13:45 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2025-07-15 5:16 [PATCHSET 2/3] xfsprogs: atomic writes Darrick J. Wong
2025-07-15 5:19 ` [PATCH 7/7] mkfs: allow users to configure the desired maximum atomic write size Darrick J. Wong
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=20250702190129.GA10009@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@kernel.org \
--cc=catherine.hoang@oracle.com \
--cc=john.g.garry@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).