xfs: clean up xfs_bmap_get_bp

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
Christoph Hellwig 2010-07-22 12:52:08 +10:00 committed by Alex Elder
parent 5d18898b20
commit ecd7f082d6

View File

@ -5648,41 +5648,34 @@ xfs_bmap_eof(
} }
#ifdef DEBUG #ifdef DEBUG
STATIC STATIC struct xfs_buf *
xfs_buf_t *
xfs_bmap_get_bp( xfs_bmap_get_bp(
xfs_btree_cur_t *cur, struct xfs_btree_cur *cur,
xfs_fsblock_t bno) xfs_fsblock_t bno)
{ {
int i; struct xfs_log_item_desc *lidp;
xfs_buf_t *bp; int i;
if (!cur) if (!cur)
return(NULL); return NULL;
bp = NULL; for (i = 0; i < XFS_BTREE_MAXLEVELS; i++) {
for(i = 0; i < XFS_BTREE_MAXLEVELS; i++) { if (!cur->bc_bufs[i])
bp = cur->bc_bufs[i]; break;
if (!bp) break; if (XFS_BUF_ADDR(cur->bc_bufs[i]) == bno)
if (XFS_BUF_ADDR(bp) == bno) return cur->bc_bufs[i];
break; /* Found it */
} }
if (i == XFS_BTREE_MAXLEVELS)
bp = NULL;
if (!bp) { /* Chase down all the log items to see if the bp is there */ /* Chase down all the log items to see if the bp is there */
struct xfs_log_item_desc *lidp; list_for_each_entry(lidp, &cur->bc_tp->t_items, lid_trans) {
struct xfs_buf_log_item *bip; struct xfs_buf_log_item *bip;
bip = (struct xfs_buf_log_item *)lidp->lid_item;
list_for_each_entry(lidp, &cur->bc_tp->t_items, lid_trans) { if (bip->bli_item.li_type == XFS_LI_BUF &&
bip = (struct xfs_buf_log_item *)lidp->lid_item; XFS_BUF_ADDR(bip->bli_buf) == bno)
if (bip->bli_item.li_type == XFS_LI_BUF && return bip->bli_buf;
XFS_BUF_ADDR(bip->bli_buf) == bno)
return bip->bli_buf;
}
} }
return bp; return NULL;
} }
STATIC void STATIC void