summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-01-05 17:47:10 -0800
committerDarrick J. Wong <djwong@kernel.org>2021-03-25 17:08:52 -0700
commit68982df17e98c68896294470d757c128015b82b1 (patch)
treef4d801b8adafbebf05f5ec2c1cc7e4d0faf9acc5
parent43cc62e700df33db56f4b7bd92dbafd32aaf5a71 (diff)
xfs: walk the rt reference count tree when rebuilding rmap
When we're rebuilding the data device rmap, if we encounter a "refcount" format fork, we have to walk the (realtime) refcount btree inode to build the appropriate mappings. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r--fs/xfs/scrub/rmap_repair.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/xfs/scrub/rmap_repair.c b/fs/xfs/scrub/rmap_repair.c
index 4aca87c70eec..6d40d6fbf1fa 100644
--- a/fs/xfs/scrub/rmap_repair.c
+++ b/fs/xfs/scrub/rmap_repair.c
@@ -29,6 +29,7 @@
#include "xfs_refcount_btree.h"
#include "xfs_iwalk.h"
#include "xfs_rtrmap_btree.h"
+#include "xfs_rtrefcount_btree.h"
#include "scrub/xfs_scrub.h"
#include "scrub/scrub.h"
#include "scrub/common.h"
@@ -540,6 +541,24 @@ xrep_rmap_scan_rtrmapbt(
return error;
}
+static int
+xrep_rmap_scan_rtrefcountbt(
+ struct xrep_rmap_ifork *rf,
+ struct xfs_inode *ip)
+{
+ struct xfs_scrub *sc = rf->rr->sc;
+ struct xfs_btree_cur *cur;
+ int error;
+
+ if (ip != sc->mp->m_rrefcountip || rf->whichfork != XFS_DATA_FORK)
+ return -EFSCORRUPTED;
+
+ cur = xfs_rtrefcountbt_init_cursor(sc->mp, sc->tp, ip);
+ error = xrep_rmap_scan_iroot_btree(rf, cur);
+ xfs_btree_del_cursor(cur, error);
+ return error;
+}
+
/* Find all the extents from a given AG in an inode fork. */
STATIC int
xrep_rmap_scan_ifork(
@@ -570,6 +589,8 @@ xrep_rmap_scan_ifork(
break;
case XFS_DINODE_FMT_RMAP:
return xrep_rmap_scan_rtrmapbt(&rf, ip);
+ case XFS_DINODE_FMT_REFCOUNT:
+ return xrep_rmap_scan_rtrefcountbt(&rf, ip);
default:
return 0;
}