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>
{
__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;
*/
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++;
}
/*
continue;
nfinos += rec_nfinos;
- ninos += XFS_INODES_PER_CHUNK;
+ ninos += rec_ninos;
num_recs++;
}