aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_ialloc_btree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_ialloc_btree.c')
-rw-r--r--fs/xfs/xfs_ialloc_btree.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/xfs_ialloc_btree.c b/fs/xfs/xfs_ialloc_btree.c
index dcd4a956e73c..46aabb3fcbf3 100644
--- a/fs/xfs/xfs_ialloc_btree.c
+++ b/fs/xfs/xfs_ialloc_btree.c
@@ -365,3 +365,19 @@ xfs_inobt_init_cursor(
365 365
366 return cur; 366 return cur;
367} 367}
368
369/*
370 * Calculate number of records in an inobt btree block.
371 */
372int
373xfs_inobt_maxrecs(
374 struct xfs_mount *mp,
375 int blocklen,
376 int leaf)
377{
378 blocklen -= sizeof(struct xfs_btree_sblock);
379
380 if (leaf)
381 return blocklen / sizeof(xfs_inobt_rec_t);
382 return blocklen / (sizeof(xfs_inobt_key_t) + sizeof(xfs_inobt_ptr_t));
383}