xfs
[Top] [All Lists]

[PATCH 6/6] xfs: clean up xfs_bmap_get_bp

To: xfs@xxxxxxxxxxx
Subject: [PATCH 6/6] xfs: clean up xfs_bmap_get_bp
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Sun, 18 Jul 2010 16:38:54 -0400
References: <20100718203848.927859114@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.47-1
Signed-off-by: Christoph Hellwig <hch@xxxxxx>

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

<Prev in Thread] Current Thread [Next in Thread>