aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-10-30 01:55:23 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 01:55:23 -0400
commitce5e42db421a41b1ad0cfd68c6058566b963e14b (patch)
tree7723f47e468c6b933a89361462c04436fe617cda /fs/xfs/xfs_btree.c
parent8c4ed633e65d0bd0a25d45aad9b4646e3236cad7 (diff)
[XFS] add get_maxrecs btree operation
Factor xfs_btree_maxrecs into a per-btree operation. The get_maxrecs method is based on a patch from Dave Chinner. SGI-PV: 985583 SGI-Modid: xfs-linux-melb:xfs-kern:32188a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Bill O'Donnell <billodo@sgi.com> Signed-off-by: David Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_btree.c')
-rw-r--r--fs/xfs/xfs_btree.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index 966d58d50fad..893e86f2ad57 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -51,31 +51,6 @@ const __uint32_t xfs_magics[XFS_BTNUM_MAX] = {
51}; 51};
52 52
53/* 53/*
54 * Checking routine: return maxrecs for the block.
55 */
56STATIC int /* number of records fitting in block */
57xfs_btree_maxrecs(
58 xfs_btree_cur_t *cur, /* btree cursor */
59 xfs_btree_block_t *block) /* generic btree block pointer */
60{
61 switch (cur->bc_btnum) {
62 case XFS_BTNUM_BNO:
63 case XFS_BTNUM_CNT:
64 return (int)XFS_ALLOC_BLOCK_MAXRECS(
65 be16_to_cpu(block->bb_level), cur);
66 case XFS_BTNUM_BMAP:
67 return (int)XFS_BMAP_BLOCK_IMAXRECS(
68 be16_to_cpu(block->bb_level), cur);
69 case XFS_BTNUM_INO:
70 return (int)XFS_INOBT_BLOCK_MAXRECS(
71 be16_to_cpu(block->bb_level), cur);
72 default:
73 ASSERT(0);
74 return 0;
75 }
76}
77
78/*
79 * External routines. 54 * External routines.
80 */ 55 */
81 56
@@ -207,7 +182,7 @@ xfs_btree_check_lblock(
207 be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] && 182 be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] &&
208 be16_to_cpu(block->bb_level) == level && 183 be16_to_cpu(block->bb_level) == level &&
209 be16_to_cpu(block->bb_numrecs) <= 184 be16_to_cpu(block->bb_numrecs) <=
210 xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) && 185 cur->bc_ops->get_maxrecs(cur, level) &&
211 block->bb_leftsib && 186 block->bb_leftsib &&
212 (be64_to_cpu(block->bb_leftsib) == NULLDFSBNO || 187 (be64_to_cpu(block->bb_leftsib) == NULLDFSBNO ||
213 XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_leftsib))) && 188 XFS_FSB_SANITY_CHECK(mp, be64_to_cpu(block->bb_leftsib))) &&
@@ -245,7 +220,7 @@ xfs_btree_check_sblock(
245 be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] && 220 be32_to_cpu(block->bb_magic) == xfs_magics[cur->bc_btnum] &&
246 be16_to_cpu(block->bb_level) == level && 221 be16_to_cpu(block->bb_level) == level &&
247 be16_to_cpu(block->bb_numrecs) <= 222 be16_to_cpu(block->bb_numrecs) <=
248 xfs_btree_maxrecs(cur, (xfs_btree_block_t *)block) && 223 cur->bc_ops->get_maxrecs(cur, level) &&
249 (be32_to_cpu(block->bb_leftsib) == NULLAGBLOCK || 224 (be32_to_cpu(block->bb_leftsib) == NULLAGBLOCK ||
250 be32_to_cpu(block->bb_leftsib) < agflen) && 225 be32_to_cpu(block->bb_leftsib) < agflen) &&
251 block->bb_leftsib && 226 block->bb_leftsib &&