xfs: remove buffers from the delwri list in xfs_buf_stale
authorChristoph Hellwig <hch@infradead.org>
Mon, 10 Oct 2011 16:52:47 +0000 (16:52 +0000)
committerAlex Elder <aelder@sgi.com>
Wed, 12 Oct 2011 02:15:10 +0000 (21:15 -0500)
For each call to xfs_buf_stale we call xfs_buf_delwri_dequeue either
directly before or after it, or are guaranteed by the surrounding
conditionals that we are never called on delwri buffers.  Simply
this situation by moving the call to xfs_buf_delwri_dequeue into
xfs_buf_stale.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
fs/xfs/xfs_attr.c
fs/xfs/xfs_buf.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_rw.c
fs/xfs/xfs_trans_buf.c

index ae8f917490d476aa786bfff7e497cfe32f55026f..1e5d97f86ea819493b9acfd1584696fc7ce5d733 100644 (file)
@@ -2169,7 +2169,6 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
                bp = xfs_incore(mp->m_ddev_targp, dblkno, blkcnt, XBF_TRYLOCK);
                if (bp) {
                        xfs_buf_stale(bp);
-                       xfs_buf_delwri_dequeue(bp);
                        xfs_buf_relse(bp);
                        bp = NULL;
                }
index f88eab9e81445e0dfdb55c321513e05e608ae43a..3df7d0a2b245f2f5483529ce38d0503c628b74ea 100644 (file)
@@ -151,6 +151,7 @@ xfs_buf_stale(
        struct xfs_buf  *bp)
 {
        bp->b_flags |= XBF_STALE;
+       xfs_buf_delwri_dequeue(bp);
        atomic_set(&(bp)->b_lru_ref, 0);
        if (!list_empty(&bp->b_lru)) {
                struct xfs_buftarg *btp = bp->b_target;
@@ -1059,7 +1060,6 @@ xfs_bioerror(
         * We're calling xfs_buf_ioend, so delete XBF_DONE flag.
         */
        XFS_BUF_UNREAD(bp);
-       xfs_buf_delwri_dequeue(bp);
        XFS_BUF_UNDONE(bp);
        xfs_buf_stale(bp);
 
@@ -1088,7 +1088,6 @@ xfs_bioerror_relse(
         * change that interface.
         */
        XFS_BUF_UNREAD(bp);
-       xfs_buf_delwri_dequeue(bp);
        XFS_BUF_DONE(bp);
        xfs_buf_stale(bp);
        bp->b_iodone = NULL;
index 8213f4a753dc6ee38ee1ebbb7353d62091b173f3..06a76ca996597c64d32ec46e4ce7e3318abe6446 100644 (file)
@@ -967,7 +967,6 @@ xfs_buf_iodone_callbacks(
         */
        if (XFS_FORCED_SHUTDOWN(mp)) {
                xfs_buf_stale(bp);
-               xfs_buf_delwri_dequeue(bp);
                XFS_BUF_DONE(bp);
                trace_xfs_buf_item_iodone(bp, _RET_IP_);
                goto do_callbacks;
@@ -1009,7 +1008,6 @@ xfs_buf_iodone_callbacks(
         */
        xfs_buf_stale(bp);
        XFS_BUF_DONE(bp);
-       xfs_buf_delwri_dequeue(bp);
 
        trace_xfs_buf_error_relse(bp, _RET_IP_);
 
index ff33645fe62d5722664af0f84078495d7d8daf24..86f1928b4cfa5f0d19bcfce9d69a32908f4d495b 100644 (file)
@@ -149,7 +149,6 @@ xfs_read_buf(
                }
                if (bp) {
                        XFS_BUF_UNDONE(bp);
-                       xfs_buf_delwri_dequeue(bp);
                        xfs_buf_stale(bp);
                        /*
                         * brelse clears B_ERROR and b_error
index d03a8ee191728904f0bdb165717af8f0e1489b29..5bab5980a6f9381830e67614ac9cef954dea87f3 100644 (file)
@@ -162,7 +162,6 @@ xfs_trans_get_buf(xfs_trans_t       *tp,
                ASSERT(xfs_buf_islocked(bp));
                if (XFS_FORCED_SHUTDOWN(tp->t_mountp)) {
                        xfs_buf_stale(bp);
-                       xfs_buf_delwri_dequeue(bp);
                        XFS_BUF_DONE(bp);
                }
 
@@ -391,7 +390,6 @@ xfs_trans_read_buf(
        if (bp->b_error) {
                error = bp->b_error;
                xfs_buf_stale(bp);
-               xfs_buf_delwri_dequeue(bp);
                XFS_BUF_DONE(bp);
                xfs_ioerror_alert("xfs_trans_read_buf", mp,
                                  bp, blkno);
@@ -744,7 +742,6 @@ xfs_trans_binval(
         * We set the stale bit in the buffer as well since we're getting
         * rid of it.
         */
-       xfs_buf_delwri_dequeue(bp);
        xfs_buf_stale(bp);
        bip->bli_flags |= XFS_BLI_STALE;
        bip->bli_flags &= ~(XFS_BLI_INODE_BUF | XFS_BLI_LOGGED | XFS_BLI_DIRTY);