All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 2/4] xfs: repair the rmapbt
Date: Fri, 30 Dec 2022 14:13:30 -0800	[thread overview]
Message-ID: <167243841031.696748.2811249846332411168.stgit@magnolia> (raw)
In-Reply-To: <167243840997.696748.11741067698987523110.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

Rebuild the reverse mapping btree from all primary metadata.  This first
patch establishes the bare mechanics of finding records and putting
together a new ondisk tree; more complex pieces are needed to make it
work properly.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/Makefile                |    1 
 fs/xfs/libxfs/xfs_bmap.c       |   43 +
 fs/xfs/libxfs/xfs_bmap.h       |    8 
 fs/xfs/libxfs/xfs_rmap.c       |   22 -
 fs/xfs/libxfs/xfs_rmap.h       |    2 
 fs/xfs/libxfs/xfs_rmap_btree.c |   13 
 fs/xfs/scrub/bitmap.c          |   14 
 fs/xfs/scrub/bitmap.h          |    5 
 fs/xfs/scrub/common.c          |    4 
 fs/xfs/scrub/common.h          |    1 
 fs/xfs/scrub/newbt.c           |    5 
 fs/xfs/scrub/newbt.h           |    6 
 fs/xfs/scrub/reap.c            |    6 
 fs/xfs/scrub/repair.c          |    5 
 fs/xfs/scrub/repair.h          |    6 
 fs/xfs/scrub/rmap.c            |    9 
 fs/xfs/scrub/rmap_repair.c     | 1405 ++++++++++++++++++++++++++++++++++++++++
 fs/xfs/scrub/scrub.c           |    2 
 fs/xfs/scrub/trace.h           |   33 +
 19 files changed, 1572 insertions(+), 18 deletions(-)
 create mode 100644 fs/xfs/scrub/rmap_repair.c


diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile
index 7e1495465cec..78ea3a6a0f5b 100644
--- a/fs/xfs/Makefile
+++ b/fs/xfs/Makefile
@@ -195,6 +195,7 @@ xfs-y				+= $(addprefix scrub/, \
 				   reap.o \
 				   refcount_repair.o \
 				   repair.o \
+				   rmap_repair.o \
 				   xfbtree.o \
 				   )
 
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 89cbd9b563ff..89fd34fbae7a 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -6406,3 +6406,46 @@ xfs_bunmapi_range(
 out:
 	return error;
 }
+
+struct xfs_bmap_query_range {
+	xfs_bmap_query_range_fn	fn;
+	void			*priv;
+};
+
+/* Format btree record and pass to our callback. */
+STATIC int
+xfs_bmap_query_range_helper(
+	struct xfs_btree_cur		*cur,
+	const union xfs_btree_rec	*rec,
+	void				*priv)
+{
+	struct xfs_bmap_query_range	*query = priv;
+	struct xfs_bmbt_irec		irec;
+	xfs_failaddr_t			fa;
+
+	xfs_bmbt_disk_get_all(&rec->bmbt, &irec);
+	fa = xfs_bmap_validate_extent(cur->bc_ino.ip, cur->bc_ino.whichfork,
+			&irec);
+	if (fa) {
+		xfs_btree_mark_sick(cur);
+		return xfs_bmap_complain_bad_rec(cur->bc_ino.ip,
+				cur->bc_ino.whichfork, fa, &irec);
+	}
+
+	return query->fn(cur, &irec, query->priv);
+}
+
+/* Find all bmaps. */
+int
+xfs_bmap_query_all(
+	struct xfs_btree_cur		*cur,
+	xfs_bmap_query_range_fn		fn,
+	void				*priv)
+{
+	struct xfs_bmap_query_range	query = {
+		.priv			= priv,
+		.fn			= fn,
+	};
+
+	return xfs_btree_query_all(cur, xfs_bmap_query_range_helper, &query);
+}
diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
index 1201ee024c1f..bbda4a77cb69 100644
--- a/fs/xfs/libxfs/xfs_bmap.h
+++ b/fs/xfs/libxfs/xfs_bmap.h
@@ -274,4 +274,12 @@ extern struct kmem_cache	*xfs_bmap_intent_cache;
 int __init xfs_bmap_intent_init_cache(void);
 void xfs_bmap_intent_destroy_cache(void);
 
+typedef int (*xfs_bmap_query_range_fn)(
+	struct xfs_btree_cur	*cur,
+	struct xfs_bmbt_irec	*rec,
+	void			*priv);
+
+int xfs_bmap_query_all(struct xfs_btree_cur *cur, xfs_bmap_query_range_fn fn,
+		void *priv);
+
 #endif	/* __XFS_BMAP_H__ */
diff --git a/fs/xfs/libxfs/xfs_rmap.c b/fs/xfs/libxfs/xfs_rmap.c
index a30602660669..16233bb5be7e 100644
--- a/fs/xfs/libxfs/xfs_rmap.c
+++ b/fs/xfs/libxfs/xfs_rmap.c
@@ -212,13 +212,12 @@ xfs_rmap_btrec_to_irec(
 			irec);
 }
 
-/* Simple checks for rmap records. */
-xfs_failaddr_t
-xfs_rmap_check_irec(
-	struct xfs_btree_cur		*cur,
+inline xfs_failaddr_t
+xfs_rmap_check_perag_irec(
+	struct xfs_perag		*pag,
 	const struct xfs_rmap_irec	*irec)
 {
-	struct xfs_mount		*mp = cur->bc_mp;
+	struct xfs_mount		*mp = pag->pag_mount;
 	bool				is_inode;
 	bool				is_unwritten;
 	bool				is_bmbt;
@@ -233,8 +232,8 @@ xfs_rmap_check_irec(
 			return __this_address;
 	} else {
 		/* check for valid extent range, including overflow */
-		if (!xfs_verify_agbext(cur->bc_ag.pag, irec->rm_startblock,
-						       irec->rm_blockcount))
+		if (!xfs_verify_agbext(pag, irec->rm_startblock,
+					    irec->rm_blockcount))
 			return __this_address;
 	}
 
@@ -269,6 +268,15 @@ xfs_rmap_check_irec(
 	return NULL;
 }
 
+/* Simple checks for rmap records. */
+xfs_failaddr_t
+xfs_rmap_check_irec(
+	struct xfs_btree_cur		*cur,
+	const struct xfs_rmap_irec	*irec)
+{
+	return xfs_rmap_check_perag_irec(cur->bc_ag.pag, irec);
+}
+
 static inline int
 xfs_rmap_complain_bad_rec(
 	struct xfs_btree_cur		*cur,
diff --git a/fs/xfs/libxfs/xfs_rmap.h b/fs/xfs/libxfs/xfs_rmap.h
index ced605d69324..b7ad51055e13 100644
--- a/fs/xfs/libxfs/xfs_rmap.h
+++ b/fs/xfs/libxfs/xfs_rmap.h
@@ -195,6 +195,8 @@ int xfs_rmap_compare(const struct xfs_rmap_irec *a,
 union xfs_btree_rec;
 xfs_failaddr_t xfs_rmap_btrec_to_irec(const union xfs_btree_rec *rec,
 		struct xfs_rmap_irec *irec);
+xfs_failaddr_t xfs_rmap_check_perag_irec(struct xfs_perag *pag,
+		const struct xfs_rmap_irec *irec);
 xfs_failaddr_t xfs_rmap_check_irec(struct xfs_btree_cur *cur,
 		const struct xfs_rmap_irec *irec);
 
diff --git a/fs/xfs/libxfs/xfs_rmap_btree.c b/fs/xfs/libxfs/xfs_rmap_btree.c
index 5583dbe43bb5..103e4c97badc 100644
--- a/fs/xfs/libxfs/xfs_rmap_btree.c
+++ b/fs/xfs/libxfs/xfs_rmap_btree.c
@@ -342,7 +342,18 @@ xfs_rmapbt_verify(
 
 	level = be16_to_cpu(block->bb_level);
 	if (pag && pag->pagf_init) {
-		if (level >= pag->pagf_levels[XFS_BTNUM_RMAPi])
+		unsigned int	maxlevel = pag->pagf_levels[XFS_BTNUM_RMAPi];
+
+#ifdef CONFIG_XFS_ONLINE_REPAIR
+		/*
+		 * Online repair could be rewriting the free space btrees, so
+		 * we'll validate against the larger of either tree while this
+		 * is going on.
+		 */
+		maxlevel = max_t(unsigned int, maxlevel,
+				pag->pagf_alt_levels[XFS_BTNUM_RMAPi]);
+#endif
+		if (level >= maxlevel)
 			return __this_address;
 	} else if (level >= mp->m_rmap_maxlevels)
 		return __this_address;
diff --git a/fs/xfs/scrub/bitmap.c b/fs/xfs/scrub/bitmap.c
index c98f4c45414a..7aeeb42a809f 100644
--- a/fs/xfs/scrub/bitmap.c
+++ b/fs/xfs/scrub/bitmap.c
@@ -407,3 +407,17 @@ xbitmap_take_first_set(
 	*valp = val;
 	return 0;
 }
+
+/* Count the number of set regions in this bitmap. */
+uint64_t
+xbitmap_count_set_regions(
+	struct xbitmap		*bitmap)
+{
+	struct xbitmap_node	*bn;
+	uint64_t		nr = 0;
+
+	for_each_xbitmap_extent(bn, bitmap)
+		nr++;
+
+	return nr;
+}
diff --git a/fs/xfs/scrub/bitmap.h b/fs/xfs/scrub/bitmap.h
index 1ebe1918bdb2..d59d5e76782c 100644
--- a/fs/xfs/scrub/bitmap.h
+++ b/fs/xfs/scrub/bitmap.h
@@ -31,6 +31,7 @@ int xbitmap_walk(struct xbitmap *bitmap, xbitmap_walk_fn fn,
 
 bool xbitmap_empty(struct xbitmap *bitmap);
 bool xbitmap_test(struct xbitmap *bitmap, uint64_t start, uint64_t *len);
+uint64_t xbitmap_count_set_regions(struct xbitmap *bitmap);
 
 int xbitmap_take_first_set(struct xbitmap *bitmap, uint64_t start,
 		uint64_t last, uint64_t *valp);
@@ -86,6 +87,10 @@ static inline int xagb_bitmap_disunion(struct xagb_bitmap *bitmap,
 	return xbitmap_disunion(&bitmap->agbitmap, &sub->agbitmap);
 }
 
+static inline uint32_t xagb_bitmap_count_set_regions(struct xagb_bitmap *bitmap)
+{
+	return xbitmap_count_set_regions(&bitmap->agbitmap);
+}
 static inline uint32_t xagb_bitmap_hweight(struct xagb_bitmap *bitmap)
 {
 	return xbitmap_hweight(&bitmap->agbitmap);
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index d96355ca4175..c436d613521c 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -461,7 +461,7 @@ xchk_perag_read_headers(
  * Grab the AG headers for the attached perag structure and wait for pending
  * intents to drain.
  */
-static int
+int
 xchk_perag_lock(
 	struct xfs_scrub	*sc)
 {
@@ -705,7 +705,7 @@ xchk_trans_alloc(
 		return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate,
 				resblks, 0, 0, &sc->tp);
 
-	return xfs_trans_alloc_empty(sc->mp, &sc->tp);
+	return xchk_trans_alloc_empty(sc);
 }
 
 /* Set us up with a transaction and an empty context. */
diff --git a/fs/xfs/scrub/common.h b/fs/xfs/scrub/common.h
index 6992e3db5f11..9bdacce17d82 100644
--- a/fs/xfs/scrub/common.h
+++ b/fs/xfs/scrub/common.h
@@ -134,6 +134,7 @@ int xchk_setup_nlinks(struct xfs_scrub *sc);
 void xchk_ag_free(struct xfs_scrub *sc, struct xchk_ag *sa);
 int xchk_ag_init(struct xfs_scrub *sc, xfs_agnumber_t agno,
 		struct xchk_ag *sa);
+int xchk_perag_lock(struct xfs_scrub *sc);
 
 /*
  * Grab all AG resources, treating the inability to grab the perag structure as
diff --git a/fs/xfs/scrub/newbt.c b/fs/xfs/scrub/newbt.c
index efa73f676ad4..ebdfdf631be3 100644
--- a/fs/xfs/scrub/newbt.c
+++ b/fs/xfs/scrub/newbt.c
@@ -342,7 +342,10 @@ xrep_newbt_alloc_blocks(
 			.resv		= xnr->resv,
 		};
 
-		error = xfs_alloc_vextent(&args);
+		if (xnr->alloc_vextent)
+			error = xnr->alloc_vextent(sc, &args);
+		else
+			error = xfs_alloc_vextent(&args);
 		if (error)
 			return error;
 		if (args.fsbno == NULLFSBLOCK)
diff --git a/fs/xfs/scrub/newbt.h b/fs/xfs/scrub/newbt.h
index 96ae0dc3bc41..95fea3dd5211 100644
--- a/fs/xfs/scrub/newbt.h
+++ b/fs/xfs/scrub/newbt.h
@@ -6,6 +6,8 @@
 #ifndef __XFS_SCRUB_NEWBT_H__
 #define __XFS_SCRUB_NEWBT_H__
 
+struct xfs_alloc_arg;
+
 struct xrep_newbt_resv {
 	/* Link to list of extents that we've reserved. */
 	struct list_head	list;
@@ -28,6 +30,10 @@ struct xrep_newbt_resv {
 struct xrep_newbt {
 	struct xfs_scrub	*sc;
 
+	/* Custom allocation function, or NULL for xfs_alloc_vextent */
+	int			(*alloc_vextent)(struct xfs_scrub *sc,
+						 struct xfs_alloc_arg *args);
+
 	/* List of extents that we've reserved. */
 	struct list_head	resv_list;
 
diff --git a/fs/xfs/scrub/reap.c b/fs/xfs/scrub/reap.c
index 79d43b9448a3..ea7a274aa778 100644
--- a/fs/xfs/scrub/reap.c
+++ b/fs/xfs/scrub/reap.c
@@ -111,7 +111,7 @@ xreap_put_freelist(
 	int			error;
 
 	/* Make sure there's space on the freelist. */
-	error = xrep_fix_freelist(sc, true);
+	error = xrep_fix_freelist(sc, 0);
 	if (error)
 		return error;
 
@@ -363,10 +363,14 @@ xreap_agextent(
 		rs->force_roll = true;
 		break;
 	case XFS_AG_RESV_IGNORE:
+	case XFS_AG_RESV_RMAPBT:
 		/*
 		 * bnobt/cntbt blocks are counted as free space, so we pass
 		 * XFS_AG_RESV_IGNORE when reaping the old free space btree
 		 * blocks to avoid changing fdblocks.
+		 *
+		 * rmapbt blocks are also counted as free space, but they have
+		 * their own per-AG reservation type.
 		 */
 		error = __xfs_free_extent(sc->tp, sc->sa.pag, agbno, *aglenp,
 				rs->oinfo, rs->resv, true);
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
index 1862e05e398f..7c242fddac8a 100644
--- a/fs/xfs/scrub/repair.c
+++ b/fs/xfs/scrub/repair.c
@@ -392,7 +392,7 @@ xrep_calc_ag_resblks(
 int
 xrep_fix_freelist(
 	struct xfs_scrub	*sc,
-	bool			can_shrink)
+	int			alloc_flags)
 {
 	struct xfs_alloc_arg	args = {0};
 
@@ -402,8 +402,7 @@ xrep_fix_freelist(
 	args.alignment = 1;
 	args.pag = sc->sa.pag;
 
-	return xfs_alloc_fix_freelist(&args,
-			can_shrink ? 0 : XFS_ALLOC_FLAG_NOSHRINK);
+	return xfs_alloc_fix_freelist(&args, alloc_flags);
 }
 
 /*
diff --git a/fs/xfs/scrub/repair.h b/fs/xfs/scrub/repair.h
index 5e3e6cfe3332..22e8e1ed2de2 100644
--- a/fs/xfs/scrub/repair.h
+++ b/fs/xfs/scrub/repair.h
@@ -41,7 +41,7 @@ struct xbitmap;
 struct xagb_bitmap;
 struct xfsb_bitmap;
 
-int xrep_fix_freelist(struct xfs_scrub *sc, bool can_shrink);
+int xrep_fix_freelist(struct xfs_scrub *sc, int alloc_flags);
 
 struct xrep_find_ag_btree {
 	/* in: rmap owner of the btree we're looking for */
@@ -76,6 +76,7 @@ int xrep_ino_ensure_extent_count(struct xfs_scrub *sc, int whichfork,
 int xrep_reset_perag_resv(struct xfs_scrub *sc);
 int xrep_bmap(struct xfs_scrub *sc, int whichfork, bool allow_unwritten);
 int xrep_metadata_inode_forks(struct xfs_scrub *sc);
+int xrep_setup_ag_rmapbt(struct xfs_scrub *sc);
 
 /* Repair setup functions */
 int xrep_setup_ag_allocbt(struct xfs_scrub *sc);
@@ -102,6 +103,7 @@ int xrep_agfl(struct xfs_scrub *sc);
 int xrep_agi(struct xfs_scrub *sc);
 int xrep_allocbt(struct xfs_scrub *sc);
 int xrep_iallocbt(struct xfs_scrub *sc);
+int xrep_rmapbt(struct xfs_scrub *sc);
 int xrep_refcountbt(struct xfs_scrub *sc);
 int xrep_inode(struct xfs_scrub *sc);
 int xrep_bmap_data(struct xfs_scrub *sc);
@@ -167,6 +169,7 @@ xrep_setup_nothing(
 	return 0;
 }
 #define xrep_setup_ag_allocbt		xrep_setup_nothing
+#define xrep_setup_ag_rmapbt		xrep_setup_nothing
 
 #define xrep_setup_inode(sc, imap)	((void)0)
 
@@ -185,6 +188,7 @@ static inline int xrep_setup_rtbitmap(struct xfs_scrub *sc, unsigned int *x)
 #define xrep_agi			xrep_notsupported
 #define xrep_allocbt			xrep_notsupported
 #define xrep_iallocbt			xrep_notsupported
+#define xrep_rmapbt			xrep_notsupported
 #define xrep_refcountbt			xrep_notsupported
 #define xrep_inode			xrep_notsupported
 #define xrep_bmap_data			xrep_notsupported
diff --git a/fs/xfs/scrub/rmap.c b/fs/xfs/scrub/rmap.c
index 8f1fdae71766..2ed0b877056a 100644
--- a/fs/xfs/scrub/rmap.c
+++ b/fs/xfs/scrub/rmap.c
@@ -24,6 +24,7 @@
 #include "scrub/common.h"
 #include "scrub/btree.h"
 #include "scrub/bitmap.h"
+#include "scrub/repair.h"
 
 /*
  * Set us up to scrub reverse mapping btrees.
@@ -35,6 +36,14 @@ xchk_setup_ag_rmapbt(
 	if (xchk_need_fshook_drain(sc))
 		xchk_fshooks_enable(sc, XCHK_FSHOOKS_DRAIN);
 
+	if (xchk_could_repair(sc)) {
+		int		error;
+
+		error = xrep_setup_ag_rmapbt(sc);
+		if (error)
+			return error;
+	}
+
 	return xchk_setup_ag_btree(sc, false);
 }
 
diff --git a/fs/xfs/scrub/rmap_repair.c b/fs/xfs/scrub/rmap_repair.c
new file mode 100644
index 000000000000..952dae473d4d
--- /dev/null
+++ b/fs/xfs/scrub/rmap_repair.c
@@ -0,0 +1,1405 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2022 Oracle.  All Rights Reserved.
+ * Author: Darrick J. Wong <djwong@kernel.org>
+ */
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_shared.h"
+#include "xfs_format.h"
+#include "xfs_trans_resv.h"
+#include "xfs_mount.h"
+#include "xfs_defer.h"
+#include "xfs_btree.h"
+#include "xfs_btree_staging.h"
+#include "xfs_bit.h"
+#include "xfs_log_format.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
+#include "xfs_alloc.h"
+#include "xfs_alloc_btree.h"
+#include "xfs_ialloc.h"
+#include "xfs_ialloc_btree.h"
+#include "xfs_rmap.h"
+#include "xfs_rmap_btree.h"
+#include "xfs_inode.h"
+#include "xfs_icache.h"
+#include "xfs_bmap.h"
+#include "xfs_bmap_btree.h"
+#include "xfs_refcount.h"
+#include "xfs_refcount_btree.h"
+#include "xfs_ag.h"
+#include "scrub/xfs_scrub.h"
+#include "scrub/scrub.h"
+#include "scrub/common.h"
+#include "scrub/btree.h"
+#include "scrub/trace.h"
+#include "scrub/repair.h"
+#include "scrub/bitmap.h"
+#include "scrub/xfile.h"
+#include "scrub/xfarray.h"
+#include "scrub/iscan.h"
+#include "scrub/newbt.h"
+#include "scrub/reap.h"
+
+/*
+ * Reverse Mapping Btree Repair
+ * ============================
+ *
+ * This is the most involved of all the AG space btree rebuilds.  Everywhere
+ * else in XFS we lock inodes and then AG data structures, but generating the
+ * list of rmap records requires that we be able to scan both block mapping
+ * btrees of every inode in the filesystem to see if it owns any extents in
+ * this AG.  We can't tolerate any inode updates while we do this, so we
+ * freeze the filesystem to lock everyone else out, and grant ourselves
+ * special privileges to run transactions with regular background reclamation
+ * turned off.
+ *
+ * We also have to be very careful not to allow inode reclaim to start a
+ * transaction because all transactions (other than our own) will block.
+ * Deferred inode inactivation helps us out there.
+ *
+ * I) Reverse mappings for all non-space metadata and file data are collected
+ * according to the following algorithm:
+ *
+ * 1. For each fork of each inode:
+ * 1.1. Create a bitmap BMBIT to track bmbt blocks if necessary.
+ * 1.2. If the incore extent map isn't loaded, walk the bmbt to accumulate
+ *      bmaps into rmap records (see 1.1.4).  Set bits in BMBIT for each btree
+ *      block.
+ * 1.3. If the incore extent map is loaded but the fork is in btree format,
+ *      just visit the bmbt blocks to set the corresponding BMBIT areas.
+ * 1.4. From the incore extent map, accumulate each bmap that falls into our
+ *      target AG.  Remember, multiple bmap records can map to a single rmap
+ *      record, so we cannot simply emit rmap records 1:1.
+ * 1.5. Emit rmap records for each extent in BMBIT and free it.
+ * 2. Create bitmaps INOBIT and ICHUNKBIT.
+ * 3. For each record in the inobt, set the corresponding areas in ICHUNKBIT,
+ *    and set bits in INOBIT for each btree block.  If the inobt has no records
+ *    at all, we must be careful to record its root in INOBIT.
+ * 4. For each block in the finobt, set the corresponding INOBIT area.
+ * 5. Emit rmap records for each extent in INOBIT and ICHUNKBIT and free them.
+ * 6. Create bitmaps REFCBIT and COWBIT.
+ * 7. For each CoW staging extent in the refcountbt, set the corresponding
+ *    areas in COWBIT.
+ * 8. For each block in the refcountbt, set the corresponding REFCBIT area.
+ * 9. Emit rmap records for each extent in REFCBIT and COWBIT and free them.
+ * A. Emit rmap for the AG headers.
+ * B. Emit rmap for the log, if there is one.
+ *
+ * II) The rmapbt shape and space metadata rmaps are computed as follows:
+ *
+ * 1. Count the rmaps collected in the previous step. (= NR)
+ * 2. Estimate the number of rmapbt blocks needed to store NR records. (= RMB)
+ * 3. Reserve RMB blocks through the newbt using the allocator in normap mode.
+ * 4. Create bitmap AGBIT.
+ * 5. For each reservation in the newbt, set the corresponding areas in AGBIT.
+ * 6. For each block in the AGFL, bnobt, and cntbt, set the bits in AGBIT.
+ * 7. Count the extents in AGBIT. (= AGNR)
+ * 8. Estimate the number of rmapbt blocks needed for NR + AGNR rmaps. (= RMB')
+ * 9. If RMB' >= RMB, reserve RMB' - RMB more newbt blocks, set RMB = RMB',
+ *    and clear AGBIT.  Go to step 5.
+ * A. Emit rmaps for each extent in AGBIT.
+ *
+ * III) The rmapbt is constructed and set in place as follows:
+ *
+ * 1. Sort the rmap records.
+ * 2. Bulk load the rmaps.
+ *
+ * IV) Reap the old btree blocks.
+ *
+ * 1. Create a bitmap OLDRMBIT.
+ * 2. For each gap in the new rmapbt, set the corresponding areas of OLDRMBIT.
+ * 3. For each extent in the bnobt, clear the corresponding parts of OLDRMBIT.
+ * 4. Reap the extents corresponding to the set areas in OLDRMBIT.  These are
+ *    the parts of the AG that the rmap didn't find during its scan of the
+ *    primary metadata and aren't known to be in the free space, which implies
+ *    that they were the old rmapbt blocks.
+ * 5. Commit.
+ *
+ * We use the 'xrep_rmap' prefix for all the rmap functions.
+ */
+
+/* Set us up to repair reverse mapping btrees. */
+int
+xrep_setup_ag_rmapbt(
+	struct xfs_scrub	*sc)
+{
+	/* For now this is a placeholder until we land other pieces. */
+	return 0;
+}
+
+/*
+ * Packed rmap record.  The ATTR/BMBT/UNWRITTEN flags are hidden in the upper
+ * bits of offset, just like the on-disk record.
+ */
+struct xrep_rmap_extent {
+	xfs_agblock_t	startblock;
+	xfs_extlen_t	blockcount;
+	uint64_t	owner;
+	uint64_t	offset;
+} __packed;
+
+/* Context for collecting rmaps */
+struct xrep_rmap {
+	/* new rmapbt information */
+	struct xrep_newbt	new_btree;
+
+	/* rmap records generated from primary metadata */
+	struct xfarray		*rmap_records;
+
+	struct xfs_scrub	*sc;
+
+	/* get_records()'s position in the rmap record array. */
+	xfarray_idx_t		array_cur;
+
+	/* inode scan cursor */
+	struct xchk_iscan	iscan;
+
+	/* bnobt/cntbt contribution to btreeblks */
+	xfs_agblock_t		freesp_btblocks;
+
+	/* old agf_rmap_blocks counter */
+	unsigned int		old_rmapbt_fsbcount;
+};
+
+/* Make sure there's nothing funny about this mapping. */
+STATIC int
+xrep_rmap_check_mapping(
+	struct xfs_scrub	*sc,
+	const struct xfs_rmap_irec *rec)
+{
+	enum xbtree_recpacking	outcome;
+	int			error;
+
+	if (xfs_rmap_check_perag_irec(sc->sa.pag, rec) != NULL)
+		return -EFSCORRUPTED;
+
+	/* Make sure this isn't free space. */
+	error = xfs_alloc_has_records(sc->sa.bno_cur, rec->rm_startblock,
+			rec->rm_blockcount, &outcome);
+	if (error)
+		return error;
+	if (outcome != XBTREE_RECPACKING_EMPTY)
+		return -EFSCORRUPTED;
+
+	return 0;
+}
+
+/* Store a reverse-mapping record. */
+static inline int
+xrep_rmap_stash(
+	struct xrep_rmap	*rr,
+	xfs_agblock_t		startblock,
+	xfs_extlen_t		blockcount,
+	uint64_t		owner,
+	uint64_t		offset,
+	unsigned int		flags)
+{
+	struct xrep_rmap_extent	rre = {
+		.startblock	= startblock,
+		.blockcount	= blockcount,
+		.owner		= owner,
+	};
+	struct xfs_rmap_irec	rmap = {
+		.rm_startblock	= startblock,
+		.rm_blockcount	= blockcount,
+		.rm_owner	= owner,
+		.rm_offset	= offset,
+		.rm_flags	= flags,
+	};
+	struct xfs_scrub	*sc = rr->sc;
+	int			error = 0;
+
+	if (xchk_should_terminate(sc, &error))
+		return error;
+
+	trace_xrep_rmap_found(sc->mp, sc->sa.pag->pag_agno, &rmap);
+
+	rre.offset = xfs_rmap_irec_offset_pack(&rmap);
+	return xfarray_append(rr->rmap_records, &rre);
+}
+
+struct xrep_rmap_stash_run {
+	struct xrep_rmap	*rr;
+	uint64_t		owner;
+	unsigned int		rmap_flags;
+};
+
+static int
+xrep_rmap_stash_run(
+	uint64_t			start,
+	uint64_t			len,
+	void				*priv)
+{
+	struct xrep_rmap_stash_run	*rsr = priv;
+	struct xrep_rmap		*rr = rsr->rr;
+
+	return xrep_rmap_stash(rr, start, len, rsr->owner, 0, rsr->rmap_flags);
+}
+
+/*
+ * Emit rmaps for every extent of bits set in the bitmap.  Caller must ensure
+ * that the ranges are in units of FS blocks.
+ */
+STATIC int
+xrep_rmap_stash_bitmap(
+	struct xrep_rmap		*rr,
+	struct xagb_bitmap		*bitmap,
+	const struct xfs_owner_info	*oinfo)
+{
+	struct xrep_rmap_stash_run	rsr = {
+		.rr			= rr,
+		.owner			= oinfo->oi_owner,
+		.rmap_flags		= 0,
+	};
+
+	if (oinfo->oi_flags & XFS_OWNER_INFO_ATTR_FORK)
+		rsr.rmap_flags |= XFS_RMAP_ATTR_FORK;
+	if (oinfo->oi_flags & XFS_OWNER_INFO_BMBT_BLOCK)
+		rsr.rmap_flags |= XFS_RMAP_BMBT_BLOCK;
+
+	return xagb_bitmap_walk(bitmap, xrep_rmap_stash_run, &rsr);
+}
+
+/* Section (I): Finding all file and bmbt extents. */
+
+/* Context for accumulating rmaps for an inode fork. */
+struct xrep_rmap_ifork {
+	/*
+	 * Accumulate rmap data here to turn multiple adjacent bmaps into a
+	 * single rmap.
+	 */
+	struct xfs_rmap_irec	accum;
+
+	/* Bitmap of bmbt blocks in this AG. */
+	struct xagb_bitmap	bmbt_blocks;
+
+	struct xrep_rmap	*rr;
+
+	/* Which inode fork? */
+	int			whichfork;
+};
+
+/* Stash an rmap that we accumulated while walking an inode fork. */
+STATIC int
+xrep_rmap_stash_accumulated(
+	struct xrep_rmap_ifork	*rf)
+{
+	if (rf->accum.rm_blockcount == 0)
+		return 0;
+
+	return xrep_rmap_stash(rf->rr, rf->accum.rm_startblock,
+			rf->accum.rm_blockcount, rf->accum.rm_owner,
+			rf->accum.rm_offset, rf->accum.rm_flags);
+}
+
+/* Accumulate a bmbt record. */
+STATIC int
+xrep_rmap_visit_bmbt(
+	struct xfs_btree_cur	*cur,
+	struct xfs_bmbt_irec	*rec,
+	void			*priv)
+{
+	struct xrep_rmap_ifork	*rf = priv;
+	struct xfs_mount	*mp = rf->rr->sc->mp;
+	struct xfs_rmap_irec	*accum = &rf->accum;
+	xfs_agblock_t		agbno;
+	unsigned int		rmap_flags = 0;
+	int			error;
+
+	if (XFS_FSB_TO_AGNO(mp, rec->br_startblock) !=
+			rf->rr->sc->sa.pag->pag_agno)
+		return 0;
+
+	agbno = XFS_FSB_TO_AGBNO(mp, rec->br_startblock);
+	if (rf->whichfork == XFS_ATTR_FORK)
+		rmap_flags |= XFS_RMAP_ATTR_FORK;
+	if (rec->br_state == XFS_EXT_UNWRITTEN)
+		rmap_flags |= XFS_RMAP_UNWRITTEN;
+
+	/* If this bmap is adjacent to the previous one, just add it. */
+	if (accum->rm_blockcount > 0 &&
+	    rec->br_startoff == accum->rm_offset + accum->rm_blockcount &&
+	    agbno == accum->rm_startblock + accum->rm_blockcount &&
+	    rmap_flags == accum->rm_flags) {
+		accum->rm_blockcount += rec->br_blockcount;
+		return 0;
+	}
+
+	/* Otherwise stash the old rmap and start accumulating a new one. */
+	error = xrep_rmap_stash_accumulated(rf);
+	if (error)
+		return error;
+
+	accum->rm_startblock = agbno;
+	accum->rm_blockcount = rec->br_blockcount;
+	accum->rm_offset = rec->br_startoff;
+	accum->rm_flags = rmap_flags;
+	return 0;
+}
+
+/* Add a btree block to the bitmap. */
+STATIC int
+xrep_rmap_visit_iroot_btree_block(
+	struct xfs_btree_cur	*cur,
+	int			level,
+	void			*priv)
+{
+	struct xrep_rmap_ifork	*rf = priv;
+	struct xfs_buf		*bp;
+	xfs_fsblock_t		fsbno;
+	xfs_agblock_t		agbno;
+
+	xfs_btree_get_block(cur, level, &bp);
+	if (!bp)
+		return 0;
+
+	fsbno = XFS_DADDR_TO_FSB(cur->bc_mp, xfs_buf_daddr(bp));
+	if (XFS_FSB_TO_AGNO(cur->bc_mp, fsbno) != rf->rr->sc->sa.pag->pag_agno)
+		return 0;
+
+	agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
+	return xagb_bitmap_set(&rf->bmbt_blocks, agbno, 1);
+}
+
+/*
+ * Iterate a metadata btree rooted in an inode to collect rmap records for
+ * anything in this fork that matches the AG.
+ */
+STATIC int
+xrep_rmap_scan_iroot_btree(
+	struct xrep_rmap_ifork	*rf,
+	struct xfs_btree_cur	*cur)
+{
+	struct xfs_owner_info	oinfo;
+	struct xrep_rmap	*rr = rf->rr;
+	int			error;
+
+	xagb_bitmap_init(&rf->bmbt_blocks);
+
+	/* Record all the blocks in the btree itself. */
+	error = xfs_btree_visit_blocks(cur, xrep_rmap_visit_iroot_btree_block,
+			XFS_BTREE_VISIT_ALL, rf);
+	if (error)
+		goto out;
+
+	/* Emit rmaps for the btree blocks. */
+	xfs_rmap_ino_bmbt_owner(&oinfo, rf->accum.rm_owner, rf->whichfork);
+	error = xrep_rmap_stash_bitmap(rr, &rf->bmbt_blocks, &oinfo);
+	if (error)
+		goto out;
+
+	/* Stash any remaining accumulated rmaps. */
+	error = xrep_rmap_stash_accumulated(rf);
+out:
+	xagb_bitmap_destroy(&rf->bmbt_blocks);
+	return error;
+}
+
+static inline bool
+is_rt_data_fork(
+	struct xfs_inode	*ip,
+	int			whichfork)
+{
+	return XFS_IS_REALTIME_INODE(ip) && whichfork == XFS_DATA_FORK;
+}
+
+/*
+ * Iterate the block mapping btree to collect rmap records for anything in this
+ * fork that matches the AG.  Sets @mappings_done to true if we've scanned the
+ * block mappings in this fork.
+ */
+STATIC int
+xrep_rmap_scan_bmbt(
+	struct xrep_rmap_ifork	*rf,
+	struct xfs_inode	*ip,
+	bool			*mappings_done)
+{
+	struct xrep_rmap	*rr = rf->rr;
+	struct xfs_btree_cur	*cur;
+	struct xfs_ifork	*ifp;
+	int			error;
+
+	*mappings_done = false;
+	ifp = xfs_ifork_ptr(ip, rf->whichfork);
+	cur = xfs_bmbt_init_cursor(rr->sc->mp, rr->sc->tp, ip, rf->whichfork);
+
+	if (!xfs_ifork_is_realtime(ip, rf->whichfork) &&
+	    xfs_need_iread_extents(ifp)) {
+		/*
+		 * If the incore extent cache isn't loaded, scan the bmbt for
+		 * mapping records.  This avoids loading the incore extent
+		 * tree, which will increase memory pressure at a time when
+		 * we're trying to run as quickly as we possibly can.  Ignore
+		 * realtime extents.
+		 */
+		error = xfs_bmap_query_all(cur, xrep_rmap_visit_bmbt, rf);
+		if (error)
+			goto out_cur;
+
+		*mappings_done = true;
+	}
+
+	/* Scan for the bmbt blocks, which always live on the data device. */
+	error = xrep_rmap_scan_iroot_btree(rf, cur);
+out_cur:
+	xfs_btree_del_cursor(cur, error);
+	return error;
+}
+
+/*
+ * Iterate the in-core extent cache to collect rmap records for anything in
+ * this fork that matches the AG.
+ */
+STATIC int
+xrep_rmap_scan_iext(
+	struct xrep_rmap_ifork	*rf,
+	struct xfs_ifork	*ifp)
+{
+	struct xfs_bmbt_irec	rec;
+	struct xfs_iext_cursor	icur;
+	int			error;
+
+	for_each_xfs_iext(ifp, &icur, &rec) {
+		if (isnullstartblock(rec.br_startblock))
+			continue;
+		error = xrep_rmap_visit_bmbt(NULL, &rec, rf);
+		if (error)
+			return error;
+	}
+
+	return xrep_rmap_stash_accumulated(rf);
+}
+
+/* Find all the extents from a given AG in an inode fork. */
+STATIC int
+xrep_rmap_scan_ifork(
+	struct xrep_rmap	*rr,
+	struct xfs_inode	*ip,
+	int			whichfork)
+{
+	struct xrep_rmap_ifork	rf = {
+		.accum		= { .rm_owner = ip->i_ino, },
+		.rr		= rr,
+		.whichfork	= whichfork,
+	};
+	struct xfs_ifork	*ifp = xfs_ifork_ptr(ip, whichfork);
+	int			error = 0;
+
+	if (!ifp)
+		return 0;
+
+	if (ifp->if_format == XFS_DINODE_FMT_BTREE) {
+		bool		mappings_done;
+
+		/*
+		 * Scan the bmap btree for data device mappings.  This includes
+		 * the btree blocks themselves, even if this is a realtime
+		 * file.
+		 */
+		error = xrep_rmap_scan_bmbt(&rf, ip, &mappings_done);
+		if (error || mappings_done)
+			return error;
+	} else if (ifp->if_format != XFS_DINODE_FMT_EXTENTS) {
+		return 0;
+	}
+
+	/* Scan incore extent cache if this isn't a realtime file. */
+	if (xfs_ifork_is_realtime(ip, whichfork))
+		return 0;
+
+	return xrep_rmap_scan_iext(&rf, ifp);
+}
+
+/* Record reverse mappings for a file. */
+STATIC int
+xrep_rmap_scan_inode(
+	struct xrep_rmap	*rr,
+	struct xfs_inode	*ip)
+{
+	unsigned int		lock_mode;
+	int			error;
+
+	xfs_ilock(ip, XFS_IOLOCK_SHARED | XFS_MMAPLOCK_SHARED);
+	lock_mode = xfs_ilock_data_map_shared(ip);
+
+	/* Check the data fork. */
+	error = xrep_rmap_scan_ifork(rr, ip, XFS_DATA_FORK);
+	if (error)
+		goto out_unlock;
+
+	/* Check the attr fork. */
+	error = xrep_rmap_scan_ifork(rr, ip, XFS_ATTR_FORK);
+	if (error)
+		goto out_unlock;
+
+	/* COW fork extents are "owned" by the refcount btree. */
+
+	xchk_iscan_mark_visited(&rr->iscan, ip);
+out_unlock:
+	xfs_iunlock(ip, XFS_IOLOCK_SHARED | XFS_MMAPLOCK_SHARED | lock_mode);
+	return error;
+}
+
+/* Section (I): Find all AG metadata extents except for free space metadata. */
+
+struct xrep_rmap_inodes {
+	struct xrep_rmap	*rr;
+	struct xagb_bitmap	inobt_blocks;	/* INOBIT */
+	struct xagb_bitmap	ichunk_blocks;	/* ICHUNKBIT */
+};
+
+/* Record inode btree rmaps. */
+STATIC int
+xrep_rmap_walk_inobt(
+	struct xfs_btree_cur		*cur,
+	const union xfs_btree_rec	*rec,
+	void				*priv)
+{
+	struct xfs_inobt_rec_incore	irec;
+	struct xrep_rmap_inodes		*ri = priv;
+	struct xfs_mount		*mp = cur->bc_mp;
+	xfs_agblock_t			agbno;
+	xfs_agino_t			agino;
+	xfs_agino_t			iperhole;
+	unsigned int			i;
+	int				error;
+
+	/* Record the inobt blocks. */
+	error = xagb_bitmap_set_btcur_path(&ri->inobt_blocks, cur);
+	if (error)
+		return error;
+
+	xfs_inobt_btrec_to_irec(mp, rec, &irec);
+	if (xfs_inobt_check_irec(cur, &irec) != NULL)
+		return -EFSCORRUPTED;
+
+	agino = irec.ir_startino;
+
+	/* Record a non-sparse inode chunk. */
+	if (!xfs_inobt_issparse(irec.ir_holemask)) {
+		agbno = XFS_AGINO_TO_AGBNO(mp, agino);
+
+		return xagb_bitmap_set(&ri->ichunk_blocks, agbno,
+				XFS_INODES_PER_CHUNK / mp->m_sb.sb_inopblock);
+	}
+
+	/* Iterate each chunk. */
+	iperhole = max_t(xfs_agino_t, mp->m_sb.sb_inopblock,
+			XFS_INODES_PER_HOLEMASK_BIT);
+	for (i = 0, agino = irec.ir_startino;
+	     i < XFS_INOBT_HOLEMASK_BITS;
+	     i += iperhole / XFS_INODES_PER_HOLEMASK_BIT, agino += iperhole) {
+		/* Skip holes. */
+		if (irec.ir_holemask & (1 << i))
+			continue;
+
+		/* Record the inode chunk otherwise. */
+		agbno = XFS_AGINO_TO_AGBNO(mp, agino);
+		error = xagb_bitmap_set(&ri->ichunk_blocks, agbno,
+				iperhole / mp->m_sb.sb_inopblock);
+		if (error)
+			return error;
+	}
+
+	return 0;
+}
+
+/* Collect rmaps for the blocks containing inode btrees and the inode chunks. */
+STATIC int
+xrep_rmap_find_inode_rmaps(
+	struct xrep_rmap	*rr)
+{
+	struct xrep_rmap_inodes	ri = {
+		.rr		= rr,
+	};
+	struct xfs_scrub	*sc = rr->sc;
+	int			error;
+
+	xagb_bitmap_init(&ri.inobt_blocks);
+	xagb_bitmap_init(&ri.ichunk_blocks);
+
+	/*
+	 * Iterate every record in the inobt so we can capture all the inode
+	 * chunks and the blocks in the inobt itself.
+	 */
+	error = xfs_btree_query_all(sc->sa.ino_cur, xrep_rmap_walk_inobt, &ri);
+	if (error)
+		goto out_bitmap;
+
+	/*
+	 * Note that if there are zero records in the inobt then query_all does
+	 * nothing and we have to account the empty inobt root manually.
+	 */
+	if (xagb_bitmap_empty(&ri.ichunk_blocks)) {
+		struct xfs_agi	*agi = sc->sa.agi_bp->b_addr;
+
+		error = xagb_bitmap_set(&ri.inobt_blocks,
+				be32_to_cpu(agi->agi_root), 1);
+		if (error)
+			goto out_bitmap;
+	}
+
+	/* Scan the finobt too. */
+	if (xfs_has_finobt(sc->mp)) {
+		error = xagb_bitmap_set_btblocks(&ri.inobt_blocks,
+				sc->sa.fino_cur);
+		if (error)
+			goto out_bitmap;
+	}
+
+	/* Generate rmaps for everything. */
+	error = xrep_rmap_stash_bitmap(rr, &ri.inobt_blocks,
+			&XFS_RMAP_OINFO_INOBT);
+	if (error)
+		goto out_bitmap;
+	error = xrep_rmap_stash_bitmap(rr, &ri.ichunk_blocks,
+			&XFS_RMAP_OINFO_INODES);
+
+out_bitmap:
+	xagb_bitmap_destroy(&ri.inobt_blocks);
+	xagb_bitmap_destroy(&ri.ichunk_blocks);
+	return error;
+}
+
+/* Record a CoW staging extent. */
+STATIC int
+xrep_rmap_walk_cowblocks(
+	struct xfs_btree_cur		*cur,
+	const struct xfs_refcount_irec	*irec,
+	void				*priv)
+{
+	struct xagb_bitmap		*bitmap = priv;
+
+	if (!xfs_refcount_check_domain(irec) ||
+	    irec->rc_domain != XFS_REFC_DOMAIN_COW)
+		return -EFSCORRUPTED;
+
+	return xagb_bitmap_set(bitmap, irec->rc_startblock, irec->rc_blockcount);
+}
+
+/*
+ * Collect rmaps for the blocks containing the refcount btree, and all CoW
+ * staging extents.
+ */
+STATIC int
+xrep_rmap_find_refcount_rmaps(
+	struct xrep_rmap	*rr)
+{
+	struct xagb_bitmap	refcountbt_blocks;	/* REFCBIT */
+	struct xagb_bitmap	cow_blocks;		/* COWBIT */
+	struct xfs_refcount_irec low = {
+		.rc_startblock	= 0,
+		.rc_domain	= XFS_REFC_DOMAIN_COW,
+	};
+	struct xfs_refcount_irec high = {
+		.rc_startblock	= -1U,
+		.rc_domain	= XFS_REFC_DOMAIN_COW,
+	};
+	struct xfs_scrub	*sc = rr->sc;
+	int			error;
+
+	if (!xfs_has_reflink(sc->mp))
+		return 0;
+
+	xagb_bitmap_init(&refcountbt_blocks);
+	xagb_bitmap_init(&cow_blocks);
+
+	/* refcountbt */
+	error = xagb_bitmap_set_btblocks(&refcountbt_blocks, sc->sa.refc_cur);
+	if (error)
+		goto out_bitmap;
+
+	/* Collect rmaps for CoW staging extents. */
+	error = xfs_refcount_query_range(sc->sa.refc_cur, &low, &high,
+			xrep_rmap_walk_cowblocks, &cow_blocks);
+	if (error)
+		goto out_bitmap;
+
+	/* Generate rmaps for everything. */
+	error = xrep_rmap_stash_bitmap(rr, &cow_blocks, &XFS_RMAP_OINFO_COW);
+	if (error)
+		goto out_bitmap;
+	error = xrep_rmap_stash_bitmap(rr, &refcountbt_blocks,
+			&XFS_RMAP_OINFO_REFC);
+
+out_bitmap:
+	xagb_bitmap_destroy(&cow_blocks);
+	xagb_bitmap_destroy(&refcountbt_blocks);
+	return error;
+}
+
+/* Generate rmaps for the AG headers (AGI/AGF/AGFL) */
+STATIC int
+xrep_rmap_find_agheader_rmaps(
+	struct xrep_rmap	*rr)
+{
+	struct xfs_scrub	*sc = rr->sc;
+
+	/* Create a record for the AG sb->agfl. */
+	return xrep_rmap_stash(rr, XFS_SB_BLOCK(sc->mp),
+			XFS_AGFL_BLOCK(sc->mp) - XFS_SB_BLOCK(sc->mp) + 1,
+			XFS_RMAP_OWN_FS, 0, 0);
+}
+
+/* Generate rmaps for the log, if it's in this AG. */
+STATIC int
+xrep_rmap_find_log_rmaps(
+	struct xrep_rmap	*rr)
+{
+	struct xfs_scrub	*sc = rr->sc;
+
+	if (!xfs_ag_contains_log(sc->mp, sc->sa.pag->pag_agno))
+		return 0;
+
+	return xrep_rmap_stash(rr,
+			XFS_FSB_TO_AGBNO(sc->mp, sc->mp->m_sb.sb_logstart),
+			sc->mp->m_sb.sb_logblocks, XFS_RMAP_OWN_LOG, 0, 0);
+}
+
+/*
+ * Generate all the reverse-mappings for this AG, a list of the old rmapbt
+ * blocks, and the new btreeblks count.  Figure out if we have enough free
+ * space to reconstruct the inode btrees.  The caller must clean up the lists
+ * if anything goes wrong.  This implements section (I) above.
+ */
+STATIC int
+xrep_rmap_find_rmaps(
+	struct xrep_rmap	*rr)
+{
+	struct xfs_scrub	*sc = rr->sc;
+	struct xchk_ag		*sa = &sc->sa;
+	struct xfs_inode	*ip;
+	int			error;
+
+	/* Find all the per-AG metadata. */
+	xrep_ag_btcur_init(sc, &sc->sa);
+
+	error = xrep_rmap_find_inode_rmaps(rr);
+	if (error)
+		goto end_agscan;
+
+	error = xrep_rmap_find_refcount_rmaps(rr);
+	if (error)
+		goto end_agscan;
+
+	error = xrep_rmap_find_agheader_rmaps(rr);
+	if (error)
+		goto end_agscan;
+
+	error = xrep_rmap_find_log_rmaps(rr);
+end_agscan:
+	xchk_ag_btcur_free(&sc->sa);
+	if (error)
+		return error;
+
+	/*
+	 * Set up for a potentially lengthy filesystem scan by reducing our
+	 * transaction resource usage for the duration.  Specifically:
+	 *
+	 * Unlock the AG header buffers and cancel the transaction to release
+	 * the log grant space while we scan the filesystem.
+	 *
+	 * Create a new empty transaction to eliminate the possibility of the
+	 * inode scan deadlocking on cyclical metadata.
+	 *
+	 * We pass the empty transaction to the file scanning function to avoid
+	 * repeatedly cycling empty transactions.  This can be done even though
+	 * we take the IOLOCK to quiesce the file because empty transactions
+	 * do not take sb_internal.
+	 */
+	sa->agf_bp = NULL;
+	sa->agi_bp = NULL;
+	xchk_trans_cancel(sc);
+	error = xchk_trans_alloc_empty(sc);
+	if (error)
+		return error;
+
+	/* Iterate all AGs for inodes rmaps. */
+	while ((error = xchk_iscan_iter(sc, &rr->iscan, &ip)) == 1) {
+		error = xrep_rmap_scan_inode(rr, ip);
+		xchk_irele(sc, ip);
+		if (error)
+			break;
+
+		if (xchk_should_terminate(sc, &error))
+			break;
+	}
+	if (error)
+		return error;
+
+	/*
+	 * Switch out for a real transaction and lock the AG headers in
+	 * preparation for building a new tree.
+	 */
+	xchk_trans_cancel(sc);
+	error = xchk_setup_fs(sc);
+	if (error)
+		return error;
+	return xchk_perag_lock(sc);
+}
+
+/* Section (II): Reserving space for new rmapbt and setting free space bitmap */
+
+struct xrep_rmap_agfl {
+	struct xagb_bitmap	*bitmap;
+	xfs_agnumber_t		agno;
+};
+
+/* Add an AGFL block to the rmap list. */
+STATIC int
+xrep_rmap_walk_agfl(
+	struct xfs_mount	*mp,
+	xfs_agblock_t		agbno,
+	void			*priv)
+{
+	struct xrep_rmap_agfl	*ra = priv;
+
+	return xagb_bitmap_set(ra->bitmap, agbno, 1);
+}
+
+/*
+ * Run one round of reserving space for the new rmapbt and recomputing the
+ * number of blocks needed to store the previously observed rmapbt records and
+ * the ones we'll create for the free space metadata.  When we don't need more
+ * blocks, return a bitmap of OWN_AG extents in @freesp_blocks and set @done to
+ * true.
+ */
+STATIC int
+xrep_rmap_try_reserve(
+	struct xrep_rmap	*rr,
+	struct xfs_btree_cur	*rmap_cur,
+	uint64_t		nr_records,
+	struct xagb_bitmap	*freesp_blocks,
+	uint64_t		*blocks_reserved,
+	bool			*done)
+{
+	struct xrep_rmap_agfl	ra = {
+		.bitmap		= freesp_blocks,
+		.agno		= rr->sc->sa.pag->pag_agno,
+	};
+	struct xfs_scrub	*sc = rr->sc;
+	struct xrep_newbt_resv	*resv, *n;
+	struct xfs_agf		*agf = sc->sa.agf_bp->b_addr;
+	struct xfs_buf		*agfl_bp;
+	uint64_t		nr_blocks;	/* RMB */
+	uint64_t		freesp_records;
+	int			error;
+
+	/*
+	 * We're going to recompute new_btree.bload.nr_blocks at the end of
+	 * this function to reflect however many btree blocks we need to store
+	 * all the rmap records (including the ones that reflect the changes we
+	 * made to support the new rmapbt blocks), so we save the old value
+	 * here so we can decide if we've reserved enough blocks.
+	 */
+	nr_blocks = rr->new_btree.bload.nr_blocks;
+
+	/*
+	 * Make sure we've reserved enough space for the new btree.  This can
+	 * change the shape of the free space btrees, which can cause secondary
+	 * interactions with the rmap records because all three space btrees
+	 * have the same rmap owner.  We'll account for all that below.
+	 */
+	error = xrep_newbt_alloc_blocks(&rr->new_btree,
+			nr_blocks - *blocks_reserved);
+	if (error)
+		return error;
+
+	*blocks_reserved = rr->new_btree.bload.nr_blocks;
+
+	/* Clear everything in the bitmap. */
+	xagb_bitmap_destroy(freesp_blocks);
+
+	/* Set all the bnobt blocks in the bitmap. */
+	sc->sa.bno_cur = xfs_allocbt_init_cursor(sc->mp, sc->tp, sc->sa.agf_bp,
+			sc->sa.pag, XFS_BTNUM_BNO);
+	error = xagb_bitmap_set_btblocks(freesp_blocks, sc->sa.bno_cur);
+	xfs_btree_del_cursor(sc->sa.bno_cur, error);
+	sc->sa.bno_cur = NULL;
+	if (error)
+		return error;
+
+	/* Set all the cntbt blocks in the bitmap. */
+	sc->sa.cnt_cur = xfs_allocbt_init_cursor(sc->mp, sc->tp, sc->sa.agf_bp,
+			sc->sa.pag, XFS_BTNUM_CNT);
+	error = xagb_bitmap_set_btblocks(freesp_blocks, sc->sa.cnt_cur);
+	xfs_btree_del_cursor(sc->sa.cnt_cur, error);
+	sc->sa.cnt_cur = NULL;
+	if (error)
+		return error;
+
+	/* Record our new btreeblks value. */
+	rr->freesp_btblocks = xagb_bitmap_hweight(freesp_blocks) - 2;
+
+	/* Set all the new rmapbt blocks in the bitmap. */
+	for_each_xrep_newbt_reservation(&rr->new_btree, resv, n) {
+		error = xagb_bitmap_set(freesp_blocks, resv->agbno, resv->len);
+		if (error)
+			return error;
+	}
+
+	/* Set all the AGFL blocks in the bitmap. */
+	error = xfs_alloc_read_agfl(sc->sa.pag, sc->tp, &agfl_bp);
+	if (error)
+		return error;
+
+	error = xfs_agfl_walk(sc->mp, agf, agfl_bp, xrep_rmap_walk_agfl, &ra);
+	if (error)
+		return error;
+
+	/* Count the extents in the bitmap. */
+	freesp_records = xagb_bitmap_count_set_regions(freesp_blocks);
+
+	/* Compute how many blocks we'll need for all the rmaps. */
+	error = xfs_btree_bload_compute_geometry(rmap_cur,
+			&rr->new_btree.bload, nr_records + freesp_records);
+	if (error)
+		return error;
+
+	/* We're done when we don't need more blocks. */
+	*done = nr_blocks >= rr->new_btree.bload.nr_blocks;
+	return 0;
+}
+
+/*
+ * Iteratively reserve space for rmap btree while recording OWN_AG rmaps for
+ * the free space metadata.  This implements section (II) above.
+ */
+STATIC int
+xrep_rmap_reserve_space(
+	struct xrep_rmap	*rr,
+	struct xfs_btree_cur	*rmap_cur)
+{
+	struct xagb_bitmap	freesp_blocks;	/* AGBIT */
+	uint64_t		nr_records;	/* NR */
+	uint64_t		blocks_reserved = 0;
+	bool			done = false;
+	int			error;
+
+	nr_records = xfarray_length(rr->rmap_records);
+
+	/* Compute how many blocks we'll need for the rmaps collected so far. */
+	error = xfs_btree_bload_compute_geometry(rmap_cur,
+			&rr->new_btree.bload, nr_records);
+	if (error)
+		return error;
+
+	/* Last chance to abort before we start committing fixes. */
+	if (xchk_should_terminate(rr->sc, &error))
+		return error;
+
+	xagb_bitmap_init(&freesp_blocks);
+
+	/*
+	 * Iteratively reserve space for the new rmapbt and recompute the
+	 * number of blocks needed to store the previously observed rmapbt
+	 * records and the ones we'll create for the free space metadata.
+	 * Finish when we don't need more blocks.
+	 */
+	do {
+		error = xrep_rmap_try_reserve(rr, rmap_cur, nr_records,
+				&freesp_blocks, &blocks_reserved, &done);
+		if (error)
+			goto out_bitmap;
+	} while (!done);
+
+	/* Emit rmaps for everything in the free space bitmap. */
+	xrep_ag_btcur_init(rr->sc, &rr->sc->sa);
+	error = xrep_rmap_stash_bitmap(rr, &freesp_blocks, &XFS_RMAP_OINFO_AG);
+	xchk_ag_btcur_free(&rr->sc->sa);
+
+out_bitmap:
+	xagb_bitmap_destroy(&freesp_blocks);
+	return error;
+}
+
+/* Section (III): Building the new rmap btree. */
+
+/* Update the AGF counters. */
+STATIC int
+xrep_rmap_reset_counters(
+	struct xrep_rmap	*rr)
+{
+	struct xfs_scrub	*sc = rr->sc;
+	struct xfs_perag	*pag = sc->sa.pag;
+	struct xfs_agf		*agf = sc->sa.agf_bp->b_addr;
+	xfs_agblock_t		rmap_btblocks;
+
+	/*
+	 * The AGF header contains extra information related to the reverse
+	 * mapping btree, so we must update those fields here.
+	 */
+	rmap_btblocks = rr->new_btree.afake.af_blocks - 1;
+	agf->agf_btreeblks = cpu_to_be32(rr->freesp_btblocks + rmap_btblocks);
+	xfs_alloc_log_agf(sc->tp, sc->sa.agf_bp, XFS_AGF_BTREEBLKS);
+
+	/*
+	 * After we commit the new btree to disk, it is possible that the
+	 * process to reap the old btree blocks will race with the AIL trying
+	 * to checkpoint the old btree blocks into the filesystem.  If the new
+	 * tree is shorter than the old one, the rmapbt write verifier will
+	 * fail and the AIL will shut down the filesystem.
+	 *
+	 * To avoid this, save the old incore btree height values as the alt
+	 * height values before re-initializing the perag info from the updated
+	 * AGF to capture all the new values.
+	 */
+	pag->pagf_alt_levels[XFS_BTNUM_RMAPi] =
+					pag->pagf_levels[XFS_BTNUM_RMAPi];
+
+	/* Reinitialize with the values we just logged. */
+	return xrep_reinit_pagf(sc);
+}
+
+/* Retrieve rmapbt data for bulk load. */
+STATIC int
+xrep_rmap_get_records(
+	struct xfs_btree_cur	*cur,
+	unsigned int		idx,
+	struct xfs_btree_block	*block,
+	unsigned int		nr_wanted,
+	void			*priv)
+{
+	struct xrep_rmap_extent	rec;
+	struct xfs_rmap_irec	*irec = &cur->bc_rec.r;
+	struct xrep_rmap	*rr = priv;
+	union xfs_btree_rec	*block_rec;
+	unsigned int		loaded;
+	int			error;
+
+	for (loaded = 0; loaded < nr_wanted; loaded++, idx++) {
+		error = xfarray_load_next(rr->rmap_records, &rr->array_cur,
+				&rec);
+		if (error)
+			return error;
+
+		irec->rm_startblock = rec.startblock;
+		irec->rm_blockcount = rec.blockcount;
+		irec->rm_owner = rec.owner;
+		if (xfs_rmap_irec_offset_unpack(rec.offset, irec) != NULL)
+			return -EFSCORRUPTED;
+
+		error = xrep_rmap_check_mapping(rr->sc, irec);
+		if (error)
+			return error;
+
+		block_rec = xfs_btree_rec_addr(cur, idx, block);
+		cur->bc_ops->init_rec_from_cur(cur, block_rec);
+	}
+
+	return loaded;
+}
+
+/* Feed one of the new btree blocks to the bulk loader. */
+STATIC int
+xrep_rmap_claim_block(
+	struct xfs_btree_cur	*cur,
+	union xfs_btree_ptr	*ptr,
+	void			*priv)
+{
+	struct xrep_rmap        *rr = priv;
+	int			error;
+
+	error = xrep_newbt_relog_autoreap(&rr->new_btree);
+	if (error)
+		return error;
+
+	return xrep_newbt_claim_block(cur, &rr->new_btree, ptr);
+}
+
+/* Custom allocation function for new rmap btrees. */
+STATIC int
+xrep_rmap_alloc_vextent(
+	struct xfs_scrub	*sc,
+	struct xfs_alloc_arg	*args)
+{
+	int			error;
+
+	/*
+	 * We don't want an rmap update on the allocation, since we iteratively
+	 * compute the OWN_AG records /after/ allocating blocks for the records
+	 * that we already know we need to store.  Therefore, fix the freelist
+	 * with the NORMAP flag set so that we don't also try to create an rmap
+	 * for new AGFL blocks.
+	 */
+	error = xrep_fix_freelist(sc, XFS_ALLOC_FLAG_NORMAP);
+	if (error)
+		return error;
+
+	/*
+	 * If xrep_fix_freelist fixed the freelist by moving blocks from the
+	 * free space btrees or by removing blocks from the AGFL and queueing
+	 * an EFI to free the block, the transaction will be dirty.  This
+	 * second case is of interest to us.
+	 *
+	 * Later on, we will need to compare gaps in the new recordset against
+	 * the block usage of all OWN_AG owners in order to free the old
+	 * btree's blocks, which means that we can't have EFIs for former AGFL
+	 * blocks attached to the repair transaction when we commit the new
+	 * btree.
+	 *
+	 * xrep_newbt_alloc_blocks guarantees this for us by calling
+	 * xrep_defer_finish to commit anything that fix_freelist may have
+	 * added to the transaction.
+	 */
+	return xfs_alloc_vextent(args);
+}
+
+/*
+ * Use the collected rmap information to stage a new rmap btree.  If this is
+ * successful we'll return with the new btree root information logged to the
+ * repair transaction but not yet committed.  This implements section (III)
+ * above.
+ */
+STATIC int
+xrep_rmap_build_new_tree(
+	struct xrep_rmap	*rr)
+{
+	struct xfs_scrub	*sc = rr->sc;
+	struct xfs_perag	*pag = sc->sa.pag;
+	struct xfs_agf		*agf = sc->sa.agf_bp->b_addr;
+	struct xfs_btree_cur	*rmap_cur;
+	xfs_fsblock_t		fsbno;
+	int			error;
+
+	/*
+	 * Preserve the old rmapbt block count so that we can adjust the
+	 * per-AG rmapbt reservation after we commit the new btree root and
+	 * want to dispose of the old btree blocks.
+	 */
+	rr->old_rmapbt_fsbcount = be32_to_cpu(agf->agf_rmap_blocks);
+
+	/*
+	 * Prepare to construct the new btree by reserving disk space for the
+	 * new btree and setting up all the accounting information we'll need
+	 * to root the new btree while it's under construction and before we
+	 * attach it to the AG header.  The new blocks are accounted to the
+	 * rmapbt per-AG reservation, which we will adjust further after
+	 * committing the new btree.
+	 */
+	fsbno = XFS_AGB_TO_FSB(sc->mp, pag->pag_agno, XFS_RMAP_BLOCK(sc->mp));
+	xrep_newbt_init_ag(&rr->new_btree, sc, &XFS_RMAP_OINFO_SKIP_UPDATE,
+			fsbno, XFS_AG_RESV_RMAPBT);
+	rr->new_btree.bload.get_records = xrep_rmap_get_records;
+	rr->new_btree.bload.claim_block = xrep_rmap_claim_block;
+	rr->new_btree.alloc_vextent = xrep_rmap_alloc_vextent;
+	rmap_cur = xfs_rmapbt_stage_cursor(sc->mp, &rr->new_btree.afake, pag);
+
+	/*
+	 * Initialize @rr->new_btree, reserve space for the new rmapbt,
+	 * and compute OWN_AG rmaps.
+	 */
+	error = xrep_rmap_reserve_space(rr, rmap_cur);
+	if (error)
+		goto err_cur;
+
+	/*
+	 * Due to btree slack factors, it's possible for a new btree to be one
+	 * level taller than the old btree.  Update the incore btree height so
+	 * that we don't trip the verifiers when writing the new btree blocks
+	 * to disk.
+	 */
+	pag->pagf_alt_levels[XFS_BTNUM_RMAPi] =
+					rr->new_btree.bload.btree_height;
+
+	/* Add all observed rmap records. */
+	rr->array_cur = XFARRAY_CURSOR_INIT;
+	sc->sa.bno_cur = xfs_allocbt_init_cursor(sc->mp, sc->tp, sc->sa.agf_bp,
+			sc->sa.pag, XFS_BTNUM_BNO);
+	error = xfs_btree_bload(rmap_cur, &rr->new_btree.bload, rr);
+	xfs_btree_del_cursor(sc->sa.bno_cur, error);
+	sc->sa.bno_cur = NULL;
+	if (error)
+		goto err_level;
+
+	/*
+	 * Install the new btree in the AG header.  After this point the old
+	 * btree is no longer accessible and the new tree is live.
+	 */
+	xfs_rmapbt_commit_staged_btree(rmap_cur, sc->tp, sc->sa.agf_bp);
+	xfs_btree_del_cursor(rmap_cur, 0);
+
+	/*
+	 * The newly committed rmap recordset includes mappings for the blocks
+	 * that we reserved to build the new btree.  If there is excess space
+	 * reservation to be freed, the corresponding rmap records must also be
+	 * removed.
+	 */
+	rr->new_btree.oinfo = XFS_RMAP_OINFO_AG;
+
+	/* Reset the AGF counters now that we've changed the btree shape. */
+	error = xrep_rmap_reset_counters(rr);
+	if (error)
+		goto err_newbt;
+
+	/* Dispose of any unused blocks and the accounting information. */
+	error = xrep_newbt_commit(&rr->new_btree);
+	if (error)
+		return error;
+
+	return xrep_roll_ag_trans(sc);
+
+err_level:
+	pag->pagf_alt_levels[XFS_BTNUM_RMAPi] = 0;
+err_cur:
+	xfs_btree_del_cursor(rmap_cur, error);
+err_newbt:
+	xrep_newbt_cancel(&rr->new_btree);
+	return error;
+}
+
+/* Section (IV): Reaping the old btree. */
+
+struct xrep_rmap_find_gaps {
+	struct xagb_bitmap	rmap_gaps;
+	xfs_agblock_t		next_agbno;
+};
+
+/* Subtract each free extent in the bnobt from the rmap gaps. */
+STATIC int
+xrep_rmap_find_freesp(
+	struct xfs_btree_cur		*cur,
+	const struct xfs_alloc_rec_incore *rec,
+	void				*priv)
+{
+	struct xrep_rmap_find_gaps	*rfg = priv;
+
+	return xagb_bitmap_clear(&rfg->rmap_gaps, rec->ar_startblock,
+			rec->ar_blockcount);
+}
+
+/*
+ * Reap the old rmapbt blocks.  Now that the rmapbt is fully rebuilt, we make
+ * a list of gaps in the rmap records and a list of the extents mentioned in
+ * the bnobt.  Any block that's in the new rmapbt gap list but not mentioned
+ * in the bnobt is a block from the old rmapbt and can be removed.
+ */
+STATIC int
+xrep_rmap_remove_old_tree(
+	struct xrep_rmap	*rr)
+{
+	struct xrep_rmap_find_gaps rfg = {
+		.next_agbno	= 0,
+	};
+	struct xfs_scrub	*sc = rr->sc;
+	struct xfs_agf		*agf = sc->sa.agf_bp->b_addr;
+	struct xfs_perag	*pag = sc->sa.pag;
+	xfs_agblock_t		agend;
+	xfarray_idx_t		array_cur;
+	int			error;
+
+	xagb_bitmap_init(&rfg.rmap_gaps);
+
+	/* Compute free space from the new rmapbt. */
+	foreach_xfarray_idx(rr->rmap_records, array_cur) {
+		struct xrep_rmap_extent	rec;
+
+		error = xfarray_load(rr->rmap_records, array_cur, &rec);
+		if (error)
+			goto out_bitmap;
+
+		/* Record the free space we find. */
+		if (rec.startblock > rfg.next_agbno) {
+			error = xagb_bitmap_set(&rfg.rmap_gaps, rfg.next_agbno,
+					rec.startblock - rfg.next_agbno);
+			if (error)
+				goto out_bitmap;
+		}
+		rfg.next_agbno = max_t(xfs_agblock_t, rfg.next_agbno,
+					rec.startblock + rec.blockcount);
+	}
+
+	/* Insert a record for space between the last rmap and EOAG. */
+	agend = be32_to_cpu(agf->agf_length);
+	if (rfg.next_agbno < agend) {
+		error = xagb_bitmap_set(&rfg.rmap_gaps, rfg.next_agbno,
+				agend - rfg.next_agbno);
+		if (error)
+			goto out_bitmap;
+	}
+
+	/* Compute free space from the existing bnobt. */
+	sc->sa.bno_cur = xfs_allocbt_init_cursor(sc->mp, sc->tp, sc->sa.agf_bp,
+			sc->sa.pag, XFS_BTNUM_BNO);
+	error = xfs_alloc_query_all(sc->sa.bno_cur, xrep_rmap_find_freesp,
+			&rfg);
+	xfs_btree_del_cursor(sc->sa.bno_cur, error);
+	sc->sa.bno_cur = NULL;
+	if (error)
+		goto out_bitmap;
+
+	/*
+	 * Free the "free" blocks that the new rmapbt knows about but the bnobt
+	 * doesn't--these are the old rmapbt blocks.  Credit the old rmapbt
+	 * block usage count back to the per-AG rmapbt reservation (and not
+	 * fdblocks, since the rmap btree lives in free space) to keep the
+	 * reservation and free space accounting correct.
+	 */
+	error = xrep_reap_agblocks(sc, &rfg.rmap_gaps,
+			&XFS_RMAP_OINFO_ANY_OWNER, XFS_AG_RESV_IGNORE);
+	if (error)
+		goto out_bitmap;
+	sc->sa.pag->pag_rmapbt_resv.ar_reserved += rr->old_rmapbt_fsbcount;
+
+	/*
+	 * Now that we've zapped all the old rmapbt blocks we can turn off
+	 * the alternate height mechanism and reset the per-AG space
+	 * reservation.
+	 */
+	pag->pagf_alt_levels[XFS_BTNUM_RMAPi] = 0;
+	sc->flags |= XREP_RESET_PERAG_RESV;
+out_bitmap:
+	xagb_bitmap_destroy(&rfg.rmap_gaps);
+	return error;
+}
+
+/* Repair the rmap btree for some AG. */
+int
+xrep_rmapbt(
+	struct xfs_scrub	*sc)
+{
+	struct xrep_rmap	*rr;
+	int			error;
+
+	/* Functionality is not yet complete. */
+	return xrep_notsupported(sc);
+
+	rr = kzalloc(sizeof(struct xrep_rmap), XCHK_GFP_FLAGS);
+	if (!rr)
+		return -ENOMEM;
+	rr->sc = sc;
+
+	/* Set up some storage */
+	error = xfarray_create(sc->mp, "rmap records", 0,
+			sizeof(struct xrep_rmap_extent), &rr->rmap_records);
+	if (error)
+		goto out_rr;
+
+	/* Retry iget every tenth of a second for up to 30 seconds. */
+	xchk_iscan_start(&rr->iscan, 30000, 100);
+
+	/*
+	 * Collect rmaps for everything in this AG that isn't space metadata.
+	 * These rmaps won't change even as we try to allocate blocks.
+	 */
+	error = xrep_rmap_find_rmaps(rr);
+	if (error)
+		goto out_records;
+
+	/* Rebuild the rmap information. */
+	error = xrep_rmap_build_new_tree(rr);
+	if (error)
+		goto out_records;
+
+	/* Kill the old tree. */
+	error = xrep_rmap_remove_old_tree(rr);
+
+out_records:
+	xchk_iscan_finish(&rr->iscan);
+	xfarray_destroy(rr->rmap_records);
+out_rr:
+	kfree(rr);
+	return error;
+}
diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c
index 5bbc12649277..f030311fae2b 100644
--- a/fs/xfs/scrub/scrub.c
+++ b/fs/xfs/scrub/scrub.c
@@ -278,7 +278,7 @@ static const struct xchk_meta_ops meta_scrub_ops[] = {
 		.setup	= xchk_setup_ag_rmapbt,
 		.scrub	= xchk_rmapbt,
 		.has	= xfs_has_rmapbt,
-		.repair	= xrep_notsupported,
+		.repair	= xrep_rmapbt,
 	},
 	[XFS_SCRUB_TYPE_REFCNTBT] = {	/* refcountbt */
 		.type	= ST_PERAG,
diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h
index 05b6a6e3d0ab..53aafc70878b 100644
--- a/fs/xfs/scrub/trace.h
+++ b/fs/xfs/scrub/trace.h
@@ -1426,7 +1426,6 @@ DEFINE_EVENT(xrep_rmap_class, name, \
 		 uint64_t owner, uint64_t offset, unsigned int flags), \
 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
 DEFINE_REPAIR_RMAP_EVENT(xrep_ibt_walk_rmap);
-DEFINE_REPAIR_RMAP_EVENT(xrep_rmap_extent_fn);
 DEFINE_REPAIR_RMAP_EVENT(xrep_bmap_walk_rmap);
 
 TRACE_EVENT(xrep_abt_found,
@@ -1544,6 +1543,38 @@ TRACE_EVENT(xrep_bmap_found,
 		  __entry->state)
 );
 
+TRACE_EVENT(xrep_rmap_found,
+	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
+		 const struct xfs_rmap_irec *rec),
+	TP_ARGS(mp, agno, rec),
+	TP_STRUCT__entry(
+		__field(dev_t, dev)
+		__field(xfs_agnumber_t, agno)
+		__field(xfs_agblock_t, agbno)
+		__field(xfs_extlen_t, len)
+		__field(uint64_t, owner)
+		__field(uint64_t, offset)
+		__field(unsigned int, flags)
+	),
+	TP_fast_assign(
+		__entry->dev = mp->m_super->s_dev;
+		__entry->agno = agno;
+		__entry->agbno = rec->rm_startblock;
+		__entry->len = rec->rm_blockcount;
+		__entry->owner = rec->rm_owner;
+		__entry->offset = rec->rm_offset;
+		__entry->flags = rec->rm_flags;
+	),
+	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->agno,
+		  __entry->agbno,
+		  __entry->len,
+		  __entry->owner,
+		  __entry->offset,
+		  __entry->flags)
+);
+
 TRACE_EVENT(xrep_findroot_block,
 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
 		 uint32_t magic, uint16_t level),


  reply	other threads:[~2022-12-30 23:43 UTC|newest]

Thread overview: 473+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30 21:14 [NYE DELUGE 2/4] xfs: online repair in its entirety Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/9] xfs: fix online repair block reaping Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/9] xfs: move the post-repair block reaping code to a separate file Darrick J. Wong
2022-12-30 22:12   ` [PATCH 8/9] xfs: reap large AG metadata extents when possible Darrick J. Wong
2022-12-30 22:12   ` [PATCH 5/9] xfs: use deferred frees to reap old btree blocks Darrick J. Wong
2022-12-30 22:12   ` [PATCH 3/9] xfs: only invalidate blocks if we're going to free them Darrick J. Wong
2022-12-30 22:12   ` [PATCH 6/9] xfs: rearrange xrep_reap_block to make future code flow easier Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/9] xfs: cull repair code that will never get used Darrick J. Wong
2022-12-30 22:12   ` [PATCH 4/9] xfs: only allow reaping of per-AG blocks in xrep_reap_extents Darrick J. Wong
2022-12-30 22:12   ` [PATCH 7/9] xfs: ignore stale buffers when scanning the buffer cache Darrick J. Wong
2022-12-30 22:12   ` [PATCH 9/9] xfs: use per-AG bitmaps to reap unused AG metadata blocks during repair Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/6] xfs: prepare repair for bulk loading Darrick J. Wong
2022-12-30 22:12   ` [PATCH 5/6] xfs: move btree bulkload record initialization to ->get_record implementations Darrick J. Wong
2022-12-30 22:12   ` [PATCH 4/6] xfs: add debug knobs to control btree bulk load slack factors Darrick J. Wong
2022-12-30 22:12   ` [PATCH 6/6] xfs: constrain dirty buffers while formatting a staged btree Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/6] xfs: force all buffers to be written during btree bulk load Darrick J. Wong
2022-12-30 22:12   ` [PATCH 3/6] xfs: log EFIs for all btree blocks being used to stage a btree Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/6] xfs: implement block reservation accounting for btrees we're staging Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/7] xfs: stage repair information in pageable memory Darrick J. Wong
2022-12-30 22:12   ` [PATCH 5/7] xfs: speed up xfarray sort by sorting xfile page contents directly Darrick J. Wong
2022-12-30 22:12   ` [PATCH 3/7] xfs: convert xfarray insertion sort to heapsort using scratchpad memory Darrick J. Wong
2022-12-30 22:12   ` [PATCH 7/7] xfs: improve xfarray quicksort pivot Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/7] xfs: enable sorting of xfile-backed arrays Darrick J. Wong
2022-12-30 22:12   ` [PATCH 6/7] xfs: cache pages used for xfarray quicksort convergence Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/7] xfs: create a big array data structure Darrick J. Wong
2022-12-30 22:12   ` [PATCH 4/7] xfs: teach xfile to pass back direct-map pages to caller Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/4] xfs: online scrubbing of realtime summary files Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/4] xfs: get our own reference to inodes that we want to scrub Darrick J. Wong
2022-12-30 22:12   ` [PATCH 3/4] xfs: move the realtime summary file scrubber to a separate source file Darrick J. Wong
2022-12-30 22:12   ` [PATCH 4/4] xfs: implement online scrubbing of rtsummary info Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/4] xfs: wrap ilock/iunlock operations on sc->ip Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/2] xfs: miscellaneous repair tweaks Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/2] xfs: allow the user to cancel repairs before we start writing Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/2] xfs: always rescan allegedly healthy per-ag metadata after repair Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/2] xfs: force rebuilding of metadata Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/2] xfs: allow userspace to rebuild metadata structures Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/2] xfs: don't complain about unfixed metadata when repairs were injected Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/5] xfs: online repair of AG btrees Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/5] xfs: clear pagf_agflreset when repairing the AGFL Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/5] xfs: repair free space btrees Darrick J. Wong
2022-12-30 22:12   ` [PATCH 4/5] xfs: repair inode btrees Darrick J. Wong
2022-12-30 22:12   ` [PATCH 5/5] xfs: repair refcount btrees Darrick J. Wong
2022-12-30 22:12   ` [PATCH 3/5] xfs: rewrite xfs_icache_inode_is_allocated Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/6] xfs: online repair of inodes and forks Darrick J. Wong
2022-12-30 22:12   ` [PATCH 3/6] xfs: repair inode records Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/6] xfs: try to attach dquots to files before repairing them Darrick J. Wong
2022-12-30 22:12   ` [PATCH 4/6] xfs: zap broken inode forks Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/6] xfs: disable online repair quota helpers when quota not enabled Darrick J. Wong
2022-12-30 22:12   ` [PATCH 5/6] xfs: abort directory parent scrub scans if we encounter a zapped directory Darrick J. Wong
2022-12-30 22:12   ` [PATCH 6/6] xfs: repair obviously broken inode modes Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/5] xfs: online repair of file fork mappings Darrick J. Wong
2022-12-30 22:12   ` [PATCH 1/5] xfs: reintroduce reaping of file metadata blocks to xrep_reap_extents Darrick J. Wong
2022-12-30 22:12   ` [PATCH 3/5] xfs: refactor repair forcing tests into a repair.c helper Darrick J. Wong
2022-12-30 22:12   ` [PATCH 5/5] xfs: repair problems in CoW forks Darrick J. Wong
2022-12-30 22:12   ` [PATCH 4/5] xfs: create a ranged query function for refcount btrees Darrick J. Wong
2022-12-30 22:12   ` [PATCH 2/5] xfs: repair inode fork block mapping data structures Darrick J. Wong
2022-12-30 22:12 ` [PATCHSET v24.0 0/4] xfs: online repair of quota and rt metadata files Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/4] xfs: online repair of realtime bitmaps Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/4] xfs: create a new inode fork block unmap helper Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/4] xfs: repair the inode core and forks of a metadata inode Darrick J. Wong
2022-12-30 22:13   ` [PATCH 4/4] xfs: repair quotas Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/4] xfs: live inode scans for online fsck Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/4] xfs: allow scrub to hook metadata updates in other writers Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/4] xfs: implement live inode scan for scrub Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/4] xfs: speed up xfs_iwalk_adjust_start a little bit Darrick J. Wong
2022-12-30 22:13   ` [PATCH 4/4] xfs: allow blocking notifier chains with filesystem hooks Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/5] xfs: online repair of quota counters Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/5] xfs: implement live quotacheck inode scan Darrick J. Wong
2022-12-30 22:13   ` [PATCH 4/5] xfs: repair cannot update the summary counters when logging quota flags Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/5] xfs: report the health of quota counts Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/5] xfs: track quota updates during live quotacheck Darrick J. Wong
2022-12-30 22:13   ` [PATCH 5/5] xfs: repair dquots based on live quotacheck results Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/5] xfs: online repair of file link counts Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/5] xfs: report health of inode " Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/5] xfs: teach scrub to check file nlinks Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/5] xfs: streamline the directory iteration code for scrub Darrick J. Wong
2022-12-30 22:13   ` [PATCH 5/5] xfs: teach repair to fix file nlinks Darrick J. Wong
2022-12-30 22:13   ` [PATCH 4/5] xfs: track file link count updates during live nlinks fsck Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 00/11] xfs: report corruption to the health trackers Darrick J. Wong
2022-12-30 22:13   ` [PATCH 01/11] xfs: separate the marking of sick and checked metadata Darrick J. Wong
2022-12-30 22:13   ` [PATCH 02/11] xfs: report fs corruption errors to the health tracking system Darrick J. Wong
2022-12-30 22:13   ` [PATCH 08/11] xfs: report inode corruption errors to the health system Darrick J. Wong
2022-12-30 22:13   ` [PATCH 06/11] xfs: report dir/attr block " Darrick J. Wong
2022-12-30 22:13   ` [PATCH 09/11] xfs: report quota " Darrick J. Wong
2022-12-30 22:13   ` [PATCH 03/11] xfs: report ag header corruption errors to the health tracking system Darrick J. Wong
2022-12-30 22:13   ` [PATCH 07/11] xfs: report symlink block corruption errors to the health system Darrick J. Wong
2022-12-30 22:13   ` [PATCH 05/11] xfs: report btree " Darrick J. Wong
2022-12-30 22:13   ` [PATCH 04/11] xfs: report block map corruption errors to the health tracking system Darrick J. Wong
2022-12-30 22:13   ` [PATCH 10/11] xfs: report realtime metadata corruption errors to the health system Darrick J. Wong
2022-12-30 22:13   ` [PATCH 11/11] xfs: report XFS_IS_CORRUPT " Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/3] xfs: indirect health reporting Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/3] xfs: update health status if we get a clean bill of health Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/3] xfs: remember sick inodes that get inactivated Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/3] xfs: add secondary and indirect classes to the health tracking system Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/3] xfs: online repair for fs summary counters Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/3] xfs: repair " Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/3] xfs: stabilize fs summary counters for online fsck Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/3] xfs: remove XCHK_REAPING_DISABLED from scrub Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/7] xfs: support in-memory btrees Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/7] xfs: dump xfiles for debugging purposes Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/7] xfs: teach buftargs to maintain their own buffer hashtable Darrick J. Wong
2022-12-30 22:13   ` [PATCH 5/7] xfs: consolidate btree block allocation tracepoints Darrick J. Wong
2022-12-30 22:13   ` [PATCH 6/7] xfs: support in-memory btrees Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/7] xfs: support in-memory buffer cache targets Darrick J. Wong
2022-12-30 22:13   ` [PATCH 4/7] xfs: consolidate btree block freeing tracepoints Darrick J. Wong
2022-12-30 22:13   ` [PATCH 7/7] xfs: connect in-memory btrees to xfiles Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/4] xfs: online repair of rmap btrees Darrick J. Wong
2022-12-30 22:13   ` Darrick J. Wong [this message]
2022-12-30 22:13   ` [PATCH 1/4] xfs: create a helper to decide if a file mapping targets the rt volume Darrick J. Wong
2022-12-30 22:13   ` [PATCH 4/4] xfs: hook live rmap operations during a repair operation Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/4] xfs: create a shadow rmap btree during rmap repair Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/9] xfs: move btree geometry to ops struct Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/9] xfs: set the btree cursor bc_ops in xfs_btree_alloc_cursor Darrick J. Wong
2022-12-30 22:13   ` [PATCH 7/9] xfs: remove the unnecessary daddr paramter to _init_block Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/9] xfs: encode the default bc_flags in the btree ops structure Darrick J. Wong
2022-12-30 22:13   ` [PATCH 4/9] xfs: initialize btree blocks using btree_ops structure Darrick J. Wong
2022-12-30 22:13   ` [PATCH 5/9] xfs: rename btree block/buffer init functions Darrick J. Wong
2022-12-30 22:13   ` [PATCH 6/9] xfs: btree convert xfs_btree_init_block to xfs_btree_init_buf calls Darrick J. Wong
2022-12-30 22:13   ` [PATCH 8/9] xfs: set btree block buffer ops in _init_buf Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/9] xfs: export some of the btree ops structures Darrick J. Wong
2022-12-30 22:13   ` [PATCH 9/9] xfs: remove unnecessary fields in xfbtree_config Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/3] xfs: reduce refcount repair memory usage Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/3] xfs: define an in-memory btree for storing refcount bag info during repairs Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/3] xfs: port refcount repair to the new refcount bag structure Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/3] xfs: create refcount bag structure for btree repairs Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/3] xfs: bmap log intent cleanups Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/3] xfs: remove xfs_trans_set_bmap_flags Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/3] xfs: clean up bmap log intent item tracepoint callsites Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/3] xfs: split tracepoint classes for deferred items Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/4] xfs: widen BUI formats to support realtime Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/4] xfs: hoist freeing of rt data fork extent mappings Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/4] xfs: fix xfs_bunmapi to allow unmapping of partial rt extents Darrick J. Wong
2022-12-30 22:13   ` [PATCH 4/4] xfs: support recovering bmap intent items targetting realtime extents Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/4] xfs: add a realtime flag to the bmap update log redo items Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/2] xfs: support attrfork and unwritten BUIs Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/2] xfs: support deferred bmap updates on the attr fork Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/2] xfs: xfs_bmap_finish_one should map unwritten extents properly Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 0/3] xfs: clean up symbolic link code Darrick J. Wong
2022-12-30 22:13   ` [PATCH 1/3] xfs: move xfs_symlink_remote.c declarations to xfs_symlink_remote.h Darrick J. Wong
2022-12-30 22:13   ` [PATCH 3/3] xfs: move symlink target write function to libxfs Darrick J. Wong
2022-12-30 22:13   ` [PATCH 2/3] xfs: move remote symlink target read " Darrick J. Wong
2022-12-30 22:13 ` [PATCHSET v24.0 00/21] xfs: atomic file updates Darrick J. Wong
2022-12-30 22:13   ` [PATCH 05/21] xfs: create a log incompat flag for atomic extent swapping Darrick J. Wong
2022-12-30 22:13   ` [PATCH 01/21] vfs: introduce new file range exchange ioctl Darrick J. Wong
2022-12-30 22:13   ` [PATCH 03/21] xfs: refactor non-power-of-two alignment checks Darrick J. Wong
2022-12-30 22:13   ` [PATCH 02/21] xfs: create a new helper to return a file's allocation unit Darrick J. Wong
2022-12-30 22:13   ` [PATCH 04/21] xfs: parameterize all the incompat log feature helpers Darrick J. Wong
2022-12-30 22:13   ` [PATCH 06/21] xfs: introduce a swap-extent log intent item Darrick J. Wong
2022-12-30 22:13   ` [PATCH 07/21] xfs: create deferred log items for extent swapping Darrick J. Wong
2022-12-30 22:13   ` [PATCH 08/21] xfs: enable xlog users to toggle atomic " Darrick J. Wong
2022-12-30 22:13   ` [PATCH 11/21] xfs: port xfs_swap_extents_rmap to our new code Darrick J. Wong
2022-12-30 22:13   ` [PATCH 10/21] xfs: add error injection to test swapext recovery Darrick J. Wong
2022-12-30 22:13   ` [PATCH 09/21] xfs: add a ->xchg_file_range handler Darrick J. Wong
2022-12-30 22:13   ` [PATCH 14/21] xfs: allow xfs_swap_range to use older extent swap algorithms Darrick J. Wong
2022-12-30 22:13   ` [PATCH 18/21] xfs: condense symbolic links after an atomic swap Darrick J. Wong
2022-12-30 22:13   ` [PATCH 13/21] xfs: port xfs_swap_extent_forks to use xfs_swapext_req Darrick J. Wong
2022-12-30 22:13   ` [PATCH 17/21] xfs: condense directories after an atomic swap Darrick J. Wong
2022-12-30 22:13   ` [PATCH 16/21] xfs: condense extended attributes " Darrick J. Wong
2022-12-30 22:13   ` [PATCH 12/21] xfs: consolidate all of the xfs_swap_extent_forks code Darrick J. Wong
2022-12-30 22:13   ` [PATCH 15/21] xfs: remove old swap extents implementation Darrick J. Wong
2022-12-30 22:13   ` [PATCH 20/21] xfs: support non-power-of-two rtextsize with exchange-range Darrick J. Wong
2022-12-30 22:13   ` [PATCH 19/21] xfs: make atomic extent swapping support realtime files Darrick J. Wong
2022-12-30 22:13   ` [PATCH 21/21] xfs: enable atomic swapext feature Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/4] xfs: create temporary files for online repair Darrick J. Wong
2022-12-30 22:14   ` [PATCH 4/4] xfs: add the ability to reap entire inode forks Darrick J. Wong
2022-12-30 22:14   ` [PATCH 2/4] xfs: create temporary files and directories for online repair Darrick J. Wong
2022-12-30 22:14   ` [PATCH 3/4] xfs: refactor stale buffer scanning for repairs Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/4] xfs: hide private inodes from bulkstat and handle functions Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/3] xfs: online repair of realtime summaries Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/3] xfs: support preallocating and copying content into temporary files Darrick J. Wong
2022-12-30 22:14   ` [PATCH 3/3] xfs: online repair of realtime summaries Darrick J. Wong
2022-12-30 22:14   ` [PATCH 2/3] xfs: teach the tempfile to support atomic extent swapping Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/9] xfs: set and validate dir/attr block owners Darrick J. Wong
2022-12-30 22:14   ` [PATCH 2/9] xfs: use the xfs_da_args owner field to set new dir/attr block owner Darrick J. Wong
2022-12-30 22:14   ` [PATCH 4/9] xfs: validate attr remote value buffer owners Darrick J. Wong
2022-12-30 22:14   ` [PATCH 3/9] xfs: validate attr leaf " Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/9] xfs: add an explicit owner field to xfs_da_args Darrick J. Wong
2022-12-30 22:14   ` [PATCH 5/9] xfs: validate dabtree node buffer owners Darrick J. Wong
2022-12-30 22:14   ` [PATCH 6/9] xfs: validate directory leaf " Darrick J. Wong
2022-12-30 22:14   ` [PATCH 9/9] xfs: validate explicit directory free block owners Darrick J. Wong
2022-12-30 22:14   ` [PATCH 8/9] xfs: validate explicit directory block buffer owners Darrick J. Wong
2022-12-30 22:14   ` [PATCH 7/9] xfs: validate explicit directory data " Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/5] xfs: online repair of extended attributes Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/5] xfs: create a blob array data structure Darrick J. Wong
2022-12-30 22:14   ` [PATCH 5/5] xfs: flag empty xattr leaf blocks for optimization Darrick J. Wong
2022-12-30 22:14   ` [PATCH 3/5] xfs: repair extended attributes Darrick J. Wong
2022-12-30 22:14   ` [PATCH 2/5] xfs: use atomic extent swapping to fix user file fork data Darrick J. Wong
2022-12-30 22:14   ` [PATCH 4/5] xfs: scrub should set preen if attr leaf has holes Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/3] xfs: online repair of directories Darrick J. Wong
2022-12-30 22:14   ` [PATCH 2/3] xfs: online repair of parent pointers Darrick J. Wong
2022-12-30 22:14   ` [PATCH 3/3] xfs: ask the dentry cache if it knows the parent of a directory Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/3] xfs: online repair of directories Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/3] xfs: move orphan files to lost and found Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/3] xfs: move orphan files to the orphanage Darrick J. Wong
2022-12-30 22:14   ` [PATCH 2/3] xfs: move files to orphanage instead of letting nlinks drop to zero Darrick J. Wong
2022-12-30 22:14   ` [PATCH 3/3] xfs: ensure dentry consistency when the orphanage adopts a file Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/1] xfs: online repair of symbolic links Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/1] " Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/1] xfs: online repair of parent pointers Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/1] xfs: create an xattr iteration function for scrub Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/4] xfs: online fsck of iunlink buckets Darrick J. Wong
2022-12-30 22:14   ` [PATCH 2/4] xfs: check AGI unlinked inode buckets Darrick J. Wong
2022-12-30 22:14   ` [PATCH 4/4] xfs: repair AGI unlinked inode bucket lists Darrick J. Wong
2022-12-30 22:14   ` [PATCH 3/4] xfs: hoist AGI repair context to a heap object Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/4] xfs: use i_prev_unlinked to distinguish inodes that are not on the unlinked list Darrick J. Wong
2022-12-30 22:14 ` [PATCHSET v24.0 0/3] xfs: cache xfile pages for better performance Darrick J. Wong
2022-12-30 22:14   ` [PATCH 1/3] xfs: map xfile pages directly into xfs_buf Darrick J. Wong
2022-12-30 22:14   ` [PATCH 2/3] xfs: use b_offset to support direct-mapping pages when blocksize < pagesize Darrick J. Wong
2022-12-30 22:14   ` [PATCH 3/3] xfile: implement write caching Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/5] libxfs: prepare repair for bulk loading Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/5] xfs: implement block reservation accounting for btrees we're staging Darrick J. Wong
2022-12-30 22:17   ` [PATCH 4/5] xfs: constrain dirty buffers while formatting a staged btree Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/5] xfs: force all buffers to be written during btree bulk load Darrick J. Wong
2022-12-30 22:17   ` [PATCH 5/5] xfs_repair: bulk load records into new btree blocks Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/5] xfs: move btree bulkload record initialization to ->get_record implementations Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/3] libxfs: force rebuilding of metadata Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/3] xfs_scrub: try to use XFS_SCRUB_IFLAG_FORCE_REBUILD Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/3] xfs_io: support passing the FORCE_REBUILD flag to online repair Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/3] xfs: allow userspace to rebuild metadata structures Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/4] xfs_scrub: scan metadata files in parallel Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/4] libfrog: promote XFROG_SCRUB_DESCR_SUMMARY to a scrub type Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/4] libfrog: rename XFROG_SCRUB_TYPE_* to XFROG_SCRUB_GROUP_* Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/4] libfrog: rename the scrub "fs" group Darrick J. Wong
2022-12-30 22:17   ` [PATCH 4/4] xfs_scrub: scan metadata files in parallel Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/3] libxfs: online repair of quota counters Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/3] xfs: implement live quotacheck inode scan Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/3] libfrog: create a new scrub group for things requiring full inode scans Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/3] xfs: report the health of quota counts Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/2] xfs_repair: rebuild inode fork mappings Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/2] xfs_repair: push inode buf and dinode pointers all the way to inode fork processing Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/2] xfs_repair: rebuild block mappings from rmapbt data Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/3] libxfs: online repair of file link counts Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/3] xfs: report inode link count health Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/3] xfs: teach scrub to check file nlinks Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/3] xfs_scrub: use multiple threads to run in-kernel metadata scrubs that scan inodes Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/4] libxfs: indirect health reporting Darrick J. Wong
2022-12-30 22:17   ` [PATCH 4/4] xfs_scrub: upload clean bills of health Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/4] xfs: add secondary and indirect classes to the health tracking system Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/4] xfs: update health status if we get a clean bill of health Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/4] xfs: remember sick inodes that get inactivated Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/9] libxfs: support in-memory btrees Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/9] libxfs: add xfile support Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/9] libxfs: clean up xfs_da_unmount usage Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/9] libxfs: teach buftargs to maintain their own buffer hashtable Darrick J. Wong
2022-12-30 22:17   ` [PATCH 9/9] xfbtree: let the buffer cache flush dirty buffers to the xfile Darrick J. Wong
2022-12-30 22:17   ` [PATCH 4/9] libxfs: support in-memory buffer cache targets Darrick J. Wong
2022-12-30 22:17   ` [PATCH 8/9] xfs: connect in-memory btrees to xfiles Darrick J. Wong
2022-12-30 22:17   ` [PATCH 5/9] xfs: consolidate btree block freeing tracepoints Darrick J. Wong
2022-12-30 22:17   ` [PATCH 7/9] xfs: support in-memory btrees Darrick J. Wong
2022-12-30 22:17   ` [PATCH 6/9] xfs: consolidate btree block allocation tracepoints Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/5] libxfs: online repair of rmap btrees Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/5] xfs: create a helper to decide if a file mapping targets the rt volume Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/5] xfs: repair the rmapbt Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/5] xfs: create a shadow rmap btree during rmap repair Darrick J. Wong
2022-12-30 22:17   ` [PATCH 4/5] xfs: hook live rmap operations during a repair operation Darrick J. Wong
2022-12-30 22:17   ` [PATCH 5/5] mkfs: enable reverse mapping by default Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/6] xfs_repair: use in-memory rmap btrees Darrick J. Wong
2022-12-30 22:17   ` [PATCH 6/6] xfs_repair: remove the old rmap collection slabs Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/6] xfs_repair: verify on-disk rmap btrees with in-memory btree data Darrick J. Wong
2022-12-30 22:17   ` [PATCH 4/6] xfs_repair: compute refcount data from in-memory rmap btrees Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/6] libxfs: partition memfd files to avoid using too many fds Darrick J. Wong
2022-12-30 22:17   ` [PATCH 5/6] xfs_repair: reduce rmap bag memory usage when creating refcounts Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/6] xfs_repair: convert regular rmap repair to use in-memory btrees Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/5] xfs_repair: reduce refcount repair memory usage Darrick J. Wong
2022-12-30 22:17   ` [PATCH 4/5] xfs_repair: port to the new refcount bag structure Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/5] xfs_repair: define an in-memory btree for storing refcount bag info Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/5] xfs: " Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/5] xfs_repair: create refcount bag Darrick J. Wong
2022-12-30 22:17   ` [PATCH 5/5] xfs_repair: remove the old bag implementation Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 0/4] libxfs: clean up symbolic link code Darrick J. Wong
2022-12-30 22:17   ` [PATCH 1/4] xfs: move xfs_symlink_remote.c declarations to xfs_symlink_remote.h Darrick J. Wong
2022-12-30 22:17   ` [PATCH 2/4] xfs: move remote symlink target read function to libxfs Darrick J. Wong
2022-12-30 22:17   ` [PATCH 3/4] xfs: move symlink target write " Darrick J. Wong
2022-12-30 22:17   ` [PATCH 4/4] mkfs: use libxfs to create symlinks Darrick J. Wong
2022-12-30 22:17 ` [PATCHSET v24.0 00/19] libxfs: atomic file updates Darrick J. Wong
2022-12-30 22:17   ` [PATCH 03/19] xfs: create a log incompat flag for atomic extent swapping Darrick J. Wong
2022-12-30 22:17   ` [PATCH 04/19] xfs: introduce a swap-extent log intent item Darrick J. Wong
2022-12-30 22:17   ` [PATCH 01/19] vfs: introduce new file range exchange ioctl Darrick J. Wong
2022-12-30 22:17   ` [PATCH 02/19] xfs: parameterize all the incompat log feature helpers Darrick J. Wong
2022-12-30 22:18   ` [PATCH 06/19] xfs: add error injection to test swapext recovery Darrick J. Wong
2022-12-30 22:18   ` [PATCH 08/19] xfs: condense directories after an atomic swap Darrick J. Wong
2022-12-30 22:18   ` [PATCH 11/19] xfs: enable atomic swapext feature Darrick J. Wong
2022-12-30 22:18   ` [PATCH 12/19] libhandle: add support for bulkstat v5 Darrick J. Wong
2022-12-30 22:18   ` [PATCH 07/19] xfs: condense extended attributes after an atomic swap Darrick J. Wong
2022-12-30 22:18   ` [PATCH 09/19] xfs: condense symbolic links " Darrick J. Wong
2022-12-30 22:18   ` [PATCH 10/19] xfs: make atomic extent swapping support realtime files Darrick J. Wong
2022-12-30 22:18   ` [PATCH 05/19] xfs: create deferred log items for extent swapping Darrick J. Wong
2022-12-30 22:18   ` [PATCH 18/19] xfs_io: enhance swapext to take advantage of new api Darrick J. Wong
2022-12-30 22:18   ` [PATCH 19/19] xfs_io: add atomic update commands to exercise extent swapping Darrick J. Wong
2022-12-30 22:18   ` [PATCH 14/19] xfs_logprint: support dumping swapext log items Darrick J. Wong
2022-12-30 22:18   ` [PATCH 16/19] xfs_fsr: port to new swapext library function Darrick J. Wong
2022-12-30 22:18   ` [PATCH 15/19] xfs_fsr: convert to bulkstat v5 ioctls Darrick J. Wong
2022-12-30 22:18   ` [PATCH 17/19] xfs_fsr: skip the xattr/forkoff levering with the newer swapext implementations Darrick J. Wong
2022-12-30 22:18   ` [PATCH 13/19] libfrog: convert xfs_io swapext command to use new libfrog wrapper Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/1] xfs: online fsck of iunlink buckets Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/1] xfs_db: dump unlinked buckets Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/1] xfs: cache xfile pages for better performance Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/1] xfs: map xfile pages directly into xfs_buf Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/6] xfs_scrub: fixes to the repair code Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/6] xfs_scrub: log when a repair was unnecessary Darrick J. Wong
2022-12-30 22:18   ` [PATCH 5/6] xfs_scrub: require primary superblock repairs to complete before proceeding Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/6] xfs_scrub: remove ALP_* flags namespace Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/6] xfs_scrub: don't report media errors for space with unknowable owner Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/6] xfs_scrub: move repair functions to repair.c Darrick J. Wong
2022-12-30 22:18   ` [PATCH 6/6] xfs_scrub: actually try to fix summary counters ahead of repairs Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/6] xfs_scrub: improve warnings about difficult repairs Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/6] xfs_scrub: get rid of trivial fs metadata scanner helpers Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/6] xfs_scrub: collapse trivial superblock scrub helpers Darrick J. Wong
2022-12-30 22:18   ` [PATCH 6/6] xfs_scrub: warn about difficult repairs to rt and quota metadata Darrick J. Wong
2022-12-30 22:18   ` [PATCH 5/6] xfs_scrub: any inconsistency in metadata should trigger difficulty warnings Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/6] xfs_scrub: add missing repair types to the mustfix and difficulty assessment Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/6] xfs_scrub: split up the mustfix repairs and difficulty assessment functions Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/9] xfs_scrub: track data dependencies for repairs Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/9] xfs_scrub: remove scrub_metadata_file Darrick J. Wong
2022-12-30 22:18   ` [PATCH 5/9] xfs_scrub: boost the repair priority of dependencies of damaged items Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/9] xfs_scrub: remove action lists from phaseX code Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/9] xfs_scrub: use repair_item to direct repair activities Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/9] xfs_scrub: track repair items by principal, not by individual repairs Darrick J. Wong
2022-12-30 22:18   ` [PATCH 6/9] xfs_scrub: clean up repair_item_difficulty a little Darrick J. Wong
2022-12-30 22:18   ` [PATCH 8/9] xfs_scrub: retry incomplete repairs Darrick J. Wong
2022-12-30 22:18   ` [PATCH 9/9] xfs_scrub: remove unused action_list fields Darrick J. Wong
2022-12-30 22:18   ` [PATCH 7/9] xfs_scrub: check dependencies of a scrub type before repairing Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/5] xfs_scrub: use scrub_item to track check progress Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/5] xfs_scrub: refactor scrub_meta_type out of existence Darrick J. Wong
2022-12-30 22:18   ` [PATCH 5/5] xfs_scrub: hoist scrub retry loop to scrub_item_check_file Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/5] xfs_scrub: hoist repair retry loop to repair_item_class Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/5] xfs_scrub: remove enum check_outcome Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/5] xfs_scrub: start tracking scrub state in scrub_item Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/4] xfs_scrub: improve scheduling of repair items Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/4] libfrog: enhance ptvar to support initializer functions Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/4] xfs_scrub: recheck entire metadata objects after corruption repairs Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/4] xfs_scrub: improve thread scheduling repair items during phase 4 Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/4] xfs_scrub: try to repair space metadata before file metadata Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/7] xfs_scrub: move fstrim to a separate phase Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/7] xfs_scrub: ignore phase 8 if the user disabled fstrim Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/7] xfs_scrub: collapse trim_filesystem Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/7] xfs_scrub: move FITRIM to phase 8 Darrick J. Wong
2022-12-30 22:18   ` [PATCH 7/7] xfs_scrub: fstrim each AG in parallel Darrick J. Wong
2022-12-30 22:18   ` [PATCH 6/7] xfs_scrub: don't call FITRIM after runtime errors Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/7] xfs_scrub: fix the work estimation for phase 8 Darrick J. Wong
2022-12-30 22:18   ` [PATCH 5/7] xfs_scrub: report FITRIM errors properly Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/8] xfs_scrub: fixes for systemd services Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/8] xfs_scrub_fail: escape paths correctly Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/8] xfs_scrub_fail: fix sendmail detection Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/8] debian: install scrub services with dh_installsystemd Darrick J. Wong
2022-12-30 22:18   ` [PATCH 5/8] xfs_scrub_fail: return the failure status of the mailer program Darrick J. Wong
2022-12-30 22:18   ` [PATCH 7/8] xfs_scrub_all: escape service names consistently Darrick J. Wong
2022-12-30 22:18   ` [PATCH 6/8] xfs_scrub_all: fix argument passing when invoking xfs_scrub manually Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/8] xfs_scrub: add missing copyrights and spdx headers Darrick J. Wong
2022-12-30 22:18   ` [PATCH 8/8] xfs_scrub_all: survive systemd restarts when waiting for services Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/5] xfs_scrub: tighten security of systemd services Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/5] xfs_scrub.service: reduce CPU usage to 60% when possible Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/5] xfs_scrub: allow auxiliary pathnames for sandboxing Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/5] xfs_scrub_fail: tighten up the security on the background systemd service Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/5] xfs_scrub: " Darrick J. Wong
2022-12-30 22:18   ` [PATCH 5/5] xfs_scrub_all: " Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/4] xfs_scrub_all: automatic media scan service Darrick J. Wong
2022-12-30 22:18   ` [PATCH 4/4] xfs_scrub_all: failure reporting for the xfs_scrub_all job Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/4] xfs_scrub_all: support metadata+media scans of all filesystems Darrick J. Wong
2022-12-30 22:18   ` [PATCH 3/4] xfs_scrub_all: trigger automatic media scans once per month Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/4] xfs_scrub_all: enable periodic file data scrubs automatically Darrick J. Wong
2022-12-30 22:18 ` [PATCHSET v24.0 0/2] xfs_scrub: automatic optimization by default Darrick J. Wong
2022-12-30 22:18   ` [PATCH 1/2] xfs_scrub: automatic downgrades to dry-run mode in service mode Darrick J. Wong
2022-12-30 22:18   ` [PATCH 2/2] xfs_scrub: add an optimization-only mode Darrick J. Wong
2022-12-30 22:19 ` [PATCHSET v24.0 0/5] fstests: race online scrub with fsstress Darrick J. Wong
2022-12-30 22:19   ` [PATCH 2/5] xfs: race fsstress with online scrubbers for AG and fs metadata Darrick J. Wong
2023-02-05 13:04     ` Zorro Lang
2023-02-07 16:58       ` Darrick J. Wong
2023-02-07 17:02     ` [PATCH v24.1 " Darrick J. Wong
2023-02-07 18:45       ` Zorro Lang
2022-12-30 22:19   ` [PATCH 5/5] xfs: race fsstress with online scrubbers for file metadata Darrick J. Wong
2022-12-30 22:19   ` [PATCH 3/5] fuzzy: add a custom xfs find utility for scrub stress tests Darrick J. Wong
2023-02-05 12:57     ` Zorro Lang
2023-02-07 16:57       ` Darrick J. Wong
2023-02-07 17:01     ` [PATCH v24.1 " Darrick J. Wong
2023-02-07 18:42       ` Zorro Lang
2022-12-30 22:19   ` [PATCH 1/5] xfs/357: switch fuzzing to agi 1 Darrick J. Wong
2023-02-07 18:46     ` Zorro Lang
2022-12-30 22:19   ` [PATCH 4/5] fuzzy: allow xfs scrub stress tests to pick preconfigured fsstress configs Darrick J. Wong
2023-02-07 18:48     ` Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/1] xfs: force rebuilding of metadata Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/1] fuzzy: use FORCE_REBUILD over injecting force_repair Darrick J. Wong
2023-02-14  8:00     ` Zorro Lang
2023-02-14 18:18       ` Darrick J. Wong
2023-02-16 14:57         ` Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/2] fstests: online repair of AG btrees Darrick J. Wong
2022-12-30 22:19   ` [PATCH 2/2] xfs: stress test ag repair functions Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/2] xfs: test rebuilding the entire filesystem with online fsck Darrick J. Wong
2023-02-18  6:06   ` [PATCHSET v24.0 0/2] fstests: online repair of AG btrees Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/1] fstests: online repair of inodes Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/1] xfs: race fsstress with online repair for inode record metadata Darrick J. Wong
2023-02-18  6:07     ` Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/4] fstests: online repair of file fork mappings Darrick J. Wong
2022-12-30 22:19   ` [PATCH 4/4] xfs: race fsstress with online repair for special file metadata Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/4] xfs: test rebuilding xattrs when the data fork is btree format Darrick J. Wong
2022-12-30 22:19   ` [PATCH 3/4] xfs: ensure that online file data fork repairs don't hit EDQUOT Darrick J. Wong
2022-12-30 22:19   ` [PATCH 2/4] xfs: race fsstress with online repair for inode and fork metadata Darrick J. Wong
2023-02-18  6:07   ` [PATCHSET v24.0 0/4] fstests: online repair of file fork mappings Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/1] fstests: online repair of quota and counters Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/1] xfs: race fsstress with online scrub and repair for quota metadata Darrick J. Wong
2023-02-18  6:10     ` Zorro Lang
2023-02-18  6:12     ` Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/1] fstests: online repair of quota counters Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/1] xfs: race fsstress with online scrub and repair for quotacheck Darrick J. Wong
2023-02-18  6:12     ` Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/1] fstests: online repair of file link counts Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/1] xfs: race fsstress with inode link count check and repair Darrick J. Wong
2023-02-18  6:13     ` Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/2] fstests: online repair for fs summary counters Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/2] xfs: test fs summary counter online repair Darrick J. Wong
2022-12-30 22:19   ` [PATCH 2/2] xfs: race fsstress with online repair for summary counters Darrick J. Wong
2023-02-18  6:14   ` [PATCHSET v24.0 0/2] fstests: online repair for fs " Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/1] fstests: online repair of rmap btrees Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/1] xfs/422: don't freeze while racing rmap repair and fsstress Darrick J. Wong
2023-02-18  6:15     ` Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 0/2] fstests: fix a few bugs in fs population Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/2] populate: take a snapshot of the filesystem if creation fails Darrick J. Wong
2022-12-30 22:19   ` [PATCH 2/2] populate: fix some weirdness in __populate_check_xfs_agbtree_height Darrick J. Wong
2023-02-18  6:16   ` [PATCHSET v24.0 0/2] fstests: fix a few bugs in fs population Zorro Lang
2022-12-30 22:19 ` [PATCHSET v24.0 00/24] fstests: improve xfs fuzzing Darrick J. Wong
2022-12-30 22:19   ` [PATCH 01/24] fuzzy: disable per-field random fuzzing by default Darrick J. Wong
2022-12-30 22:19   ` [PATCH 02/24] fuzzy: disable timstamp " Darrick J. Wong
2022-12-30 22:19   ` [PATCH 07/24] fuzzy: don't fuzz xattr namespace flags and values Darrick J. Wong
2022-12-30 22:19   ` [PATCH 05/24] fuzzy: don't fuzz inode generation numbers Darrick J. Wong
2022-12-30 22:19   ` [PATCH 03/24] fuzzy: don't fuzz the log sequence number Darrick J. Wong
2022-12-30 22:19   ` [PATCH 06/24] fuzzy: don't fuzz user-controllable inode flags Darrick J. Wong
2022-12-30 22:19   ` [PATCH 04/24] fuzzy: don't fuzz obsolete inode fields Darrick J. Wong
2022-12-30 22:19   ` [PATCH 12/24] common/fuzzy: fix some problems with the offline repair strategy Darrick J. Wong
2022-12-30 22:19   ` [PATCH 11/24] common/fuzzy: fix some problems with the online " Darrick J. Wong
2022-12-30 22:19   ` [PATCH 08/24] common/fuzzy: split out each repair strategy into a separate helper Darrick J. Wong
2022-12-30 22:19   ` [PATCH 10/24] common/fuzzy: hoist the post-repair fs modification step Darrick J. Wong
2022-12-30 22:19   ` [PATCH 09/24] common/fuzzy: add an underline to the full log between sections Darrick J. Wong
2022-12-30 22:19   ` [PATCH 13/24] common/fuzzy: fix some problems with the no-repair strategy Darrick J. Wong
2022-12-30 22:19   ` [PATCH 14/24] common/fuzzy: fix some problems with the online-then-offline repair strategy Darrick J. Wong
2022-12-30 22:19   ` [PATCH 16/24] xfs/{35[45],455}: fix bogus corruption errors Darrick J. Wong
2022-12-30 22:19   ` [PATCH 21/24] fuzzy: compress coredumps created while fuzzing Darrick J. Wong
2022-12-30 22:19   ` [PATCH 15/24] common/fuzzy: fix some problems with the post-repair fs modification code Darrick J. Wong
2022-12-30 22:19   ` [PATCH 19/24] common/fuzzy: exercise the filesystem a little harder after repairing Darrick J. Wong
2022-12-30 22:19   ` [PATCH 22/24] fuzzy: report the fuzzing repair strategy in seqres.full Darrick J. Wong
2022-12-30 22:19   ` [PATCH 17/24] common/fuzzy: evaluate xfs_check vs xfs_repair Darrick J. Wong
2022-12-30 22:19   ` [PATCH 20/24] fuzzy: dump metadata state before fuzzing Darrick J. Wong
2022-12-30 22:19   ` [PATCH 18/24] common: check xfs health after doing an online scrub Darrick J. Wong
2022-12-30 22:19   ` [PATCH 24/24] fuzzy: for fuzzing ag btrees, find the path to the AG header Darrick J. Wong
2022-12-30 22:19   ` [PATCH 23/24] xfs: improve metadata array field handling when fuzzing Darrick J. Wong
2022-12-30 22:19 ` [PATCHSET v24.0 0/5] fstests: strengthen fuzz testing Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/5] fuzzy: test fuzzing directory block mappings Darrick J. Wong
2022-12-30 22:19   ` [PATCH 2/5] fuzzy: test fuzzing xattr " Darrick J. Wong
2022-12-30 22:19   ` [PATCH 5/5] fuzzy: fuzz test key/pointers of inode btrees Darrick J. Wong
2022-12-30 22:19   ` [PATCH 4/5] xfs: fuzz test both repair strategies Darrick J. Wong
2022-12-30 22:19   ` [PATCH 3/5] fuzzy: test fuzzing realtime free space metadata Darrick J. Wong
2022-12-30 22:19 ` [PATCHSET v24.0 0/7] fstests: atomic file updates Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/7] xfs/122: fix for swapext log items Darrick J. Wong
2022-12-30 22:19   ` [PATCH 5/7] generic: test that file privilege gets dropped with FIEXCHANGE_RANGE Darrick J. Wong
2022-12-30 22:19   ` [PATCH 4/7] generic, xfs: test scatter-gather atomic file updates Darrick J. Wong
2022-12-30 22:19   ` [PATCH 3/7] generic: test new vfs swapext ioctl Darrick J. Wong
2022-12-30 22:19   ` [PATCH 2/7] generic: test old xfs extent swapping ioctl Darrick J. Wong
2022-12-30 22:19   ` [PATCH 7/7] fsstress: update for FIEXCHANGE_RANGE Darrick J. Wong
2022-12-30 22:19   ` [PATCH 6/7] fsx: support FIEXCHANGE_RANGE Darrick J. Wong
2023-02-28  1:55     ` Zorro Lang
2023-03-01  2:56       ` Darrick J. Wong
2022-12-30 22:19 ` [PATCHSET v24.0 0/1] fstests: online repair of realtime summaries Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/1] xfs: race fsstress with online repair of realtime summary files Darrick J. Wong
2022-12-30 22:19 ` [PATCHSET v24.0 0/1] fstests: online repair of extended attributes Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/1] xfs: race fsstress with online repair of extended attribute data Darrick J. Wong
2022-12-30 22:19 ` [PATCHSET v24.0 0/2] fstests: online repair of directories Darrick J. Wong
2022-12-30 22:19   ` [PATCH 1/2] xfs: ensure that online directory repairs don't hit EDQUOT Darrick J. Wong
2022-12-30 22:19   ` [PATCH 2/2] xfs: race fsstress with online repair of dirs and parent pointers Darrick J. Wong
2022-12-30 22:20 ` [PATCHSET v24.0 0/1] fstests: test automatic scrub optimization by default Darrick J. Wong
2022-12-30 22:20   ` [PATCH 1/1] xfs: test xfs_scrub dry run, preen, and repair mode Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2023-12-31 19:42 [PATCHSET v29.0 12/40] xfsprogs: online repair of rmap btrees Darrick J. Wong
2023-12-31 22:17 ` [PATCH 2/4] xfs: repair the rmapbt Darrick J. Wong
2023-12-31 19:27 [PATCHSET v29.0 09/28] xfs: online repair of rmap btrees Darrick J. Wong
2023-12-31 20:16 ` [PATCH 2/4] xfs: repair the rmapbt Darrick J. Wong
2023-05-26  0:32 [PATCHSET v25.0 0/4] xfs: online repair of rmap btrees Darrick J. Wong
2023-05-26  1:07 ` [PATCH 2/4] xfs: repair the rmapbt Darrick J. Wong
2019-01-01  2:18 [PATCH v18 0/4] xfs: online repair support Darrick J. Wong
2019-01-01  2:18 ` [PATCH 2/4] xfs: repair the rmapbt Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=167243841031.696748.2811249846332411168.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.