aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-08 08:36:36 -0400
committerChristoph Hellwig <hch@lst.de>2011-07-08 08:36:36 -0400
commite163cbde981c5988c3e80ca29589132336f18a72 (patch)
tree735c72c28476969eddd4a39d878bb194f3609888
parent1d5ae5dfeee024d51fb2c0205035d7611a8f0c86 (diff)
xfs: avoid a few disk cache flushes
There is no need for a pre-flush when doing writing the second part of a split log buffer, and if we are using an external log there is no need to do a full cache flush of the log device at all given that all writes to it use the FUA flag. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
-rw-r--r--fs/xfs/xfs_log.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 4c2d30e3b78d..0ef5eb677383 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1371,15 +1371,21 @@ xlog_sync(xlog_t *log,
1371 bp->b_flags |= XBF_SYNCIO; 1371 bp->b_flags |= XBF_SYNCIO;
1372 1372
1373 if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) { 1373 if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) {
1374 bp->b_flags |= XBF_FUA;
1375
1374 /* 1376 /*
1375 * If we have an external log device, flush the data device 1377 * Flush the data device before flushing the log to make
1376 * before flushing the log to make sure all meta data 1378 * sure all meta data written back from the AIL actually made
1377 * written back from the AIL actually made it to disk 1379 * it to disk before stamping the new log tail LSN into the
1378 * before writing out the new log tail LSN in the log buffer. 1380 * log buffer. For an external log we need to issue the
1381 * flush explicitly, and unfortunately synchronously here;
1382 * for an internal log we can simply use the block layer
1383 * state machine for preflushes.
1379 */ 1384 */
1380 if (log->l_mp->m_logdev_targp != log->l_mp->m_ddev_targp) 1385 if (log->l_mp->m_logdev_targp != log->l_mp->m_ddev_targp)
1381 xfs_blkdev_issue_flush(log->l_mp->m_ddev_targp); 1386 xfs_blkdev_issue_flush(log->l_mp->m_ddev_targp);
1382 bp->b_flags |= XBF_FUA | XBF_FLUSH; 1387 else
1388 bp->b_flags |= XBF_FLUSH;
1383 } 1389 }
1384 1390
1385 ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1); 1391 ASSERT(XFS_BUF_ADDR(bp) <= log->l_logBBsize-1);
@@ -1414,7 +1420,7 @@ xlog_sync(xlog_t *log,
1414 XFS_BUF_ASYNC(bp); 1420 XFS_BUF_ASYNC(bp);
1415 bp->b_flags |= XBF_SYNCIO; 1421 bp->b_flags |= XBF_SYNCIO;
1416 if (log->l_mp->m_flags & XFS_MOUNT_BARRIER) 1422 if (log->l_mp->m_flags & XFS_MOUNT_BARRIER)
1417 bp->b_flags |= XBF_FUA | XBF_FLUSH; 1423 bp->b_flags |= XBF_FUA;
1418 dptr = XFS_BUF_PTR(bp); 1424 dptr = XFS_BUF_PTR(bp);
1419 /* 1425 /*
1420 * Bump the cycle numbers at the start of each block 1426 * Bump the cycle numbers at the start of each block