Commit 2e973b2c authored by Dave Chinner's avatar Dave Chinner Committed by Darrick J. Wong
Browse files

xfs: convert remaining mount flags to state flags



The remaining mount flags kept in m_flags are actually runtime state
flags. These change dynamically, so they really should be updated
atomically so we don't potentially lose an update due to racing
modifications.

Convert these remaining flags to be stored in m_opstate and use
atomic bitops to set and clear the flags. This also adds a couple of
simple wrappers for common state checks - read only and shutdown.

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent 0560f31a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3166,7 +3166,7 @@ xfs_alloc_vextent(
		 * the first a.g. fails.
		 */
		if ((args->datatype & XFS_ALLOC_INITIAL_USER_DATA) &&
		    (mp->m_flags & XFS_MOUNT_32BITINODES)) {
		    xfs_is_inode32(mp)) {
			args->fsbno = XFS_AGB_TO_FSB(mp,
					((mp->m_agfrotor / rotorstep) %
					mp->m_sb.sb_agcount), 0);
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ xfs_validate_sb_read(
"Superblock has unknown read-only compatible features (0x%x) enabled.",
			(sbp->sb_features_ro_compat &
					XFS_SB_FEAT_RO_COMPAT_UNKNOWN));
		if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
		if (!xfs_is_readonly(mp)) {
			xfs_warn(mp,
"Attempted to mount read-only compatible filesystem read-write.");
			xfs_warn(mp,
+1 −1
Original line number Diff line number Diff line
@@ -883,7 +883,7 @@ xchk_start_reaping(
	 * Readonly filesystems do not perform inactivation or speculative
	 * preallocation, so there's no need to restart the workers.
	 */
	if (!(sc->mp->m_flags & XFS_MOUNT_RDONLY)) {
	if (!xfs_is_readonly(sc->mp)) {
		xfs_inodegc_start(sc->mp);
		xfs_blockgc_start(sc->mp);
	}
+1 −1
Original line number Diff line number Diff line
@@ -419,7 +419,7 @@ xchk_validate_inputs(
			goto out;

		error = -EROFS;
		if (mp->m_flags & XFS_MOUNT_RDONLY)
		if (xfs_is_readonly(mp))
			goto out;
	}

+1 −1
Original line number Diff line number Diff line
@@ -1144,7 +1144,7 @@ xfs_buf_ioerror_permanent(
		return true;

	/* At unmount we may treat errors differently */
	if ((mp->m_flags & XFS_MOUNT_UNMOUNTING) && mp->m_fail_unmount)
	if (xfs_is_unmounting(mp) && mp->m_fail_unmount)
		return true;

	return false;
Loading