xfs: simplify log item descriptor tracking
[deliverable/linux.git] / fs / xfs / xfs_bmap.c
index ed4e3ae2c1d0ea518bbbd62d70545fe43d1bc932..ff8675b41973ab4e12ca6945536e44a3fffaaafb 100644 (file)
@@ -5857,43 +5857,18 @@ xfs_bmap_get_bp(
                bp = NULL;
 
        if (!bp) { /* Chase down all the log items to see if the bp is there */
-               xfs_log_item_chunk_t    *licp;
-               xfs_trans_t             *tp;
-
-               tp = cur->bc_tp;
-               licp = &tp->t_items;
-               while (!bp && licp != NULL) {
-                       if (xfs_lic_are_all_free(licp)) {
-                               licp = licp->lic_next;
-                               continue;
-                       }
-                       for (i = 0; i < licp->lic_unused; i++) {
-                               xfs_log_item_desc_t     *lidp;
-                               xfs_log_item_t          *lip;
-                               xfs_buf_log_item_t      *bip;
-                               xfs_buf_t               *lbp;
-
-                               if (xfs_lic_isfree(licp, i)) {
-                                       continue;
-                               }
-
-                               lidp = xfs_lic_slot(licp, i);
-                               lip = lidp->lid_item;
-                               if (lip->li_type != XFS_LI_BUF)
-                                       continue;
-
-                               bip = (xfs_buf_log_item_t *)lip;
-                               lbp = bip->bli_buf;
-
-                               if (XFS_BUF_ADDR(lbp) == bno) {
-                                       bp = lbp;
-                                       break; /* Found it */
-                               }
-                       }
-                       licp = licp->lic_next;
+               struct xfs_log_item_desc *lidp;
+               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;
                }
        }
-       return(bp);
+
+       return bp;
 }
 
 STATIC void
This page took 0.025568 seconds and 5 git commands to generate.