xfs
[Top] [All Lists]

[PATCH 2/2] xfs: enforce synchronous writes in xfs_bwrite

To: xfs@xxxxxxxxxxx
Subject: [PATCH 2/2] xfs: enforce synchronous writes in xfs_bwrite
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 12 Mar 2010 05:59:40 -0500
User-agent: Mutt/1.5.19 (2009-01-05)
xfs_bwrite is used with the intention of synchronously writing out buffers,
but currently it does not actually clear the async flag if that's left
from previous writes but instead implements async behaviour if it finds it.
Remove the code handling asynchronous writes as we've got rid of those
entirely outside of the log and delwri buffers, and make sure that we
clear the async and read flags before writing the buffer.

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

Index: xfs/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_buf.c 2010-03-11 11:42:41.596003157 +0100
+++ xfs/fs/xfs/linux-2.6/xfs_buf.c      2010-03-11 11:44:34.473008395 +0100
@@ -1056,25 +1056,20 @@ xfs_bwrite(
        struct xfs_mount        *mp,
        struct xfs_buf          *bp)
 {
-       int                     iowait = (bp->b_flags & XBF_ASYNC) == 0;
-       int                     error = 0;
+       int                     error;
 
        bp->b_strat = xfs_bdstrat_cb;
        bp->b_mount = mp;
        bp->b_flags |= XBF_WRITE;
-       if (!iowait)
-               bp->b_flags |= _XBF_RUN_QUEUES;
+       bp->b_flags &= ~(XBF_ASYNC | XBF_READ);
 
        xfs_buf_delwri_dequeue(bp);
        xfs_buf_iostrategy(bp);
 
-       if (iowait) {
-               error = xfs_buf_iowait(bp);
-               if (error)
-                       xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
-               xfs_buf_relse(bp);
-       }
-
+       error = xfs_buf_iowait(bp);
+       if (error)
+               xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
+       xfs_buf_relse(bp);
        return error;
 }
 
Index: xfs/fs/xfs/linux-2.6/xfs_sync.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_sync.c        2010-03-11 11:44:58.473010700 
+0100
+++ xfs/fs/xfs/linux-2.6/xfs_sync.c     2010-03-11 11:45:03.199256475 +0100
@@ -364,7 +364,6 @@ xfs_sync_fsdata(
        if (XFS_BUF_ISPINNED(bp))
                xfs_log_force(mp, 0);
 
-       XFS_BUF_UNASYNC(bp);
        return xfs_bwrite(mp, bp);
 }
 

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 2/2] xfs: enforce synchronous writes in xfs_bwrite, Christoph Hellwig <=