diff options
Diffstat (limited to 'fs/xfs/libxfs/xfs_inode_buf.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_inode_buf.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c index 8de9a3a29589..134424fac434 100644 --- a/fs/xfs/libxfs/xfs_inode_buf.c +++ b/fs/xfs/libxfs/xfs_inode_buf.c | |||
@@ -57,6 +57,17 @@ xfs_inobp_check( | |||
57 | } | 57 | } |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | bool | ||
61 | xfs_dinode_good_version( | ||
62 | struct xfs_mount *mp, | ||
63 | __u8 version) | ||
64 | { | ||
65 | if (xfs_sb_version_hascrc(&mp->m_sb)) | ||
66 | return version == 3; | ||
67 | |||
68 | return version == 1 || version == 2; | ||
69 | } | ||
70 | |||
60 | /* | 71 | /* |
61 | * If we are doing readahead on an inode buffer, we might be in log recovery | 72 | * If we are doing readahead on an inode buffer, we might be in log recovery |
62 | * reading an inode allocation buffer that hasn't yet been replayed, and hence | 73 | * reading an inode allocation buffer that hasn't yet been replayed, and hence |
@@ -91,7 +102,7 @@ xfs_inode_buf_verify( | |||
91 | 102 | ||
92 | dip = xfs_buf_offset(bp, (i << mp->m_sb.sb_inodelog)); | 103 | dip = xfs_buf_offset(bp, (i << mp->m_sb.sb_inodelog)); |
93 | di_ok = dip->di_magic == cpu_to_be16(XFS_DINODE_MAGIC) && | 104 | di_ok = dip->di_magic == cpu_to_be16(XFS_DINODE_MAGIC) && |
94 | XFS_DINODE_GOOD_VERSION(dip->di_version); | 105 | xfs_dinode_good_version(mp, dip->di_version); |
95 | if (unlikely(XFS_TEST_ERROR(!di_ok, mp, | 106 | if (unlikely(XFS_TEST_ERROR(!di_ok, mp, |
96 | XFS_ERRTAG_ITOBP_INOTOBP, | 107 | XFS_ERRTAG_ITOBP_INOTOBP, |
97 | XFS_RANDOM_ITOBP_INOTOBP))) { | 108 | XFS_RANDOM_ITOBP_INOTOBP))) { |