On Sun, Sep 27, 2020 at 04:41:27PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > When xfs_defer_capture extracts the deferred ops and transaction state > from a transaction, it should absorb the remaining block reservation so > that when we continue the dfops chain, we still have those blocks to > use. > > This adds the requirement that every log intent item recovery function > must be careful to reserve enough blocks to handle both itself and all > defer ops that it can queue. On the other hand, this enables us to do > away with the handwaving block estimation nonsense that was going on in > xlog_finish_defer_ops. > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > Reviewed-by: Christoph Hellwig <hch@xxxxxx> > --- > fs/xfs/libxfs/xfs_defer.c | 4 ++++ > fs/xfs/libxfs/xfs_defer.h | 1 + > fs/xfs/xfs_log_recover.c | 18 +----------------- > 3 files changed, 6 insertions(+), 17 deletions(-) > > > diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c > index 0de7672fe63d..85d70f1edc1c 100644 > --- a/fs/xfs/libxfs/xfs_defer.c > +++ b/fs/xfs/libxfs/xfs_defer.c > @@ -574,6 +574,8 @@ xfs_defer_capture( > list_splice_init(&tp->t_dfops, &dfc->dfc_dfops); > dfc->dfc_tpflags = tp->t_flags & XFS_TRANS_LOWMODE; > tp->t_flags &= ~XFS_TRANS_LOWMODE; > + dfc->dfc_blkres = tp->t_blk_res - tp->t_blk_res_used; > + tp->t_blk_res = tp->t_blk_res_used; > > return dfc; > } I think this needs an explanation in the function/API comment to explain why it is being done. Otherwise looks good. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> -- Dave Chinner david@xxxxxxxxxxxxx