]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
db/check: handle zero inoalignmt correctly for large block sizes
authorBrian Foster <bfoster@redhat.com>
Tue, 7 Apr 2015 00:04:11 +0000 (10:04 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 7 Apr 2015 00:04:11 +0000 (10:04 +1000)
The check command prints a spurious error when sb_inoalignmt is zero but
the sb align feature bit is set:

$ mkfs.xfs -f -bsize=16k <dev>
$ xfs_db -c "check" <dev>
sb versionnum extra align bit 80

This occurs because check determines whether to expect the alignment
feature bit based on a non-zero inoalignmt (in init()). sb_inoalignmt of
0 is expected for block sizes that are large enough for at least one
full inode record (64 inodes), however. For example, when bsize >= 16k
on v4 filesystems or >=32k on v5 filesystems.

Update the init() logic in the check command to detect this particular
scenario. Set the in-memory feature bit if inoalignmt is zero and the
block size is large enough for full inode records such that blockget_f()
does not complain.

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

index 4fd9fd0251be27b419b5a8bfba75f46834b020c9..c4c972f21cb5f322a0de9e8fa8c1d09295c900ba 100644 (file)
@@ -1832,7 +1832,13 @@ init(
        error = sbver_err = serious_error = 0;
        fdblocks = frextents = icount = ifree = 0;
        sbversion = XFS_SB_VERSION_4;
-       if (mp->m_sb.sb_inoalignmt)
+       /*
+        * Note that inoalignmt == 0 is valid when fsb size is large enough for
+        * at least one full inode record per block. Check this case explicitly.
+        */
+       if (mp->m_sb.sb_inoalignmt ||
+           (xfs_sb_version_hasalign(&mp->m_sb) &&
+            mp->m_sb.sb_inopblock >= XFS_INODES_PER_CHUNK))
                sbversion |= XFS_SB_VERSION_ALIGNBIT;
        if ((mp->m_sb.sb_uquotino && mp->m_sb.sb_uquotino != NULLFSINO) ||
            (mp->m_sb.sb_gquotino && mp->m_sb.sb_gquotino != NULLFSINO) ||