]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commit
xfs: add xfs_calc_atomic_write_unit_max()
authorJohn Garry <john.g.garry@oracle.com>
Tue, 1 Jul 2025 17:45:12 +0000 (10:45 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Fri, 18 Jul 2025 14:05:10 +0000 (16:05 +0200)
commit9ae045b77d88a027240f5df7212a28326ccc9d7a
treebfdd236b487078b43547744daea744232a9428a9
parent4c6a63fdb9d45fed16f16aa044ab47ec497ad03f
xfs: add xfs_calc_atomic_write_unit_max()

Source kernel commit: 0c438dcc31504bf4f50b20dc52f8f5ca7fab53e2

Now that CoW-based atomic writes are supported, update the max size of an
atomic write for the data device.

The limit of a CoW-based atomic write will be the limit of the number of
logitems which can fit into a single transaction.

In addition, the max atomic write size needs to be aligned to the agsize.
Limit the size of atomic writes to the greatest power-of-two factor of the
agsize so that allocations for an atomic write will always be aligned
compatibly with the alignment requirements of the storage.

Function xfs_atomic_write_logitems() is added to find the limit the number
of log items which can fit in a single transaction.

Amend the max atomic write computation to create a new transaction
reservation type, and compute the maximum size of an atomic write
completion (in fsblocks) based on this new transaction reservation.
Initially, tr_atomic_write is a clone of tr_itruncate, which provides a
reasonable level of parallelism.  In the next patch, we'll add a mount
option so that sysadmins can configure their own limits.

[djwong: use a new reservation type for atomic write ioends, refactor
group limit calculations]

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
[jpg: rounddown power-of-2 always]
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.g.garry@oracle.com>
include/xfs_trace.h
libxfs/xfs_trans_resv.c
libxfs/xfs_trans_resv.h