xfs: use separate btree cursor cache for each btree type
Now that we have the infrastructure to track the max possible height of each btree type, we can create a separate slab cache for cursors of each type of btree. For smaller indices like the free space btrees, this means that we can pack more cursors into a slab page, improving slab utilization. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include "xfs_trace.h"
|
||||
#include "xfs_rmap.h"
|
||||
|
||||
static kmem_zone_t *xfs_bmbt_cur_cache;
|
||||
|
||||
/*
|
||||
* Convert on-disk form of btree root to in-memory form.
|
||||
*/
|
||||
@@ -553,7 +555,7 @@ xfs_bmbt_init_cursor(
|
||||
ASSERT(whichfork != XFS_COW_FORK);
|
||||
|
||||
cur = xfs_btree_alloc_cursor(mp, tp, XFS_BTNUM_BMAP,
|
||||
mp->m_bm_maxlevels[whichfork]);
|
||||
mp->m_bm_maxlevels[whichfork], xfs_bmbt_cur_cache);
|
||||
cur->bc_nlevels = be16_to_cpu(ifp->if_broot->bb_level) + 1;
|
||||
cur->bc_statoff = XFS_STATS_CALC_INDEX(xs_bmbt_2);
|
||||
|
||||
@@ -675,3 +677,22 @@ xfs_bmbt_calc_size(
|
||||
{
|
||||
return xfs_btree_calc_size(mp->m_bmap_dmnr, len);
|
||||
}
|
||||
|
||||
int __init
|
||||
xfs_bmbt_init_cur_cache(void)
|
||||
{
|
||||
xfs_bmbt_cur_cache = kmem_cache_create("xfs_bmbt_cur",
|
||||
xfs_btree_cur_sizeof(xfs_bmbt_maxlevels_ondisk()),
|
||||
0, 0, NULL);
|
||||
|
||||
if (!xfs_bmbt_cur_cache)
|
||||
return -ENOMEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
xfs_bmbt_destroy_cur_cache(void)
|
||||
{
|
||||
kmem_cache_destroy(xfs_bmbt_cur_cache);
|
||||
xfs_bmbt_cur_cache = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user