From: Darrick J. Wong <djwong@xxxxxxxxxx> In keep_fsinos, mark the root of the metadata directory tree as inuse. The realtime bitmap and summary files still come after the root directories, so this is a fairly simple change to the loop test. Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> --- repair/phase5.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/repair/phase5.c b/repair/phase5.c index 86b1f681a72bb8..a5e19998b97061 100644 --- a/repair/phase5.c +++ b/repair/phase5.c @@ -419,13 +419,18 @@ static void keep_fsinos(xfs_mount_t *mp) { ino_tree_node_t *irec; - int i; + unsigned int inuse = xfs_rootrec_inodes_inuse(mp), i; irec = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, mp->m_sb.sb_rootino), XFS_INO_TO_AGINO(mp, mp->m_sb.sb_rootino)); - for (i = 0; i < 3; i++) + for (i = 0; i < inuse; i++) { set_inode_used(irec, i); + + /* Everything after the root dir is metadata */ + if (i) + set_inode_is_meta(irec, i); + } } static void