]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: do not account sparse inodes in phase 5 cursor init.
authorBrian Foster <bfoster@redhat.com>
Thu, 30 Jul 2015 23:18:22 +0000 (09:18 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 30 Jul 2015 23:18:22 +0000 (09:18 +1000)
The inode btrees are reconstructed in phase 5 of xfs_repair. The btree
cursor initialization counts the allocated and free inodes in the
in-core records and calculates the expected geometry of the resulting
btree. The free and total inode counts for each AG are also ultimately
aggregated to update the associated superblock counts.

Update init_ino_cursor() to not assume 64 inode records and not account
sparse inodes into the total or free inode count for each AG.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/phase5.c

index 04bf04982b8e3c728c8988803cada0310cd2c82a..30f2d05fa3b16af1f7a947f5e384630c276bba08 100644 (file)
@@ -899,7 +899,8 @@ init_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
 {
        __uint64_t              ninos;
        __uint64_t              nfinos;
-       __uint64_t              rec_nfinos;
+       int                     rec_nfinos;
+       int                     rec_ninos;
        ino_tree_node_t         *ino_rec;
        int                     num_recs;
        int                     level;
@@ -919,11 +920,19 @@ init_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
         */
        ino_rec = findfirst_inode_rec(agno);
        for (num_recs = 0; ino_rec != NULL; ino_rec = next_ino_rec(ino_rec))  {
+               rec_ninos = 0;
                rec_nfinos = 0;
                for (i = 0; i < XFS_INODES_PER_CHUNK; i++)  {
                        ASSERT(is_inode_confirmed(ino_rec, i));
+                       /*
+                        * sparse inodes are not factored into superblock (free)
+                        * inode counts
+                        */
+                       if (is_inode_sparse(ino_rec, i))
+                               continue;
                        if (is_inode_free(ino_rec, i))
                                rec_nfinos++;
+                       rec_ninos++;
                }
 
                /*
@@ -933,7 +942,7 @@ init_ino_cursor(xfs_mount_t *mp, xfs_agnumber_t agno, bt_status_t *btree_curs,
                        continue;
 
                nfinos += rec_nfinos;
-               ninos += XFS_INODES_PER_CHUNK;
+               ninos += rec_ninos;
                num_recs++;
        }