]> Pileus Git - ~andy/linux/blobdiff - fs/xfs/xfs_trans_buf.c
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[~andy/linux] / fs / xfs / xfs_trans_buf.c
index 63d81a22f4fd60c6d6abc93538c37e6480c8fd3b..3bea66132334c91e83278a5c581fae7d399e1490 100644 (file)
 #include "xfs_trans.h"
 #include "xfs_sb.h"
 #include "xfs_ag.h"
-#include "xfs_dir2.h"
-#include "xfs_dmapi.h"
 #include "xfs_mount.h"
 #include "xfs_bmap_btree.h"
 #include "xfs_alloc_btree.h"
 #include "xfs_ialloc_btree.h"
-#include "xfs_dir2_sf.h"
-#include "xfs_attr_sf.h"
 #include "xfs_dinode.h"
 #include "xfs_inode.h"
 #include "xfs_buf_item.h"
@@ -51,36 +47,17 @@ xfs_trans_buf_item_match(
        xfs_daddr_t             blkno,
        int                     len)
 {
-       xfs_log_item_chunk_t    *licp;
-       xfs_log_item_desc_t     *lidp;
-       xfs_buf_log_item_t      *blip;
-       int                     i;
+       struct xfs_log_item_desc *lidp;
+       struct xfs_buf_log_item *blip;
 
        len = BBTOB(len);
-       for (licp = &tp->t_items; licp != NULL; licp = licp->lic_next) {
-               if (xfs_lic_are_all_free(licp)) {
-                       ASSERT(licp == &tp->t_items);
-                       ASSERT(licp->lic_next == NULL);
-                       return NULL;
-               }
-
-               for (i = 0; i < licp->lic_unused; i++) {
-                       /*
-                        * Skip unoccupied slots.
-                        */
-                       if (xfs_lic_isfree(licp, i))
-                               continue;
-
-                       lidp = xfs_lic_slot(licp, i);
-                       blip = (xfs_buf_log_item_t *)lidp->lid_item;
-                       if (blip->bli_item.li_type != XFS_LI_BUF)
-                               continue;
-
-                       if (XFS_BUF_TARGET(blip->bli_buf) == target &&
-                           XFS_BUF_ADDR(blip->bli_buf) == blkno &&
-                           XFS_BUF_COUNT(blip->bli_buf) == len)
-                               return blip->bli_buf;
-               }
+       list_for_each_entry(lidp, &tp->t_items, lid_trans) {
+               blip = (struct xfs_buf_log_item *)lidp->lid_item;
+               if (blip->bli_item.li_type == XFS_LI_BUF &&
+                   XFS_BUF_TARGET(blip->bli_buf) == target &&
+                   XFS_BUF_ADDR(blip->bli_buf) == blkno &&
+                   XFS_BUF_COUNT(blip->bli_buf) == len)
+                       return blip->bli_buf;
        }
 
        return NULL;
@@ -127,7 +104,7 @@ _xfs_trans_bjoin(
        /*
         * Get a log_item_desc to point at the new item.
         */
-       (void) xfs_trans_add_item(tp, (xfs_log_item_t *)bip);
+       xfs_trans_add_item(tp, &bip->bli_item);
 
        /*
         * Initialize b_fsprivate2 so we can find it with incore_match()
@@ -328,7 +305,7 @@ xfs_trans_read_buf(
                        if (xfs_error_target == target) {
                                if (((xfs_req_num++) % xfs_error_mod) == 0) {
                                        xfs_buf_relse(bp);
-                                       cmn_err(CE_DEBUG, "Returning error!\n");
+                                       xfs_debug(mp, "Returning error!");
                                        return XFS_ERROR(EIO);
                                }
                        }
@@ -359,7 +336,7 @@ xfs_trans_read_buf(
                        ASSERT(!XFS_BUF_ISASYNC(bp));
                        XFS_BUF_READ(bp);
                        xfsbdstrat(tp->t_mountp, bp);
-                       error = xfs_iowait(bp);
+                       error = xfs_buf_iowait(bp);
                        if (error) {
                                xfs_ioerror_alert("xfs_trans_read_buf", mp,
                                                  bp, blkno);
@@ -426,7 +403,7 @@ xfs_trans_read_buf(
                                xfs_force_shutdown(tp->t_mountp,
                                                   SHUTDOWN_META_IO_ERROR);
                                xfs_buf_relse(bp);
-                               cmn_err(CE_DEBUG, "Returning trans error!\n");
+                               xfs_debug(mp, "Returning trans error!");
                                return XFS_ERROR(EIO);
                        }
                }
@@ -450,7 +427,7 @@ shutdown_abort:
         */
 #if defined(DEBUG)
        if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp))
-               cmn_err(CE_NOTE, "about to pop assert, bp == 0x%p", bp);
+               xfs_notice(mp, "about to pop assert, bp == 0x%p", bp);
 #endif
        ASSERT((XFS_BUF_BFLAGS(bp) & (XBF_STALE|XBF_DELWRI)) !=
                                     (XBF_STALE|XBF_DELWRI));
@@ -483,7 +460,6 @@ xfs_trans_brelse(xfs_trans_t        *tp,
 {
        xfs_buf_log_item_t      *bip;
        xfs_log_item_t          *lip;
-       xfs_log_item_desc_t     *lidp;
 
        /*
         * Default to a normal brelse() call if the tp is NULL.
@@ -514,13 +490,6 @@ xfs_trans_brelse(xfs_trans_t       *tp,
        ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL));
        ASSERT(atomic_read(&bip->bli_refcount) > 0);
 
-       /*
-        * Find the item descriptor pointing to this buffer's
-        * log item.  It must be there.
-        */
-       lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)bip);
-       ASSERT(lidp != NULL);
-
        trace_xfs_trans_brelse(bip);
 
        /*
@@ -536,7 +505,7 @@ xfs_trans_brelse(xfs_trans_t        *tp,
         * If the buffer is dirty within this transaction, we can't
         * release it until we commit.
         */
-       if (lidp->lid_flags & XFS_LID_DIRTY)
+       if (bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY)
                return;
 
        /*
@@ -553,7 +522,7 @@ xfs_trans_brelse(xfs_trans_t        *tp,
        /*
         * Free up the log item descriptor tracking the released item.
         */
-       xfs_trans_free_item(tp, lidp);
+       xfs_trans_del_item(&bip->bli_item);
 
        /*
         * Clear the hold flag in the buf log item if it is set.
@@ -665,7 +634,6 @@ xfs_trans_log_buf(xfs_trans_t       *tp,
                  uint          last)
 {
        xfs_buf_log_item_t      *bip;
-       xfs_log_item_desc_t     *lidp;
 
        ASSERT(XFS_BUF_ISBUSY(bp));
        ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp);
@@ -690,7 +658,7 @@ xfs_trans_log_buf(xfs_trans_t       *tp,
        bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
        ASSERT(atomic_read(&bip->bli_refcount) > 0);
        XFS_BUF_SET_IODONE_FUNC(bp, xfs_buf_iodone_callbacks);
-       bip->bli_item.li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*))xfs_buf_iodone;
+       bip->bli_item.li_cb = xfs_buf_iodone;
 
        trace_xfs_trans_log_buf(bip);
 
@@ -707,11 +675,8 @@ xfs_trans_log_buf(xfs_trans_t      *tp,
                bip->bli_format.blf_flags &= ~XFS_BLF_CANCEL;
        }
 
-       lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)bip);
-       ASSERT(lidp != NULL);
-
        tp->t_flags |= XFS_TRANS_DIRTY;
-       lidp->lid_flags |= XFS_LID_DIRTY;
+       bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY;
        bip->bli_flags |= XFS_BLI_LOGGED;
        xfs_buf_item_log(bip, first, last);
 }
@@ -740,7 +705,6 @@ xfs_trans_binval(
        xfs_trans_t     *tp,
        xfs_buf_t       *bp)
 {
-       xfs_log_item_desc_t     *lidp;
        xfs_buf_log_item_t      *bip;
 
        ASSERT(XFS_BUF_ISBUSY(bp));
@@ -748,8 +712,6 @@ xfs_trans_binval(
        ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
 
        bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
-       lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)bip);
-       ASSERT(lidp != NULL);
        ASSERT(atomic_read(&bip->bli_refcount) > 0);
 
        trace_xfs_trans_binval(bip);
@@ -764,7 +726,7 @@ xfs_trans_binval(
                ASSERT(!(bip->bli_flags & (XFS_BLI_LOGGED | XFS_BLI_DIRTY)));
                ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_INODE_BUF));
                ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL);
-               ASSERT(lidp->lid_flags & XFS_LID_DIRTY);
+               ASSERT(bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY);
                ASSERT(tp->t_flags & XFS_TRANS_DIRTY);
                return;
        }
@@ -797,7 +759,7 @@ xfs_trans_binval(
        bip->bli_format.blf_flags |= XFS_BLF_CANCEL;
        memset((char *)(bip->bli_format.blf_data_map), 0,
              (bip->bli_format.blf_map_size * sizeof(uint)));
-       lidp->lid_flags |= XFS_LID_DIRTY;
+       bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY;
        tp->t_flags |= XFS_TRANS_DIRTY;
 }
 
@@ -853,12 +815,9 @@ xfs_trans_stale_inode_buf(
        ASSERT(atomic_read(&bip->bli_refcount) > 0);
 
        bip->bli_flags |= XFS_BLI_STALE_INODE;
-       bip->bli_item.li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*))
-               xfs_buf_iodone;
+       bip->bli_item.li_cb = xfs_buf_iodone;
 }
 
-
-
 /*
  * Mark the buffer as being one which contains newly allocated
  * inodes.  We need to make sure that even if this buffer is