@@ -435,6 +435,7 @@ struct xlog {
struct xlog_grant_head l_reserve_head;
struct xlog_grant_head l_write_head;
+ uint64_t l_tail_space;
struct xfs_kobj l_kobj;
@@ -1213,6 +1213,8 @@ xlog_set_state(
log->l_curr_cycle++;
atomic64_set(&log->l_tail_lsn, be64_to_cpu(rhead->h_tail_lsn));
log->l_ailp->ail_max_seen_lsn = be64_to_cpu(rhead->h_lsn);
+ WRITE_ONCE(log->l_tail_space, atomic64_read(&log->l_tail_lsn) -
+ log->l_ailp->ail_max_seen_lsn);
xlog_assign_grant_head(&log->l_reserve_head.grant, log->l_curr_cycle,
BBTOB(log->l_curr_block));
xlog_assign_grant_head(&log->l_write_head.grant, log->l_curr_cycle,
@@ -728,6 +728,8 @@ xfs_ail_update_tail_lsn(
if (!tail_lsn)
tail_lsn = ailp->ail_max_seen_lsn;
+ WRITE_ONCE(log->l_tail_space,
+ xlog_lsn_sub(log, ailp->ail_max_seen_lsn, tail_lsn));
trace_xfs_log_assign_tail_lsn(log, tail_lsn);
atomic64_set(&log->l_tail_lsn, tail_lsn);
}
@@ -735,7 +737,7 @@ xfs_ail_update_tail_lsn(
/*
* Callers should pass the the original tail lsn so that we can detect if the
* tail has moved as a result of the operation that was performed. If the caller
- * needs to force a tail LSN update, it should pass NULLCOMMITLSN to bypass the
+ * needs to force a tail space update, it should pass NULLCOMMITLSN to bypass the
* "did the tail LSN change?" checks.
*/
void
@@ -822,8 +824,10 @@ xfs_trans_ail_update_bulk(
* If this is the highest LSN we've seen in the AIL, update the tracking
* so that we know what to set the tail to when the AIL is next emptied.
*/
- if (XFS_LSN_CMP(lsn, ailp->ail_max_seen_lsn) > 0)
+ if (XFS_LSN_CMP(lsn, ailp->ail_max_seen_lsn) > 0) {
ailp->ail_max_seen_lsn = lsn;
+ tail_lsn = NULLCOMMITLSN;
+ }
/*
* If this is the first insert, wake up the push daemon so it can