]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: online repair of the realtime rmap btree
authorDarrick J. Wong <djwong@kernel.org>
Mon, 24 Feb 2025 18:21:50 +0000 (10:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:15:58 +0000 (09:15 -0800)
Source kernel commit: 6a849bd81b69ccbda5b766cc700f0be86194e4d1

Repair the realtime rmap btree while mounted.  Similar to the regular
rmap btree repair code, we walk the data fork mappings of every realtime
file in the filesystem to collect reverse-mapping records in an xfarray.
Then we sort the xfarray, and use the btree bulk loader to create a new
rtrmap btree ondisk.  Finally, we swap the btree roots, and reap the old
blocks in the usual way.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_btree_staging.c
libxfs/xfs_rtrmap_btree.c
libxfs/xfs_rtrmap_btree.h

index b3afb4a142a5e014312b0d9d3d99cd165350b705..d82665ef78398ec06dcd7922da7f010f5afcd317 100644 (file)
@@ -134,6 +134,7 @@ xfs_btree_stage_ifakeroot(
        cur->bc_ino.ifake = ifake;
        cur->bc_nlevels = ifake->if_levels;
        cur->bc_ino.forksize = ifake->if_fork_size;
+       cur->bc_ino.whichfork = XFS_STAGING_FORK;
        cur->bc_flags |= XFS_BTREE_STAGING;
 }
 
index 387c9f17118d521ef3d784c36ea26e5d81c9552f..ac51e736e7e48969050c6e77636ea2525d455f1b 100644 (file)
@@ -658,7 +658,7 @@ xfs_rtrmapbt_compute_maxlevels(
 }
 
 /* Calculate the rtrmap btree size for some records. */
-static unsigned long long
+unsigned long long
 xfs_rtrmapbt_calc_size(
        struct xfs_mount        *mp,
        unsigned long long      len)
index bf73460be274d194943e9e0105428728aa249750..ad76ac7938b602eab8f30a20912fd5b908641795 100644 (file)
@@ -198,4 +198,7 @@ int xfs_rtrmapbt_create(struct xfs_rtgroup *rtg, struct xfs_inode *ip,
 int xfs_rtrmapbt_init_rtsb(struct xfs_mount *mp, struct xfs_rtgroup *rtg,
                struct xfs_trans *tp);
 
+unsigned long long xfs_rtrmapbt_calc_size(struct xfs_mount *mp,
+               unsigned long long len);
+
 #endif /* __XFS_RTRMAP_BTREE_H__ */