Commit 8defee8d authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: online repair of realtime bitmaps for a realtime group



For a given rt group, regenerate the bitmap contents from the group's
realtime rmap btree.

Signed-off-by: default avatar"Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 3dd3aba6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -135,6 +135,15 @@ xfs_rtb_to_rtx(
	return div_u64(rtbno, mp->m_sb.sb_rextsize);
}

/* Return the offset of a rtgroup block number within an rt extent. */
static inline xfs_extlen_t
xfs_rgbno_to_rtxoff(
	struct xfs_mount	*mp,
	xfs_rgblock_t		rgbno)
{
	return rgbno % mp->m_sb.sb_rextsize;
}

/* Return the offset of an rt block number within an rt extent. */
static inline xfs_extlen_t
xfs_rtb_to_rtxoff(
+6 −0
Original line number Diff line number Diff line
@@ -264,6 +264,12 @@ int xchk_metadata_inode_forks(struct xfs_scrub *sc);
			(sc)->mp->m_super->s_id, \
			(sc)->ip ? (sc)->ip->i_ino : (sc)->sm->sm_ino, \
			##__VA_ARGS__)
#define xchk_xfile_rtgroup_descr(sc, fmt, ...) \
	kasprintf(XCHK_GFP_FLAGS, "XFS (%s): rtgroup 0x%x " fmt, \
			(sc)->mp->m_super->s_id, \
			(sc)->sa.pag ? \
				rtg_rgno((sc)->sr.rtg) : (sc)->sm->sm_agno, \
			##__VA_ARGS__)

/*
 * Setting up a hook to wait for intents to drain is costly -- we have to take
+1 −1
Original line number Diff line number Diff line
@@ -959,7 +959,7 @@ xrep_ag_init(

#ifdef CONFIG_XFS_RT
/* Initialize all the btree cursors for a RT repair. */
static void
void
xrep_rtgroup_btcur_init(
	struct xfs_scrub	*sc,
	struct xchk_rt		*sr)
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ int xrep_ag_init(struct xfs_scrub *sc, struct xfs_perag *pag,
#ifdef CONFIG_XFS_RT
int xrep_rtgroup_init(struct xfs_scrub *sc, struct xfs_rtgroup *rtg,
		struct xchk_rt *sr, unsigned int rtglock_flags);
void xrep_rtgroup_btcur_init(struct xfs_scrub *sc, struct xchk_rt *sr);
int xrep_require_rtext_inuse(struct xfs_scrub *sc, xfs_rgblock_t rgbno,
		xfs_filblks_t len);
#else
+4 −1
Original line number Diff line number Diff line
@@ -20,9 +20,11 @@
#include "xfs_sb.h"
#include "xfs_rmap.h"
#include "xfs_rtrmap_btree.h"
#include "xfs_exchmaps.h"
#include "scrub/scrub.h"
#include "scrub/common.h"
#include "scrub/repair.h"
#include "scrub/tempexch.h"
#include "scrub/rtbitmap.h"
#include "scrub/btree.h"

@@ -38,7 +40,8 @@ xchk_setup_rtbitmap(
	if (xchk_need_intent_drain(sc))
		xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN);

	rtb = kzalloc(sizeof(struct xchk_rtbitmap), XCHK_GFP_FLAGS);
	rtb = kzalloc(struct_size(rtb, words, xchk_rtbitmap_wordcnt(sc)),
			XCHK_GFP_FLAGS);
	if (!rtb)
		return -ENOMEM;
	sc->buf = rtb;
Loading