Skip to contentSkip to conversation

xfs: enforce synchronous writes in xfs_bwrite

PATCH New Christoph Hellwig 1 participant 1 message Mar 12, 2010 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 xfs: enforce synchronous writes in xfs_bwrite

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.

fs/xfs/linux-2.6/xfs_buf.c +6 -11
Index: xfs/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
@@ -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;
 }
 
fs/xfs/linux-2.6/xfs_sync.c +0 -1
Index: xfs/fs/xfs/linux-2.6/xfs_sync.c
===================================================================
@@ -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);
 }
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs