diff options
author | 2024-06-20 09:21:21 +0200 | |
---|---|---|
committer | 2024-07-04 12:46:46 +0530 | |
commit | b50b4c49d8d79af05ac3bb3587f58589713139cc (patch) | |
tree | e4ce051425ad59239ca4695ead32a4ff1cc85de1 /fs/xfs/xfs_trans_priv.h | |
parent | xfs: AIL doesn't need manual pushing (diff) | |
download | wireguard-linux-b50b4c49d8d79af05ac3bb3587f58589713139cc.tar.xz wireguard-linux-b50b4c49d8d79af05ac3bb3587f58589713139cc.zip |
xfs: background AIL push should target physical space
Currently the AIL attempts to keep 25% of the "log space" free,
where the current used space is tracked by the reserve grant head.
That is, it tracks both physical space used plus the amount reserved
by transactions in progress.
When we start tail pushing, we are trying to make space for new
reservations by writing back older metadata and the log is generally
physically full of dirty metadata, and reservations for modifications
in flight take up whatever space the AIL can physically free up.
Hence we don't really need to take into account the reservation
space that has been used - we just need to keep the log tail moving
as fast as we can to free up space for more reservations to be made.
We know exactly how much physical space the journal is consuming in
the AIL (i.e. max LSN - min LSN) so we can base push thresholds
directly on this state rather than have to look at grant head
reservations to determine how much to physically push out of the
log.
This also allows code that needs to know if log items in the current
transaction need to be pushed or re-logged to simply sample the
current target - they don't need to calculate the current target
themselves. This avoids the need for any locking when doing such
checks.
Further, moving to a physical target means we don't need "push all
until empty semantics" like were introduced in the previous patch.
We can now test and clear the "push all" as a one-shot command to
set the target to the current head of the AIL. This allows the
xfsaild to maximise the use of log space right up to the point where
conditions indicate that the xfsaild is not keeping up with load and
it needs to work harder, and as soon as those constraints go away
(i.e. external code no longer needs everything pushed) the xfsaild
will return to maintaining the normal 25% free space thresholds.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_trans_priv.h')
-rw-r--r-- | fs/xfs/xfs_trans_priv.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h index 9a131e7fae94..60b4707c3a65 100644 --- a/fs/xfs/xfs_trans_priv.h +++ b/fs/xfs/xfs_trans_priv.h @@ -59,6 +59,7 @@ struct xfs_ail { unsigned long ail_opstate; struct list_head ail_buf_list; wait_queue_head_t ail_empty; + xfs_lsn_t ail_target; }; /* Push all items out of the AIL immediately. */ @@ -111,15 +112,9 @@ static inline void xfs_ail_push_all(struct xfs_ail *ailp) xfs_ail_push(ailp); } -xfs_lsn_t __xfs_ail_push_target(struct xfs_ail *ailp); -static inline xfs_lsn_t xfs_ail_push_target(struct xfs_ail *ailp) +static inline xfs_lsn_t xfs_ail_get_push_target(struct xfs_ail *ailp) { - xfs_lsn_t lsn; - - spin_lock(&ailp->ail_lock); - lsn = __xfs_ail_push_target(ailp); - spin_unlock(&ailp->ail_lock); - return lsn; + return READ_ONCE(ailp->ail_target); } void xfs_ail_push_all_sync(struct xfs_ail *ailp); |