xfs
[Top] [All Lists]

[PATCH 057/145] xfs_repair: fix fino_bno calculation when rmapbt is enab

To: david@xxxxxxxxxxxxx, darrick.wong@xxxxxxxxxx
Subject: [PATCH 057/145] xfs_repair: fix fino_bno calculation when rmapbt is enabled
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 16 Jun 2016 18:36:44 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <146612704434.16048.12932915166928562654.stgit@xxxxxxxxxxxxxxxx>
References: <146612704434.16048.12932915166928562654.stgit@xxxxxxxxxxxxxxxx>
User-agent: StGit/0.17.1-dirty
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@xxxxxxxxxx>
---
 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 709c0c3..3b63754 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -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);
                fino_bno++;
+       }
 
        /*
         * If the log is allocated in the first allocation group we need to

<Prev in Thread] Current Thread [Next in Thread>