On Thu, May 25, 2023 at 05:44:17PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@xxxxxxxxxx> > > Use deferred frees (EFIs) to reap the blocks of a btree that we just > replaced. This helps us to shrink the window in which those old blocks > could be lost due to a system crash, though we try to flush the EFIs > every few hundred blocks so that we don't also overflow the transaction > reservations during and after we commit the new btree. > > Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> > --- > fs/xfs/scrub/reap.c | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) ..... > @@ -207,13 +212,22 @@ xrep_reap_block( > xrep_block_reap_binval(sc, fsbno); > error = xrep_put_freelist(sc, agbno); > } else { > + /* > + * Use deferred frees to get rid of the old btree blocks to try > + * to minimize the window in which we could crash and lose the > + * old blocks. However, we still need to roll the transaction > + * every 100 or so EFIs so that we don't exceed the log > + * reservation. > + */ > xrep_block_reap_binval(sc, fsbno); > - error = xfs_free_extent(sc->tp, sc->sa.pag, agbno, 1, rs->oinfo, > - rs->resv); > + __xfs_free_extent_later(sc->tp, fsbno, 1, rs->oinfo, true); Need to capture the returned error here. -Dave. -- Dave Chinner david@xxxxxxxxxxxxx