]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_repair: support more than 2^32 rmapbt records per AG
authorDarrick J. Wong <djwong@djwong.org>
Mon, 15 Apr 2024 23:07:50 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:28 +0000 (14:06 -0700)
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@djwong.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
repair/rmap.c
repair/rmap.h

index a2291c7b3b015d9c5d77f8b25373c5ced1ca55a6..c908429c9bf75b494bf1fee449ad9721d7d0d3bc 100644 (file)
@@ -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 @@ err:
 /*
  * 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);
index 1dad2f5890a41762bca58c8b9e1a7e6da32c8fbb..b074e2e878603cd9111f5fa932d6d27319d7a83c 100644 (file)
@@ -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);