Commit 6e1d7b89 authored by Chandan Babu R's avatar Chandan Babu R
Browse files

Merge tag 'repair-ag-btrees-6.8_2023-12-15' of...

Merge tag 'repair-ag-btrees-6.8_2023-12-15' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux

 into xfs-6.8-mergeB

xfs: online repair of AG btrees

Now that we've spent a lot of time reworking common code in online fsck,
we're ready to start rebuilding the AG space btrees.  This series
implements repair functions for the free space, inode, and refcount
btrees.  Rebuilding the reverse mapping btree is much more intense and
is left for a subsequent patchset.  The fstests counterpart of this
patchset implements stress testing of repair.

Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>

* tag 'repair-ag-btrees-6.8_2023-12-15' of https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux:
  xfs: repair refcount btrees
  xfs: repair inode btrees
  xfs: repair free space btrees
  xfs: remove trivial bnobt/inobt scrub helpers
  xfs: roll the scrub transaction after completing a repair
  xfs: move the per-AG datatype bitmaps to separate files
  xfs: create separate structures and code for u32 bitmaps
parents 5e60ca3f 9099cd38
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -145,6 +145,7 @@ ifeq ($(CONFIG_XFS_ONLINE_SCRUB),y)

xfs-y				+= $(addprefix scrub/, \
				   trace.o \
				   agb_bitmap.o \
				   agheader.o \
				   alloc.o \
				   attr.o \
@@ -181,8 +182,11 @@ xfs-$(CONFIG_XFS_QUOTA) += scrub/quota.o
ifeq ($(CONFIG_XFS_ONLINE_REPAIR),y)
xfs-y				+= $(addprefix scrub/, \
				   agheader_repair.o \
				   alloc_repair.o \
				   ialloc_repair.o \
				   newbt.o \
				   reap.o \
				   refcount_repair.o \
				   repair.o \
				   )
endif
+10 −0
Original line number Diff line number Diff line
@@ -80,6 +80,16 @@ struct xfs_perag {
	 */
	uint16_t	pag_checked;
	uint16_t	pag_sick;

#ifdef CONFIG_XFS_ONLINE_REPAIR
	/*
	 * Alternate btree heights so that online repair won't trip the write
	 * verifiers while rebuilding the AG btrees.
	 */
	uint8_t		pagf_repair_levels[XFS_BTNUM_AGF];
	uint8_t		pagf_repair_refcount_level;
#endif

	spinlock_t	pag_state_lock;

	spinlock_t	pagb_lock;	/* lock for pagb_tree */
+2 −0
Original line number Diff line number Diff line
@@ -411,6 +411,8 @@ xfs_ag_resv_free_extent(
		fallthrough;
	case XFS_AG_RESV_NONE:
		xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (int64_t)len);
		fallthrough;
	case XFS_AG_RESV_IGNORE:
		return;
	}

+4 −6
Original line number Diff line number Diff line
@@ -246,11 +246,9 @@ xfs_alloc_btrec_to_irec(
/* Simple checks for free space records. */
xfs_failaddr_t
xfs_alloc_check_irec(
	struct xfs_btree_cur		*cur,
	struct xfs_perag			*pag,
	const struct xfs_alloc_rec_incore	*irec)
{
	struct xfs_perag		*pag = cur->bc_ag.pag;

	if (irec->ar_blockcount == 0)
		return __this_address;

@@ -299,7 +297,7 @@ xfs_alloc_get_rec(
		return error;

	xfs_alloc_btrec_to_irec(rec, &irec);
	fa = xfs_alloc_check_irec(cur, &irec);
	fa = xfs_alloc_check_irec(cur->bc_ag.pag, &irec);
	if (fa)
		return xfs_alloc_complain_bad_rec(cur, fa, &irec);

@@ -3944,7 +3942,7 @@ xfs_alloc_query_range_helper(
	xfs_failaddr_t				fa;

	xfs_alloc_btrec_to_irec(rec, &irec);
	fa = xfs_alloc_check_irec(cur, &irec);
	fa = xfs_alloc_check_irec(cur->bc_ag.pag, &irec);
	if (fa)
		return xfs_alloc_complain_bad_rec(cur, fa, &irec);

+1 −1
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ xfs_alloc_get_rec(
union xfs_btree_rec;
void xfs_alloc_btrec_to_irec(const union xfs_btree_rec *rec,
		struct xfs_alloc_rec_incore *irec);
xfs_failaddr_t xfs_alloc_check_irec(struct xfs_btree_cur *cur,
xfs_failaddr_t xfs_alloc_check_irec(struct xfs_perag *pag,
		const struct xfs_alloc_rec_incore *irec);

int xfs_read_agf(struct xfs_perag *pag, struct xfs_trans *tp, int flags,
Loading