From: Darrick J. Wong <djwong@xxxxxxxxxx> Now that the incore structures handle more than 2^32 records correctly, fix the rmapbt generation code to handle that many records. This fixes the problem where an extremely large rmapbt cannot be rebuilt properly because of integer truncation. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> --- repair/rmap.c | 8 ++++---- repair/rmap.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/repair/rmap.c b/repair/rmap.c index a2291c7b3..c908429c9 100644 --- a/repair/rmap.c +++ b/repair/rmap.c @@ -283,7 +283,7 @@ rmap_fold_raw_recs( { struct xfs_slab_cursor *cur = NULL; struct xfs_rmap_irec *prev, *rec; - size_t old_sz; + uint64_t old_sz; int error = 0; old_sz = slab_count(ag_rmaps[agno].ar_rmaps); @@ -690,7 +690,7 @@ mark_inode_rl( struct xfs_rmap_irec *rmap; struct ino_tree_node *irec; int off; - size_t idx; + uint64_t idx; xfs_agino_t ino; if (bag_count(rmaps) < 2) @@ -873,9 +873,9 @@ compute_refcounts( /* * Return the number of rmap objects for an AG. */ -size_t +uint64_t rmap_record_count( - struct xfs_mount *mp, + struct xfs_mount *mp, xfs_agnumber_t agno) { return slab_count(ag_rmaps[agno].ar_rmaps); diff --git a/repair/rmap.h b/repair/rmap.h index 1dad2f589..b074e2e87 100644 --- a/repair/rmap.h +++ b/repair/rmap.h @@ -26,7 +26,7 @@ extern bool rmaps_are_mergeable(struct xfs_rmap_irec *r1, struct xfs_rmap_irec * extern int rmap_add_fixed_ag_rec(struct xfs_mount *, xfs_agnumber_t); extern int rmap_store_ag_btree_rec(struct xfs_mount *, xfs_agnumber_t); -extern size_t rmap_record_count(struct xfs_mount *, xfs_agnumber_t); +uint64_t rmap_record_count(struct xfs_mount *mp, xfs_agnumber_t agno); extern int rmap_init_cursor(xfs_agnumber_t, struct xfs_slab_cursor **); extern void rmap_avoid_check(void); void rmaps_verify_btree(struct xfs_mount *mp, xfs_agnumber_t agno);