aboutsummaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_bmap_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-10-30 16:54:43 +1100
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 16:54:43 +1100
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 1ec494e111b..519249e2053 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -1721,8 +1721,9 @@ xfs_bmbt_decrement(
XFS_BMBT_TRACE_CURSOR(cur, ENTRY);
XFS_BMBT_TRACE_ARGI(cur, level);
ASSERT(level < cur->bc_nlevels);
- if (level < cur->bc_nlevels - 1)
- xfs_btree_readahead(cur, level, XFS_BTCUR_LEFTRA);
+
+ xfs_btree_readahead(cur, level, XFS_BTCUR_LEFTRA);
+
if (--cur->bc_ptrs[level] > 0) {
XFS_BMBT_TRACE_CURSOR(cur, EXIT);
*stat = 1;
@@ -1743,8 +1744,7 @@ xfs_bmbt_decrement(
for (lev = level + 1; lev < cur->bc_nlevels; lev++) {
if (--cur->bc_ptrs[lev] > 0)
break;
- if (lev < cur->bc_nlevels - 1)
- xfs_btree_readahead(cur, lev, XFS_BTCUR_LEFTRA);
+ xfs_btree_readahead(cur, lev, XFS_BTCUR_LEFTRA);
}
if (lev == cur->bc_nlevels) {
XFS_BMBT_TRACE_CURSOR(cur, EXIT);
@@ -1995,8 +1995,8 @@ xfs_bmbt_increment(
XFS_BMBT_TRACE_CURSOR(cur, ENTRY);
XFS_BMBT_TRACE_ARGI(cur, level);
ASSERT(level < cur->bc_nlevels);
- if (level < cur->bc_nlevels - 1)
- xfs_btree_readahead(cur, level, XFS_BTCUR_RIGHTRA);
+
+ xfs_btree_readahead(cur, level, XFS_BTCUR_RIGHTRA);
block = xfs_bmbt_get_block(cur, level, &bp);
#ifdef DEBUG
if ((error = xfs_btree_check_lblock(cur, block, level, bp))) {
@@ -2024,8 +2024,7 @@ xfs_bmbt_increment(
#endif
if (++cur->bc_ptrs[lev] <= be16_to_cpu(block->bb_numrecs))
break;
- if (lev < cur->bc_nlevels - 1)
- xfs_btree_readahead(cur, lev, XFS_BTCUR_RIGHTRA);
+ xfs_btree_readahead(cur, lev, XFS_BTCUR_RIGHTRA);
}
if (lev == cur->bc_nlevels) {
XFS_BMBT_TRACE_CURSOR(cur, EXIT);