Re: [PATCH 09/15] xfs: dynamically allocate cursors based on maxlevels
From: Dave Chinner <david@fromorbit.com>
Date: 2021-10-13 05:40:45
On Tue, Oct 12, 2021 at 04:33:23PM -0700, Darrick J. Wong wrote:
From: Darrick J. Wong <djwong@kernel.org> To support future btree code, we need to be able to size btree cursors dynamically for very large btrees. Switch the maxlevels computation to use the precomputed values in the superblock, and create cursors that can handle a certain height. For now, we retain the btree cursor zone that can handle up to 9-level btrees, and create larger cursors (which shouldn't happen currently) from the heap as a failsafe. Signed-off-by: Darrick J. Wong <djwong@kernel.org> --- fs/xfs/libxfs/xfs_alloc_btree.c | 2 +- fs/xfs/libxfs/xfs_bmap_btree.c | 3 ++- fs/xfs/libxfs/xfs_btree.h | 13 +++++++++++-- fs/xfs/libxfs/xfs_ialloc_btree.c | 3 ++- fs/xfs/libxfs/xfs_refcount_btree.c | 3 ++- fs/xfs/libxfs/xfs_rmap_btree.c | 3 ++- fs/xfs/xfs_super.c | 4 ++-- 7 files changed, 22 insertions(+), 9 deletions(-)
minor nit:
quoted hunk ↗ jump to hunk
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h index 43766e5b680f..b8761a2fc24b 100644 --- a/fs/xfs/libxfs/xfs_btree.h +++ b/fs/xfs/libxfs/xfs_btree.h@@ -94,6 +94,12 @@ uint32_t xfs_btree_magic(int crc, xfs_btnum_t btnum); #define XFS_BTREE_MAXLEVELS 9 /* max of all btrees */ +/* + * The btree cursor zone hands out cursors that can handle up to this many + * levels. This is the known maximum for all btree types. + */ +#define XFS_BTREE_CUR_ZONE_MAXLEVELS (9)
XFS_BTREE_CUR_CACHE_MAXLEVELS 9 Otherwise looks OK. Reviewed-by: Dave Chinner <redacted> -- Dave Chinner david@fromorbit.com