xfs
[Top] [All Lists]

[PATCH 08/10] xfs: do not add buffers to the delwri queue until pushed

To: xfs@xxxxxxxxxxx
Subject: [PATCH 08/10] xfs: do not add buffers to the delwri queue until pushed
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Tue, 27 Mar 2012 12:44:08 -0400
References: <20120327164400.967415009@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
Instead of adding buffers to the delwri list as soon as they are logged,
even if they can't be written until commited because they are pinned
defer adding them to the delwri list until xfsaild pushes them.  This
makes the code more similar to other log items and prepares for writing
buffers directly from xfsaild.

The complication here is that we need to fail buffers that were added
but not logged yet in xfs_buf_item_unpin, borrowing code from
xfs_bioerror.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

---
 fs/xfs/xfs_buf_item.c  |   11 ++++++++---
 fs/xfs/xfs_trans_buf.c |    2 --
 2 files changed, 8 insertions(+), 5 deletions(-)

Index: xfs/fs/xfs/xfs_buf_item.c
===================================================================
--- xfs.orig/fs/xfs/xfs_buf_item.c      2012-03-16 09:51:16.830170721 +0100
+++ xfs/fs/xfs/xfs_buf_item.c   2012-03-16 09:52:14.600171793 +0100
@@ -460,6 +460,12 @@ xfs_buf_item_unpin(
                        ASSERT(bp->b_fspriv == NULL);
                }
                xfs_buf_relse(bp);
+       } else if (freed && remove) {
+               xfs_buf_lock(bp);
+               xfs_buf_ioerror(bp, EIO);
+               XFS_BUF_UNDONE(bp);
+               xfs_buf_stale(bp);
+               xfs_buf_ioend(bp, 0);
        }
 }
 
@@ -604,9 +610,7 @@ xfs_buf_item_committed(
 }
 
 /*
- * The buffer is locked, but is not a delayed write buffer. This happens
- * if we race with IO completion and hence we don't want to try to write it
- * again. Just release the buffer.
+ * The buffer is locked, but is not a delayed write buffer.
  */
 STATIC void
 xfs_buf_item_push(
@@ -620,6 +624,7 @@ xfs_buf_item_push(
 
        trace_xfs_buf_item_push(bip);
 
+       xfs_buf_delwri_queue(bp);
        xfs_buf_relse(bp);
 }
 
Index: xfs/fs/xfs/xfs_trans_buf.c
===================================================================
--- xfs.orig/fs/xfs/xfs_trans_buf.c     2012-03-16 09:51:16.846837387 +0100
+++ xfs/fs/xfs/xfs_trans_buf.c  2012-03-16 09:52:14.600171793 +0100
@@ -626,8 +626,6 @@ xfs_trans_log_buf(xfs_trans_t       *tp,
        bp->b_iodone = xfs_buf_iodone_callbacks;
        bip->bli_item.li_cb = xfs_buf_iodone;
 
-       xfs_buf_delwri_queue(bp);
-
        trace_xfs_trans_log_buf(bip);
 
        /*

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