[XFS] write barrier support Issue all log sync operations as ordered
writes. In addition flush the disk cache on fsync if the sync cached operation didn't sync the log to disk (this requires some additional bookeping in the transaction and log code). If the device doesn't claim to support barriers, the filesystem has an extern log volume or the trial superblock write with barriers enabled failed we disable barriers and print a warning. We should probably fail the mount completely, but that could lead to nasty boot failures for the root filesystem. Not enabled by default yet, needs more destructive testing first. SGI-PV: 912426 SGI-Modid: xfs-linux:xfs-kern:198723a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
This commit is contained in:
committed by
Nathan Scott
parent
739cafd316
commit
f538d4da8d
@@ -278,6 +278,72 @@ xfs_blkdev_put(
|
||||
close_bdev_excl(bdev);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to write out the superblock using barriers.
|
||||
*/
|
||||
STATIC int
|
||||
xfs_barrier_test(
|
||||
xfs_mount_t *mp)
|
||||
{
|
||||
xfs_buf_t *sbp = xfs_getsb(mp, 0);
|
||||
int error;
|
||||
|
||||
XFS_BUF_UNDONE(sbp);
|
||||
XFS_BUF_UNREAD(sbp);
|
||||
XFS_BUF_UNDELAYWRITE(sbp);
|
||||
XFS_BUF_WRITE(sbp);
|
||||
XFS_BUF_UNASYNC(sbp);
|
||||
XFS_BUF_ORDERED(sbp);
|
||||
|
||||
xfsbdstrat(mp, sbp);
|
||||
error = xfs_iowait(sbp);
|
||||
|
||||
/*
|
||||
* Clear all the flags we set and possible error state in the
|
||||
* buffer. We only did the write to try out whether barriers
|
||||
* worked and shouldn't leave any traces in the superblock
|
||||
* buffer.
|
||||
*/
|
||||
XFS_BUF_DONE(sbp);
|
||||
XFS_BUF_ERROR(sbp, 0);
|
||||
XFS_BUF_UNORDERED(sbp);
|
||||
|
||||
xfs_buf_relse(sbp);
|
||||
return error;
|
||||
}
|
||||
|
||||
void
|
||||
xfs_mountfs_check_barriers(xfs_mount_t *mp)
|
||||
{
|
||||
int error;
|
||||
|
||||
if (mp->m_logdev_targp != mp->m_ddev_targp) {
|
||||
xfs_fs_cmn_err(CE_NOTE, mp,
|
||||
"Disabling barriers, not supported with external log device");
|
||||
mp->m_flags &= ~XFS_MOUNT_BARRIER;
|
||||
}
|
||||
|
||||
if (mp->m_ddev_targp->pbr_bdev->bd_disk->queue->ordered ==
|
||||
QUEUE_ORDERED_NONE) {
|
||||
xfs_fs_cmn_err(CE_NOTE, mp,
|
||||
"Disabling barriers, not supported by the underlying device");
|
||||
mp->m_flags &= ~XFS_MOUNT_BARRIER;
|
||||
}
|
||||
|
||||
error = xfs_barrier_test(mp);
|
||||
if (error) {
|
||||
xfs_fs_cmn_err(CE_NOTE, mp,
|
||||
"Disabling barriers, trial barrier write failed");
|
||||
mp->m_flags &= ~XFS_MOUNT_BARRIER;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xfs_blkdev_issue_flush(
|
||||
xfs_buftarg_t *buftarg)
|
||||
{
|
||||
blkdev_issue_flush(buftarg->pbr_bdev, NULL);
|
||||
}
|
||||
|
||||
STATIC struct inode *
|
||||
linvfs_alloc_inode(
|
||||
|
Reference in New Issue
Block a user