On Tue, Oct 12, 2021 at 04:33:23PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > 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@xxxxxxxxxx> > --- > 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: > 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 <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx