]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_repair: adjust keep_fsinos to handle metadata directories
authorDarrick J. Wong <djwong@kernel.org>
Wed, 3 Jul 2024 21:21:55 +0000 (14:21 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:13:18 +0000 (17:13 -0700)
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@kernel.org>
repair/phase5.c

index 52666ad882331237a64c5f148711e2c576614474..51efcd6ca123b72a6a9989d79cff22868964d1ef 100644 (file)
@@ -419,13 +419,21 @@ static void
 keep_fsinos(xfs_mount_t *mp)
 {
        ino_tree_node_t         *irec;
-       int                     i;
+       int                     i, inuse = 3; /* root, rbm, rsum */
+
+       if (xfs_has_metadir(mp))
+               inuse++; /* root, metaroot, rbm, rsum */
 
        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