xfs: add a new xfs_sb_version_has_v3inode helper
Add a new wrapper to check if a file system supports the v3 inode format with a larger dinode core. Previously we used xfs_sb_version_hascrc for that, which is technically correct but a little confusing to read. Also move xfs_dinode_good_version next to xfs_sb_version_has_v3inode so that we have one place that documents the superblock version to inode version relationship. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Chandan Rajendra <chandanrlinux@gmail.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:

committed by
Darrick J. Wong

parent
8a62714313
commit
b81b79f4ed
@@ -44,17 +44,6 @@ xfs_inobp_check(
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
xfs_dinode_good_version(
|
||||
struct xfs_mount *mp,
|
||||
__u8 version)
|
||||
{
|
||||
if (xfs_sb_version_hascrc(&mp->m_sb))
|
||||
return version == 3;
|
||||
|
||||
return version == 1 || version == 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we are doing readahead on an inode buffer, we might be in log recovery
|
||||
* reading an inode allocation buffer that hasn't yet been replayed, and hence
|
||||
@@ -93,7 +82,7 @@ xfs_inode_buf_verify(
|
||||
dip = xfs_buf_offset(bp, (i << mp->m_sb.sb_inodelog));
|
||||
unlinked_ino = be32_to_cpu(dip->di_next_unlinked);
|
||||
di_ok = xfs_verify_magic16(bp, dip->di_magic) &&
|
||||
xfs_dinode_good_version(mp, dip->di_version) &&
|
||||
xfs_dinode_good_version(&mp->m_sb, dip->di_version) &&
|
||||
xfs_verify_agino_or_null(mp, agno, unlinked_ino);
|
||||
if (unlikely(XFS_TEST_ERROR(!di_ok, mp,
|
||||
XFS_ERRTAG_ITOBP_INOTOBP))) {
|
||||
@@ -454,7 +443,7 @@ xfs_dinode_verify(
|
||||
|
||||
/* Verify v3 integrity information first */
|
||||
if (dip->di_version >= 3) {
|
||||
if (!xfs_sb_version_hascrc(&mp->m_sb))
|
||||
if (!xfs_sb_version_has_v3inode(&mp->m_sb))
|
||||
return __this_address;
|
||||
if (!xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize,
|
||||
XFS_DINODE_CRC_OFF))
|
||||
@@ -629,7 +618,7 @@ xfs_iread(
|
||||
|
||||
/* shortcut IO on inode allocation if possible */
|
||||
if ((iget_flags & XFS_IGET_CREATE) &&
|
||||
xfs_sb_version_hascrc(&mp->m_sb) &&
|
||||
xfs_sb_version_has_v3inode(&mp->m_sb) &&
|
||||
!(mp->m_flags & XFS_MOUNT_IKEEP)) {
|
||||
VFS_I(ip)->i_generation = prandom_u32();
|
||||
ip->i_d.di_version = 3;
|
||||
|
Reference in New Issue
Block a user