Commit 6a849bd8 authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: online repair of the realtime rmap btree



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: default avatar"Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent c6904f67
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -234,6 +234,7 @@ xfs-y += $(addprefix scrub/, \

xfs-$(CONFIG_XFS_RT)		+= $(addprefix scrub/, \
				   rtbitmap_repair.o \
				   rtrmap_repair.o \
				   rtsummary_repair.o \
				   )

+1 −0
Original line number Diff line number Diff line
@@ -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;
}

+1 −1
Original line number Diff line number Diff line
@@ -660,7 +660,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)
+3 −0
Original line number Diff line number Diff line
@@ -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__ */
+2 −2
Original line number Diff line number Diff line
@@ -819,7 +819,7 @@ xchk_rtgroup_btcur_free(
 * Unlock the realtime group.  This must be done /after/ committing (or
 * cancelling) the scrub transaction.
 */
static void
void
xchk_rtgroup_unlock(
	struct xchk_rt		*sr)
{
@@ -904,7 +904,7 @@ int
xchk_setup_rt(
	struct xfs_scrub	*sc)
{
	return xchk_trans_alloc(sc, 0);
	return xchk_trans_alloc(sc, xrep_calc_rtgroup_resblks(sc));
}

/* Set us up with AG headers and btree cursors. */
Loading