summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_metafile.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2025-02-09 05:43:50 +0100
committerChristoph Hellwig <hch@lst.de>2025-03-03 08:16:37 -0700
commit712bae96631852c1a1822ee4f57a08ccd843358b (patch)
tree633ae9b57de8b64bd8dafa5f899c4108e4b9f95b /fs/xfs/libxfs/xfs_metafile.c
parentcc3d2f55c43affde7195867afb7b0ee45dd8019b (diff)
xfs: generalize the freespace and reserved blocks handling
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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_metafile.c')
-rw-r--r--fs/xfs/libxfs/xfs_metafile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_metafile.c b/fs/xfs/libxfs/xfs_metafile.c
index 2f5f554a36d4..7625e694eb8d 100644
--- a/fs/xfs/libxfs/xfs_metafile.c
+++ b/fs/xfs/libxfs/xfs_metafile.c
@@ -95,7 +95,7 @@ xfs_metafile_resv_can_cover(
* There aren't enough blocks left in the inode's reservation, but it
* isn't critical unless there also isn't enough free space.
*/
- return __percpu_counter_compare(&ip->i_mount->m_fdblocks,
+ return xfs_compare_freecounter(ip->i_mount, XC_FREE_BLOCKS,
rhs - ip->i_delayed_blks, 2048) >= 0;
}