]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: make metabtree reservations global
authorChristoph Hellwig <hch@lst.de>
Mon, 14 Apr 2025 05:35:46 +0000 (07:35 +0200)
committerAndrey Albershteyn <aalbersh@kernel.org>
Tue, 29 Apr 2025 16:09:57 +0000 (18:09 +0200)
commit7e427bb1b73433d49e62d81161b70e8b703e0b4d
tree1c145edd2e6c641170f6569e89ecdc7578eb6d3e
parent91643efd0e4c6ab2028a014fac2294d65975305c
xfs: make metabtree reservations global

Source kernel commit: 1df8d75030b787a9fae270b59b93eef809dd2011

Currently each metabtree inode has it's own space reservation to ensure
it can be expanded to the maximum size, mirroring what is done for the
AG-based btrees.  But unlike the AG-based btrees the metabtree inodes
aren't restricted to allocate from a single AG but can use free space
form the entire file system.  And unlike AG-based btrees where the
required reservation shrinks with the available free space due to this,
the metabtree reservations for the rtrmap and rtfreflink trees are not
bound in any way by the data device free space as they track RT extent
allocations.  This is not very efficient as it requires a large number
of blocks to be set aside that can't be used at all by other btrees.

Switch to a model that uses a global pool instead in preparation for
reducing the amount of reserved space, which now also removes the
overloading of the i_nblocks field for metabtree inodes, which would
create problems if metabtree inodes ever had a big enough xattr fork
to require xattr blocks outside the inode.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
include/spinlock.h
include/xfs_mount.h
libxfs/libxfs_priv.h
libxfs/xfs_metafile.c
libxfs/xfs_metafile.h
mkfs/xfs_mkfs.c