diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-01-05 17:46:03 -0800 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-03-25 17:08:46 -0700 |
commit | 51459ce9b02e593330b6e4706f42e3fba73fc5cb (patch) | |
tree | a5eef46409fadcb864c92e139f7f8902a91d3ea7 /fs/xfs | |
parent | 02080c0dbabd98aceec5631d298de5125489149a (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>
Diffstat (limited to 'fs/xfs')
-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 9495dac6eb4f..2dd759b893a6 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_iwalk.h" +#include "xfs_rtrmap_btree.h" #include "scrub/xfs_scrub.h" #include "scrub/scrub.h" #include "scrub/common.h" @@ -521,6 +522,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( @@ -549,6 +568,8 @@ xrep_rmap_scan_ifork( break; case XFS_DINODE_FMT_EXTENTS: break; + case XFS_DINODE_FMT_RMAP: + return xrep_rmap_scan_rtrmapbt(&rf, ip); default: return 0; } |