]> Pileus Git - ~andy/linux/blobdiff - fs/xfs/xfs_alloc_btree.c
[XFS] Cleanup maxrecs calculation.
[~andy/linux] / fs / xfs / xfs_alloc_btree.c
index 9e63f8c180d9f78652d6694fb8d1b1ea0a6be510..6ff27b75b93f8064d4b5b3e3f45625d6db9a3d43 100644 (file)
@@ -480,3 +480,19 @@ xfs_allocbt_init_cursor(
 
        return cur;
 }
+
+/*
+ * Calculate number of records in an alloc btree block.
+ */
+int
+xfs_allocbt_maxrecs(
+       struct xfs_mount        *mp,
+       int                     blocklen,
+       int                     leaf)
+{
+       blocklen -= sizeof(struct xfs_btree_sblock);
+
+       if (leaf)
+               return blocklen / sizeof(xfs_alloc_rec_t);
+       return blocklen / (sizeof(xfs_alloc_key_t) + sizeof(xfs_alloc_ptr_t));
+}