diff options
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r-- | fs/xfs/libxfs/xfs_btree.c | 12 | ||||
-rw-r--r-- | fs/xfs/libxfs/xfs_btree.h | 9 |
2 files changed, 7 insertions, 14 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c index 120280c998f8..3131de9ae631 100644 --- a/fs/xfs/libxfs/xfs_btree.c +++ b/fs/xfs/libxfs/xfs_btree.c @@ -26,7 +26,6 @@ /* * Cursor allocation zone. */ -kmem_zone_t *xfs_btree_cur_zone; struct xfs_btree_cur_zone xfs_btree_cur_zones[XFS_BTNUM_MAX] = { [XFS_BTNUM_BNO] = { .name = "xfs_alloc_btree_cur" }, [XFS_BTNUM_INO] = { .name = "xfs_ialloc_btree_cur" }, @@ -364,6 +363,7 @@ xfs_btree_del_cursor( struct xfs_btree_cur *cur, /* btree cursor */ int error) /* del because of error */ { + struct xfs_btree_cur_zone *bczone = &xfs_btree_cur_zones[cur->bc_btnum]; int i; /* btree level */ /* @@ -386,10 +386,10 @@ xfs_btree_del_cursor( kmem_free(cur->bc_ops); if (!(cur->bc_flags & XFS_BTREE_LONG_PTRS) && cur->bc_ag.pag) xfs_perag_put(cur->bc_ag.pag); - if (cur->bc_maxlevels > XFS_BTREE_CUR_ZONE_MAXLEVELS) + if (cur->bc_maxlevels > bczone->maxlevels) kmem_free(cur); else - kmem_cache_free(xfs_btree_cur_zone, cur); + kmem_cache_free(bczone->zone, cur); } /* @@ -5021,12 +5021,12 @@ xfs_btree_alloc_cursor( { struct xfs_btree_cur *cur; unsigned int maxlevels = xfs_btree_maxlevels(mp, btnum); + struct xfs_btree_cur_zone *bczone = &xfs_btree_cur_zones[btnum]; - if (maxlevels > XFS_BTREE_CUR_ZONE_MAXLEVELS) + if (maxlevels > bczone->maxlevels) cur = kmem_zalloc(xfs_btree_cur_sizeof(maxlevels), KM_NOFS); else - cur = kmem_cache_zalloc(xfs_btree_cur_zone, - GFP_NOFS | __GFP_NOFAIL); + cur = kmem_cache_zalloc(bczone->zone, GFP_NOFS | __GFP_NOFAIL); cur->bc_tp = tp; cur->bc_mp = mp; cur->bc_btnum = btnum; diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h index 5bebd26f8b2c..854235a8adac 100644 --- a/fs/xfs/libxfs/xfs_btree.h +++ b/fs/xfs/libxfs/xfs_btree.h @@ -13,8 +13,6 @@ struct xfs_trans; struct xfs_ifork; struct xfs_perag; -extern kmem_zone_t *xfs_btree_cur_zone; - /* * Generic key, ptr and record wrapper structures. * @@ -92,12 +90,6 @@ uint32_t xfs_btree_magic(int crc, xfs_btnum_t btnum); #define XFS_BTREE_STATS_ADD(cur, stat, val) \ XFS_STATS_ADD_OFF((cur)->bc_mp, (cur)->bc_statoff + __XBTS_ ## stat, val) -/* - * 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) - struct xfs_btree_ops { /* size of the key and record structures */ size_t key_len; @@ -588,6 +580,7 @@ void xfs_btree_absolute_minrecs(unsigned int *minrecs, unsigned int bc_flags, struct xfs_btree_cur_zone { const char *name; + kmem_zone_t *zone; unsigned int maxlevels; }; |