Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: reserve v5 superblock read-only compat. feature bit for finobt

Reserve a v5 read-only compatibility feature bit for the finobt and
create the xfs_sb_version_hasfinobt() helper to determine whether
an fs has the feature enabled.

The finobt does not change existing on-disk structures, but must
remain consistent with the ialloc btree. Modifications from older
kernels would violate that constrant. Therefore, we restrict older
kernels to read-only mounts of finobt-enabled filesystems.

Note that this does not yet enable the ability to rw mount a finobt
fs (by setting the feature bit in the XFS_SB_FEAT_RO_COMPAT_ALL
mask).

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>

authored by

Brian Foster and committed by
Dave Chinner
8e2c84df 57bd3dbe

+7
+7
fs/xfs/xfs_sb.h
··· 587 587 return (sbp->sb_features_compat & feature) != 0; 588 588 } 589 589 590 + #define XFS_SB_FEAT_RO_COMPAT_FINOBT (1 << 0) /* free inode btree */ 590 591 #define XFS_SB_FEAT_RO_COMPAT_ALL 0 591 592 #define XFS_SB_FEAT_RO_COMPAT_UNKNOWN ~XFS_SB_FEAT_RO_COMPAT_ALL 592 593 static inline bool ··· 640 639 xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_FTYPE)) || 641 640 (xfs_sb_version_hasmorebits(sbp) && 642 641 (sbp->sb_features2 & XFS_SB_VERSION2_FTYPE)); 642 + } 643 + 644 + static inline int xfs_sb_version_hasfinobt(xfs_sb_t *sbp) 645 + { 646 + return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) && 647 + (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_FINOBT); 643 648 } 644 649 645 650 /*