xfs: kill xfs_sb_version_has_v3inode()

All callers to xfs_dinode_good_version() and XFS_DINODE_SIZE() in
both the kernel and userspace have a xfs_mount structure available
which means they can use mount features checks instead looking
directly are the superblock.

Convert these functions to take a mount and use a xfs_has_v3inodes()
check and move it out of the libxfs/xfs_format.h file as it really
doesn't have anything to do with the definition of the on-disk
format.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
Dave Chinner
2021-08-18 18:46:57 -07:00
committed by Darrick J. Wong
parent d6837c1aab
commit cf28e17c91
4 changed files with 15 additions and 19 deletions

View File

@@ -414,18 +414,6 @@ xfs_sb_add_incompat_log_features(
}
/*
* v5 file systems support V3 inodes only, earlier file systems support
* v2 and v1 inodes.
*/
static inline bool xfs_dinode_good_version(struct xfs_sb *sbp,
uint8_t version)
{
if (xfs_sb_is_v5(sbp))
return version == 3;
return version == 1 || version == 2;
}
static inline bool
xfs_is_quota_inode(struct xfs_sb *sbp, xfs_ino_t ino)
{
@@ -892,12 +880,12 @@ enum xfs_dinode_fmt {
/*
* Inode size for given fs.
*/
#define XFS_DINODE_SIZE(sbp) \
(xfs_sb_is_v5(sbp) ? \
#define XFS_DINODE_SIZE(mp) \
(xfs_has_v3inodes(mp) ? \
sizeof(struct xfs_dinode) : \
offsetof(struct xfs_dinode, di_crc))
#define XFS_LITINO(mp) \
((mp)->m_sb.sb_inodesize - XFS_DINODE_SIZE(&(mp)->m_sb))
((mp)->m_sb.sb_inodesize - XFS_DINODE_SIZE(mp))
/*
* Inode data & attribute fork sizes, per inode.