Skip to content

Commit 74f4d6a

Browse files
committed
xfs: only relog deferred intent items if free space in the log gets low
Now that we have the ability to ask the log how far the tail needs to be pushed to maintain its free space targets, augment the decision to relog an intent item so that we only do it if the log has hit the 75% full threshold. There's no point in relogging an intent into the same checkpoint, and there's no need to relog if there's plenty of free space in the log. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
1 parent ed1575d commit 74f4d6a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

fs/xfs/libxfs/xfs_defer.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,10 @@ xfs_defer_relog(
356356
struct xfs_trans **tpp,
357357
struct list_head *dfops)
358358
{
359+
struct xlog *log = (*tpp)->t_mountp->m_log;
359360
struct xfs_defer_pending *dfp;
361+
xfs_lsn_t threshold_lsn = NULLCOMMITLSN;
362+
360363

361364
ASSERT((*tpp)->t_flags & XFS_TRANS_PERM_LOG_RES);
362365

@@ -372,6 +375,19 @@ xfs_defer_relog(
372375
xfs_log_item_in_current_chkpt(dfp->dfp_intent))
373376
continue;
374377

378+
/*
379+
* Figure out where we need the tail to be in order to maintain
380+
* the minimum required free space in the log. Only sample
381+
* the log threshold once per call.
382+
*/
383+
if (threshold_lsn == NULLCOMMITLSN) {
384+
threshold_lsn = xlog_grant_push_threshold(log, 0);
385+
if (threshold_lsn == NULLCOMMITLSN)
386+
break;
387+
}
388+
if (XFS_LSN_CMP(dfp->dfp_intent->li_lsn, threshold_lsn) >= 0)
389+
continue;
390+
375391
trace_xfs_defer_relog_intent((*tpp)->t_mountp, dfp);
376392
XFS_STATS_INC((*tpp)->t_mountp, defer_relog);
377393
dfp->dfp_intent = xfs_trans_item_relog(dfp->dfp_intent, *tpp);

0 commit comments

Comments
 (0)