xfs
[Top] [All Lists]

[PATCH 23/28] repair: do not account sparse inodes in phase 5 cursor ini

To: xfs@xxxxxxxxxxx
Subject: [PATCH 23/28] repair: do not account sparse inodes in phase 5 cursor init.
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Tue, 2 Jun 2015 14:41:56 -0400
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1433270521-62026-1-git-send-email-bfoster@xxxxxxxxxx>
References: <1433270521-62026-1-git-send-email-bfoster@xxxxxxxxxx>
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@xxxxxxxxxx>
---
 repair/phase5.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/repair/phase5.c b/repair/phase5.c
index 04bf049..30f2d05 100644
--- a/repair/phase5.c
+++ b/repair/phase5.c
@@ -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++;
        }
 
-- 
1.9.3

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