[PATCH 27/51] xfs_repair: fix fino_bno calculation when rmapbt is enabled

Darrick J. Wong
2015-10-07T05:08:14Z

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.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
repair/xfs_repair.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index 933986a..a464cd3 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -416,8 +416,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_ag_maxlevels);
fino_bno++;
+ }

/*
* If the log is allocated in the first allocation group we need to