[PATCH 24/50] xfs_repair: stop tracking duplicate RT extents with rtgroups

Darrick J. Wong
2024-12-07T00:11:11Z

From: Christoph Hellwig <hch@lst.de>

Nothing ever looks them up, so don't bother with tracking them by
overloading the AG numbers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
repair/incore_ext.c | 5 ++---
repair/phase4.c | 8 ++++++--
2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/repair/incore_ext.c b/repair/incore_ext.c
index a31ef066ef356c..892f9d25588c11 100644
--- a/repair/incore_ext.c
+++ b/repair/incore_ext.c
@@ -725,7 +725,7 @@ static avl64ops_t avl64_extent_tree_ops = {
void
incore_ext_init(xfs_mount_t *mp)
{
- xfs_agnumber_t agcount = mp->m_sb.sb_agcount + mp->m_sb.sb_rgcount;
+ xfs_agnumber_t agcount = mp->m_sb.sb_agcount;
int i;

pthread_mutex_init(&rt_ext_tree_lock, NULL);
@@ -778,10 +778,9 @@ incore_ext_init(xfs_mount_t *mp)
void
incore_ext_teardown(xfs_mount_t *mp)
{
- xfs_agnumber_t agcount = mp->m_sb.sb_agcount + mp->m_sb.sb_rgcount;
xfs_agnumber_t i;

- for (i = 0; i < agcount; i++) {
+ for (i = 0; i < mp->m_sb.sb_agcount; i++) {
btree_destroy(dup_extent_trees[i]);
free(extent_bno_ptrs[i]);
free(extent_bcnt_ptrs[i]);
diff --git a/repair/phase4.c b/repair/phase4.c
index 3a627d8aeea85a..f43f8ecd84e25b 100644
--- a/repair/phase4.c
+++ b/repair/phase4.c
@@ -322,8 +322,12 @@ _("free space (%u,%u-%u) only seen by one free space btree\n"),
case XR_E_FS_MAP:
break;
case XR_E_MULT:
- add_dup_extent(agno + isrt ? mp->m_sb.sb_agcount : 0,
- agbno, blen);
+ /*
+ * Nothing is searching for duplicate RT extents, so
+ * don't bother tracking them.
+ */
+ if (!isrt)
+ add_dup_extent(agno, agbno, blen);
break;