]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: generalize the freespace and reserved blocks handling
authorChristoph Hellwig <hch@lst.de>
Mon, 14 Apr 2025 05:35:44 +0000 (07:35 +0200)
committerAndrey Albershteyn <aalbersh@kernel.org>
Tue, 29 Apr 2025 16:09:57 +0000 (18:09 +0200)
commit91643efd0e4c6ab2028a014fac2294d65975305c
tree1e182350ce0b2ef8c54070c47e9a56e9abca1908
parent140fd5b163577bd99e07adcdea7e08a99bccbccd
xfs: generalize the freespace and reserved blocks handling

Source kernel commit: 712bae96631852c1a1822ee4f57a08ccd843358b

xfs_{add,dec}_freecounter already handles the block and RT extent
percpu counters, but it currently hardcodes the passed in counter.

Add a freecounter abstraction that uses an enum to designate the counter
and add wrappers that hide the actual percpu_counters.  This will allow
expanding the reserved block handling to the RT extent counter in the
next step, and also prepares for adding yet another such counter that
can share the code.  Both these additions will be needed for the zoned
allocator.

Also switch the flooring of the frextents counter to 0 in statfs for the
rthinherit case to a manual min_t call to match the handling of the
fdblocks counter for normal file systems.

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/xfs_mount.h
libxfs/libxfs_priv.h
libxfs/xfs_ialloc.c
libxfs/xfs_metafile.c
libxfs/xfs_sb.c
libxfs/xfs_types.h