diff options
Diffstat (limited to 'fs/xfs/xfs_alloc_btree.c')
-rw-r--r-- | fs/xfs/xfs_alloc_btree.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c index 9e63f8c180d9..6ff27b75b93f 100644 --- a/fs/xfs/xfs_alloc_btree.c +++ b/fs/xfs/xfs_alloc_btree.c | |||
@@ -480,3 +480,19 @@ xfs_allocbt_init_cursor( | |||
480 | 480 | ||
481 | return cur; | 481 | return cur; |
482 | } | 482 | } |
483 | |||
484 | /* | ||
485 | * Calculate number of records in an alloc btree block. | ||
486 | */ | ||
487 | int | ||
488 | xfs_allocbt_maxrecs( | ||
489 | struct xfs_mount *mp, | ||
490 | int blocklen, | ||
491 | int leaf) | ||
492 | { | ||
493 | blocklen -= sizeof(struct xfs_btree_sblock); | ||
494 | |||
495 | if (leaf) | ||
496 | return blocklen / sizeof(xfs_alloc_rec_t); | ||
497 | return blocklen / (sizeof(xfs_alloc_key_t) + sizeof(xfs_alloc_ptr_t)); | ||
498 | } | ||