diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-09-01 11:19:47 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-10-22 16:41:11 -0700 |
commit | 8292bf10708c56c449d8ab3ce7ab030b941a313d (patch) | |
tree | 0a13e9aafa9be0c2d50c8084fef7d1923a3d51a7 | |
parent | 0e2e50ea5a14f9969be1cc2929844409df31ccfe (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.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 8e06615b7c23..dfc0697809e7 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_ag.h" #include "xfs_rtrmap_btree.h" +#include "xfs_rtrefcount_btree.h" #include "scrub/xfs_scrub.h" #include "scrub/scrub.h" #include "scrub/common.h" @@ -550,6 +551,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( @@ -581,6 +600,8 @@ xrep_rmap_scan_ifork( 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_REFCOUNT) { + return xrep_rmap_scan_rtrefcountbt(&rf, ip); } else if (ifp->if_format != XFS_DINODE_FMT_EXTENTS) { return 0; } |