aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-10-30 01:54:43 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 01:54:43 -0400
commitb524bfeee2152fa64b6210f28ced80489b9d2439 (patch)
tree226355f2fc34b50975c9c756a211446901dbecbe /fs/xfs/xfs_bmap_btree.c
parente99ab90d6a9e8ac92f05d2c31d44aa7feee15394 (diff)
[XFS] refactor xfs_btree_readahead
From: Dave Chinner <dgc@sgi.com> Refactor xfs_btree_readahead to make it more readable: (a) remove the inline xfs_btree_readahead wrapper and move all checks out of line into the main routine. (b) factor out helpers for short/long form btrees (c) move check for root in inodes from the callers into xfs_btree_readahead [hch: split out from a big patch and minor cleanups] SGI-PV: 985583 SGI-Modid: xfs-linux-melb:xfs-kern:32182a 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_bmap_btree.c')
-rw-r--r--fs/xfs/xfs_bmap_btree.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index 1ec494e111b5..519249e20536 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -1721,8 +1721,9 @@ xfs_bmbt_decrement(
1721 XFS_BMBT_TRACE_CURSOR(cur, ENTRY); 1721 XFS_BMBT_TRACE_CURSOR(cur, ENTRY);
1722 XFS_BMBT_TRACE_ARGI(cur, level); 1722 XFS_BMBT_TRACE_ARGI(cur, level);
1723 ASSERT(level < cur->bc_nlevels); 1723 ASSERT(level < cur->bc_nlevels);
1724 if (level < cur->bc_nlevels - 1) 1724
1725 xfs_btree_readahead(cur, level, XFS_BTCUR_LEFTRA); 1725 xfs_btree_readahead(cur, level, XFS_BTCUR_LEFTRA);
1726
1726 if (--cur->bc_ptrs[level] > 0) { 1727 if (--cur->bc_ptrs[level] > 0) {
1727 XFS_BMBT_TRACE_CURSOR(cur, EXIT); 1728 XFS_BMBT_TRACE_CURSOR(cur, EXIT);
1728 *stat = 1; 1729 *stat = 1;
@@ -1743,8 +1744,7 @@ xfs_bmbt_decrement(
1743 for (lev = level + 1; lev < cur->bc_nlevels; lev++) { 1744 for (lev = level + 1; lev < cur->bc_nlevels; lev++) {
1744 if (--cur->bc_ptrs[lev] > 0) 1745 if (--cur->bc_ptrs[lev] > 0)
1745 break; 1746 break;
1746 if (lev < cur->bc_nlevels - 1) 1747 xfs_btree_readahead(cur, lev, XFS_BTCUR_LEFTRA);
1747 xfs_btree_readahead(cur, lev, XFS_BTCUR_LEFTRA);
1748 } 1748 }
1749 if (lev == cur->bc_nlevels) { 1749 if (lev == cur->bc_nlevels) {
1750 XFS_BMBT_TRACE_CURSOR(cur, EXIT); 1750 XFS_BMBT_TRACE_CURSOR(cur, EXIT);
@@ -1995,8 +1995,8 @@ xfs_bmbt_increment(
1995 XFS_BMBT_TRACE_CURSOR(cur, ENTRY); 1995 XFS_BMBT_TRACE_CURSOR(cur, ENTRY);
1996 XFS_BMBT_TRACE_ARGI(cur, level); 1996 XFS_BMBT_TRACE_ARGI(cur, level);
1997 ASSERT(level < cur->bc_nlevels); 1997 ASSERT(level < cur->bc_nlevels);
1998 if (level < cur->bc_nlevels - 1) 1998
1999 xfs_btree_readahead(cur, level, XFS_BTCUR_RIGHTRA); 1999 xfs_btree_readahead(cur, level, XFS_BTCUR_RIGHTRA);
2000 block = xfs_bmbt_get_block(cur, level, &bp); 2000 block = xfs_bmbt_get_block(cur, level, &bp);
2001#ifdef DEBUG 2001#ifdef DEBUG
2002 if ((error = xfs_btree_check_lblock(cur, block, level, bp))) { 2002 if ((error = xfs_btree_check_lblock(cur, block, level, bp))) {
@@ -2024,8 +2024,7 @@ xfs_bmbt_increment(
2024#endif 2024#endif
2025 if (++cur->bc_ptrs[lev] <= be16_to_cpu(block->bb_numrecs)) 2025 if (++cur->bc_ptrs[lev] <= be16_to_cpu(block->bb_numrecs))
2026 break; 2026 break;
2027 if (lev < cur->bc_nlevels - 1) 2027 xfs_btree_readahead(cur, lev, XFS_BTCUR_RIGHTRA);
2028 xfs_btree_readahead(cur, lev, XFS_BTCUR_RIGHTRA);
2029 } 2028 }
2030 if (lev == cur->bc_nlevels) { 2029 if (lev == cur->bc_nlevels) {
2031 XFS_BMBT_TRACE_CURSOR(cur, EXIT); 2030 XFS_BMBT_TRACE_CURSOR(cur, EXIT);