]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: fix fino_bno calculation when rmapbt is enabled
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 18 Aug 2016 23:57:04 +0000 (09:57 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 18 Aug 2016 23:57:04 +0000 (09:57 +1000)
In xfs_repair, we calculate where we think mkfs put the root inode
block.  However, the rmapbt component doesn't account for the fact
that mkfs reserved 2 AGFL blocks for the rmapbt, so its calculation
is off by a bit.  This leads to it complaining (incorrectly) about the
root inode block being in the wrong place and blowing up.

[dchinner: small comment update to indicate AGFL block accounting]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/xfs_repair.c

index 94baf5d8591863a193d97d8ee3337925d9b22665..a635ea8918ee3dab10d16453cfcb71f1f07cf3b9 100644 (file)
@@ -409,7 +409,7 @@ calc_mkfs(xfs_mount_t *mp)
         * Because the current shape of the btrees may differ from the current
         * shape, we open code the mkfs freelist block count here. mkfs creates
         * single level trees, so the calculation is pertty straight forward for
-        * the two trees that use the AGFL.
+        * the trees that use the AGFL.
         */
        bnobt_root = howmany(4 * mp->m_sb.sb_sectsize, mp->m_sb.sb_blocksize);
        bcntbt_root = bnobt_root + 1;
@@ -417,8 +417,10 @@ calc_mkfs(xfs_mount_t *mp)
        fino_bno = inobt_root + (2 * min(2, mp->m_ag_maxlevels)) + 1;
        if (xfs_sb_version_hasfinobt(&mp->m_sb))
                fino_bno++;
-       if (xfs_sb_version_hasrmapbt(&mp->m_sb))
+       if (xfs_sb_version_hasrmapbt(&mp->m_sb)) {
+               fino_bno += min(2, mp->m_rmap_maxlevels); /* agfl blocks */
                fino_bno++;
+       }
 
        /*
         * If the log is allocated in the first allocation group we need to