]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: adjust keep_fsinos to handle metadata directories
authorDarrick J. Wong <djwong@kernel.org>
Thu, 21 Nov 2024 00:24:20 +0000 (16:24 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 24 Dec 2024 02:01:28 +0000 (18:01 -0800)
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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
repair/phase5.c

index 86b1f681a72bb8c7b8f87c46ce44ffa8026c5a5d..a5e19998b9706165e595fc96e3e906ebffba6c94 100644 (file)
@@ -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