summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_mount.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 10:47:30 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-12-15 17:28:59 -0800
commit93dda3ad1c4e1a0e5a0130ef176977266fdec1fc (patch)
tree166a3b0b18f558c07629493d77f43b90172846b5 /fs/xfs/xfs_mount.c
parentea7ddde15643d6711c865c21950990aee849f60b (diff)
xfs: create a log incompat flag for atomic extent swapping
Create a log incompat flag so that we only attempt to process swap extent log items if the filesystem supports it. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r--fs/xfs/xfs_mount.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 804adb6cf650..490bf1266661 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1278,13 +1278,15 @@ xfs_force_summary_recalc(
int
xfs_add_incompat_log_feature(
struct xfs_mount *mp,
- uint32_t feature)
+ uint64_t mount_feature,
+ uint32_t sb_feature)
{
struct xfs_dsb *dsb;
int error;
- ASSERT(hweight32(feature) == 1);
- ASSERT(!(feature & XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN));
+ ASSERT(hweight32(sb_feature) == 1);
+ ASSERT(!(sb_feature & XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN));
+ ASSERT(!(mount_feature & ~XFS_FEAT_INCOMPAT_LOG_ALL));
/*
* Force the log to disk and kick the background AIL thread to reduce
@@ -1309,7 +1311,7 @@ xfs_add_incompat_log_feature(
goto rele;
}
- if (xfs_sb_has_incompat_log_feature(&mp->m_sb, feature))
+ if (xfs_sb_has_incompat_log_feature(&mp->m_sb, sb_feature))
goto rele;
/*
@@ -1319,7 +1321,7 @@ xfs_add_incompat_log_feature(
*/
dsb = mp->m_sb_bp->b_addr;
xfs_sb_to_disk(dsb, &mp->m_sb);
- dsb->sb_features_log_incompat |= cpu_to_be32(feature);
+ dsb->sb_features_log_incompat |= cpu_to_be32(sb_feature);
error = xfs_bwrite(mp->m_sb_bp);
if (error)
goto shutdown;
@@ -1328,7 +1330,10 @@ xfs_add_incompat_log_feature(
* Add the feature bits to the incore superblock before we unlock the
* buffer.
*/
- xfs_sb_add_incompat_log_features(&mp->m_sb, feature);
+ spin_lock(&mp->m_sb_lock);
+ mp->m_features |= mount_feature;
+ mp->m_sb.sb_features_log_incompat |= sb_feature;
+ spin_unlock(&mp->m_sb_lock);
xfs_buf_relse(mp->m_sb_bp);
/* Log the superblock to disk. */
@@ -1369,14 +1374,18 @@ xfs_clear_incompat_log_features(
*/
xfs_buf_lock(mp->m_sb_bp);
xfs_buf_hold(mp->m_sb_bp);
+ spin_lock(&mp->m_sb_lock);
if (xfs_sb_has_incompat_log_feature(&mp->m_sb,
XFS_SB_FEAT_INCOMPAT_LOG_ALL)) {
xfs_info(mp, "Clearing log incompat feature flags.");
- xfs_sb_remove_incompat_log_features(&mp->m_sb);
+ mp->m_features &= ~XFS_FEAT_INCOMPAT_LOG_ALL;
+ mp->m_sb.sb_features_log_incompat &=
+ ~XFS_SB_FEAT_INCOMPAT_LOG_ALL;
ret = true;
}
+ spin_unlock(&mp->m_sb_lock);
xfs_buf_relse(mp->m_sb_bp);
return ret;
}