提交 4ef19ddd 编写于 作者: C Christoph Hellwig 提交者: Nathan Scott

[XFS] enable write barriers by default

SGI-PV: 912426
SGI-Modid: xfs-linux-melb:xfs-kern:201981a
Signed-off-by: NChristoph Hellwig <hch@sgi.com>
Signed-off-by: NNathan Scott <nathans@sgi.com>
上级 d3a9b1f9
...@@ -306,6 +306,7 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp) ...@@ -306,6 +306,7 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp)
xfs_fs_cmn_err(CE_NOTE, mp, xfs_fs_cmn_err(CE_NOTE, mp,
"Disabling barriers, not supported with external log device"); "Disabling barriers, not supported with external log device");
mp->m_flags &= ~XFS_MOUNT_BARRIER; mp->m_flags &= ~XFS_MOUNT_BARRIER;
return;
} }
if (mp->m_ddev_targp->pbr_bdev->bd_disk->queue->ordered == if (mp->m_ddev_targp->pbr_bdev->bd_disk->queue->ordered ==
...@@ -313,6 +314,7 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp) ...@@ -313,6 +314,7 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp)
xfs_fs_cmn_err(CE_NOTE, mp, xfs_fs_cmn_err(CE_NOTE, mp,
"Disabling barriers, not supported by the underlying device"); "Disabling barriers, not supported by the underlying device");
mp->m_flags &= ~XFS_MOUNT_BARRIER; mp->m_flags &= ~XFS_MOUNT_BARRIER;
return;
} }
error = xfs_barrier_test(mp); error = xfs_barrier_test(mp);
...@@ -320,6 +322,7 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp) ...@@ -320,6 +322,7 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp)
xfs_fs_cmn_err(CE_NOTE, mp, xfs_fs_cmn_err(CE_NOTE, mp,
"Disabling barriers, trial barrier write failed"); "Disabling barriers, trial barrier write failed");
mp->m_flags &= ~XFS_MOUNT_BARRIER; mp->m_flags &= ~XFS_MOUNT_BARRIER;
return;
} }
} }
......
...@@ -312,6 +312,8 @@ xfs_start_flags( ...@@ -312,6 +312,8 @@ xfs_start_flags(
mp->m_flags |= XFS_MOUNT_NOUUID; mp->m_flags |= XFS_MOUNT_NOUUID;
if (ap->flags & XFSMNT_BARRIER) if (ap->flags & XFSMNT_BARRIER)
mp->m_flags |= XFS_MOUNT_BARRIER; mp->m_flags |= XFS_MOUNT_BARRIER;
else
mp->m_flags &= ~XFS_MOUNT_BARRIER;
return 0; return 0;
} }
...@@ -655,6 +657,11 @@ xfs_mntupdate( ...@@ -655,6 +657,11 @@ xfs_mntupdate(
else else
mp->m_flags &= ~XFS_MOUNT_NOATIME; mp->m_flags &= ~XFS_MOUNT_NOATIME;
if (args->flags & XFSMNT_BARRIER)
mp->m_flags |= XFS_MOUNT_BARRIER;
else
mp->m_flags &= ~XFS_MOUNT_BARRIER;
if ((vfsp->vfs_flag & VFS_RDONLY) && if ((vfsp->vfs_flag & VFS_RDONLY) &&
!(*flags & MS_RDONLY)) { !(*flags & MS_RDONLY)) {
vfsp->vfs_flag &= ~VFS_RDONLY; vfsp->vfs_flag &= ~VFS_RDONLY;
...@@ -1634,6 +1641,7 @@ xfs_vget( ...@@ -1634,6 +1641,7 @@ xfs_vget(
#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */ #define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */
#define MNTOPT_BARRIER "barrier" /* use writer barriers for log write and #define MNTOPT_BARRIER "barrier" /* use writer barriers for log write and
* unwritten extent conversion */ * unwritten extent conversion */
#define MNTOPT_NOBARRIER "nobarrier" /* .. disable */
#define MNTOPT_OSYNCISOSYNC "osyncisosync" /* o_sync is REALLY o_sync */ #define MNTOPT_OSYNCISOSYNC "osyncisosync" /* o_sync is REALLY o_sync */
#define MNTOPT_64BITINODE "inode64" /* inodes can be allocated anywhere */ #define MNTOPT_64BITINODE "inode64" /* inodes can be allocated anywhere */
#define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */ #define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */
...@@ -1681,6 +1689,7 @@ xfs_parseargs( ...@@ -1681,6 +1689,7 @@ xfs_parseargs(
args->flags2 |= XFSMNT2_COMPAT_IOSIZE; args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
args->flags |= XFSMNT_COMPAT_ATTR; args->flags |= XFSMNT_COMPAT_ATTR;
args->flags |= XFSMNT_BARRIER;
#if 0 /* XXX: off by default, until some remaining issues ironed out */ #if 0 /* XXX: off by default, until some remaining issues ironed out */
args->flags |= XFSMNT_IDELETE; /* default to on */ args->flags |= XFSMNT_IDELETE; /* default to on */
...@@ -1806,6 +1815,8 @@ xfs_parseargs( ...@@ -1806,6 +1815,8 @@ xfs_parseargs(
args->flags |= XFSMNT_NOUUID; args->flags |= XFSMNT_NOUUID;
} else if (!strcmp(this_char, MNTOPT_BARRIER)) { } else if (!strcmp(this_char, MNTOPT_BARRIER)) {
args->flags |= XFSMNT_BARRIER; args->flags |= XFSMNT_BARRIER;
} else if (!strcmp(this_char, MNTOPT_NOBARRIER)) {
args->flags &= ~XFSMNT_BARRIER;
} else if (!strcmp(this_char, MNTOPT_IKEEP)) { } else if (!strcmp(this_char, MNTOPT_IKEEP)) {
args->flags &= ~XFSMNT_IDELETE; args->flags &= ~XFSMNT_IDELETE;
} else if (!strcmp(this_char, MNTOPT_NOIKEEP)) { } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) {
...@@ -1892,7 +1903,6 @@ xfs_showargs( ...@@ -1892,7 +1903,6 @@ xfs_showargs(
{ XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID }, { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID },
{ XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY }, { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY },
{ XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC }, { XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC },
{ XFS_MOUNT_BARRIER, "," MNTOPT_BARRIER },
{ XFS_MOUNT_IDELETE, "," MNTOPT_NOIKEEP }, { XFS_MOUNT_IDELETE, "," MNTOPT_NOIKEEP },
{ 0, NULL } { 0, NULL }
}; };
...@@ -1941,6 +1951,9 @@ xfs_showargs( ...@@ -1941,6 +1951,9 @@ xfs_showargs(
if (!(vfsp->vfs_flag & VFS_32BITINODES)) if (!(vfsp->vfs_flag & VFS_32BITINODES))
seq_printf(m, "," MNTOPT_64BITINODE); seq_printf(m, "," MNTOPT_64BITINODE);
if (!(vfsp->vfs_flag & XFS_MOUNT_BARRIER))
seq_printf(m, "," MNTOPT_NOBARRIER);
if (vfsp->vfs_flag & VFS_GRPID) if (vfsp->vfs_flag & VFS_GRPID)
seq_printf(m, "," MNTOPT_GRPID); seq_printf(m, "," MNTOPT_GRPID);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册