diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-08-10 16:48:03 +0200 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2023-08-10 16:48:03 +0200 |
commit | 77a1396f9ff112d71460edc43d74a019ba420979 (patch) | |
tree | fc33c31f762b94b3d26f215921d6875e1ceec3f8 /fs/xfs/scrub/reap.c | |
parent | xfs: use deferred frees to reap old btree blocks (diff) | |
download | linux-77a1396f9ff112d71460edc43d74a019ba420979.tar.xz linux-77a1396f9ff112d71460edc43d74a019ba420979.zip |
xfs: rearrange xrep_reap_block to make future code flow easier
Rearrange the logic inside xrep_reap_block to make it more obvious that
crosslinked metadata blocks are handled differently. Add a couple of
tracepoints so that we can tell what's going on at the end of a btree
rebuild operation.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/scrub/reap.c')
-rw-r--r-- | fs/xfs/scrub/reap.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/xfs/scrub/reap.c b/fs/xfs/scrub/reap.c index 9b0373dde7ab..847c6f836102 100644 --- a/fs/xfs/scrub/reap.c +++ b/fs/xfs/scrub/reap.c @@ -175,8 +175,6 @@ xrep_reap_block( agno = XFS_FSB_TO_AGNO(sc->mp, fsbno); agbno = XFS_FSB_TO_AGBNO(sc->mp, fsbno); - trace_xrep_dispose_btree_extent(sc->mp, agno, agbno, 1); - /* We don't support reaping file extents yet. */ if (sc->ip != NULL || sc->sa.pag->pag_agno != agno) { ASSERT(0); @@ -206,10 +204,21 @@ xrep_reap_block( * to run xfs_repair. */ if (has_other_rmap) { + trace_xrep_dispose_unmap_extent(sc->sa.pag, agbno, 1); + error = xfs_rmap_free(sc->tp, sc->sa.agf_bp, sc->sa.pag, agbno, 1, rs->oinfo); - } else if (rs->resv == XFS_AG_RESV_AGFL) { - xrep_block_reap_binval(sc, fsbno); + if (error) + return error; + + goto roll_out; + } + + trace_xrep_dispose_free_extent(sc->sa.pag, agbno, 1); + + xrep_block_reap_binval(sc, fsbno); + + if (rs->resv == XFS_AG_RESV_AGFL) { error = xrep_put_freelist(sc, agbno); } else { /* @@ -219,7 +228,6 @@ xrep_reap_block( * every 100 or so EFIs so that we don't exceed the log * reservation. */ - xrep_block_reap_binval(sc, fsbno); error = __xfs_free_extent_later(sc->tp, fsbno, 1, rs->oinfo, rs->resv, true); if (error) @@ -230,6 +238,7 @@ xrep_reap_block( if (error || !need_roll) return error; +roll_out: rs->deferred = 0; return xrep_roll_ag_trans(sc); } |