diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-09-01 11:17:58 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-10-22 16:41:04 -0700 |
commit | e5964e9802e0f2fe85e8caea2b9ac8615f652b9c (patch) | |
tree | bebb707e66d1c30578aa4163d3de8ebc7888db3f | |
parent | 6ea48470578cc05e17a8a6f0fdeda95b6ecf69da (diff) |
xfs: walk the rt reverse mapping tree when rebuilding rmap
When we're rebuilding the data device rmap, if we encounter an "rmap"
format fork, we have to walk the (realtime) rmap btree inode to build
the appropriate mappings.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r-- | fs/xfs/scrub/rmap_repair.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/xfs/scrub/rmap_repair.c b/fs/xfs/scrub/rmap_repair.c index 20ce8b091685..ab610a409cb6 100644 --- a/fs/xfs/scrub/rmap_repair.c +++ b/fs/xfs/scrub/rmap_repair.c @@ -28,6 +28,7 @@ #include "xfs_refcount.h" #include "xfs_refcount_btree.h" #include "xfs_ag.h" +#include "xfs_rtrmap_btree.h" #include "scrub/xfs_scrub.h" #include "scrub/scrub.h" #include "scrub/common.h" @@ -531,6 +532,24 @@ xrep_rmap_scan_iext( return xrep_rmap_stash_accumulated(rf); } +static int +xrep_rmap_scan_rtrmapbt( + 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_rrmapip || rf->whichfork != XFS_DATA_FORK) + return -EFSCORRUPTED; + + cur = xfs_rtrmapbt_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( @@ -560,6 +579,8 @@ xrep_rmap_scan_ifork( error = xrep_rmap_scan_bmbt(&rf, ip, &mappings_done); if (error || mappings_done) return error; + } else if (ifp->if_format == XFS_DINODE_FMT_RMAP) { + return xrep_rmap_scan_rtrmapbt(&rf, ip); } else if (ifp->if_format != XFS_DINODE_FMT_EXTENTS) { return 0; } |