xfs: AIL should be log centric

The AIL operates purely on log items, so it is a log centric
subsystem. Divorce it from the xfs_mount and instead have it pass
around xlog pointers.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
Dave Chinner 2022-03-17 09:09:12 -07:00 committed by Darrick J. Wong
parent d86142dd7c
commit 8eda872110
3 changed files with 16 additions and 15 deletions

View file

@ -775,7 +775,7 @@ xfs_trans_committed_bulk(
* object into the AIL as we are in a shutdown situation. * object into the AIL as we are in a shutdown situation.
*/ */
if (aborted) { if (aborted) {
ASSERT(xfs_is_shutdown(ailp->ail_mount)); ASSERT(xlog_is_shutdown(ailp->ail_log));
if (lip->li_ops->iop_unpin) if (lip->li_ops->iop_unpin)
lip->li_ops->iop_unpin(lip, 1); lip->li_ops->iop_unpin(lip, 1);
continue; continue;

View file

@ -398,7 +398,7 @@ xfsaild_push_item(
* If log item pinning is enabled, skip the push and track the item as * If log item pinning is enabled, skip the push and track the item as
* pinned. This can help induce head-behind-tail conditions. * pinned. This can help induce head-behind-tail conditions.
*/ */
if (XFS_TEST_ERROR(false, ailp->ail_mount, XFS_ERRTAG_LOG_ITEM_PIN)) if (XFS_TEST_ERROR(false, ailp->ail_log->l_mp, XFS_ERRTAG_LOG_ITEM_PIN))
return XFS_ITEM_PINNED; return XFS_ITEM_PINNED;
/* /*
@ -418,7 +418,7 @@ static long
xfsaild_push( xfsaild_push(
struct xfs_ail *ailp) struct xfs_ail *ailp)
{ {
xfs_mount_t *mp = ailp->ail_mount; struct xfs_mount *mp = ailp->ail_log->l_mp;
struct xfs_ail_cursor cur; struct xfs_ail_cursor cur;
struct xfs_log_item *lip; struct xfs_log_item *lip;
xfs_lsn_t lsn; xfs_lsn_t lsn;
@ -443,7 +443,7 @@ xfsaild_push(
ailp->ail_log_flush = 0; ailp->ail_log_flush = 0;
XFS_STATS_INC(mp, xs_push_ail_flush); XFS_STATS_INC(mp, xs_push_ail_flush);
xlog_cil_flush(mp->m_log); xlog_cil_flush(ailp->ail_log);
} }
spin_lock(&ailp->ail_lock); spin_lock(&ailp->ail_lock);
@ -632,7 +632,7 @@ xfsaild(
* opportunity to release such buffers from the queue. * opportunity to release such buffers from the queue.
*/ */
ASSERT(list_empty(&ailp->ail_buf_list) || ASSERT(list_empty(&ailp->ail_buf_list) ||
xfs_is_shutdown(ailp->ail_mount)); xlog_is_shutdown(ailp->ail_log));
xfs_buf_delwri_cancel(&ailp->ail_buf_list); xfs_buf_delwri_cancel(&ailp->ail_buf_list);
break; break;
} }
@ -695,7 +695,7 @@ xfs_ail_push(
struct xfs_log_item *lip; struct xfs_log_item *lip;
lip = xfs_ail_min(ailp); lip = xfs_ail_min(ailp);
if (!lip || xfs_is_shutdown(ailp->ail_mount) || if (!lip || xlog_is_shutdown(ailp->ail_log) ||
XFS_LSN_CMP(threshold_lsn, ailp->ail_target) <= 0) XFS_LSN_CMP(threshold_lsn, ailp->ail_target) <= 0)
return; return;
@ -751,7 +751,7 @@ xfs_ail_update_finish(
struct xfs_ail *ailp, struct xfs_ail *ailp,
xfs_lsn_t old_lsn) __releases(ailp->ail_lock) xfs_lsn_t old_lsn) __releases(ailp->ail_lock)
{ {
struct xfs_mount *mp = ailp->ail_mount; struct xlog *log = ailp->ail_log;
/* if the tail lsn hasn't changed, don't do updates or wakeups. */ /* if the tail lsn hasn't changed, don't do updates or wakeups. */
if (!old_lsn || old_lsn == __xfs_ail_min_lsn(ailp)) { if (!old_lsn || old_lsn == __xfs_ail_min_lsn(ailp)) {
@ -759,13 +759,13 @@ xfs_ail_update_finish(
return; return;
} }
if (!xfs_is_shutdown(mp)) if (!xlog_is_shutdown(log))
xlog_assign_tail_lsn_locked(mp); xlog_assign_tail_lsn_locked(log->l_mp);
if (list_empty(&ailp->ail_head)) if (list_empty(&ailp->ail_head))
wake_up_all(&ailp->ail_empty); wake_up_all(&ailp->ail_empty);
spin_unlock(&ailp->ail_lock); spin_unlock(&ailp->ail_lock);
xfs_log_space_wake(mp); xfs_log_space_wake(log->l_mp);
} }
/* /*
@ -873,13 +873,13 @@ xfs_trans_ail_delete(
int shutdown_type) int shutdown_type)
{ {
struct xfs_ail *ailp = lip->li_ailp; struct xfs_ail *ailp = lip->li_ailp;
struct xfs_mount *mp = ailp->ail_mount; struct xfs_mount *mp = ailp->ail_log->l_mp;
xfs_lsn_t tail_lsn; xfs_lsn_t tail_lsn;
spin_lock(&ailp->ail_lock); spin_lock(&ailp->ail_lock);
if (!test_bit(XFS_LI_IN_AIL, &lip->li_flags)) { if (!test_bit(XFS_LI_IN_AIL, &lip->li_flags)) {
spin_unlock(&ailp->ail_lock); spin_unlock(&ailp->ail_lock);
if (shutdown_type && !xfs_is_shutdown(mp)) { if (shutdown_type && !xlog_is_shutdown(ailp->ail_log)) {
xfs_alert_tag(mp, XFS_PTAG_AILDELETE, xfs_alert_tag(mp, XFS_PTAG_AILDELETE,
"%s: attempting to delete a log item that is not in the AIL", "%s: attempting to delete a log item that is not in the AIL",
__func__); __func__);
@ -904,7 +904,7 @@ xfs_trans_ail_init(
if (!ailp) if (!ailp)
return -ENOMEM; return -ENOMEM;
ailp->ail_mount = mp; ailp->ail_log = mp->m_log;
INIT_LIST_HEAD(&ailp->ail_head); INIT_LIST_HEAD(&ailp->ail_head);
INIT_LIST_HEAD(&ailp->ail_cursors); INIT_LIST_HEAD(&ailp->ail_cursors);
spin_lock_init(&ailp->ail_lock); spin_lock_init(&ailp->ail_lock);
@ -912,7 +912,7 @@ xfs_trans_ail_init(
init_waitqueue_head(&ailp->ail_empty); init_waitqueue_head(&ailp->ail_empty);
ailp->ail_task = kthread_run(xfsaild, ailp, "xfsaild/%s", ailp->ail_task = kthread_run(xfsaild, ailp, "xfsaild/%s",
ailp->ail_mount->m_super->s_id); mp->m_super->s_id);
if (IS_ERR(ailp->ail_task)) if (IS_ERR(ailp->ail_task))
goto out_free_ailp; goto out_free_ailp;

View file

@ -6,6 +6,7 @@
#ifndef __XFS_TRANS_PRIV_H__ #ifndef __XFS_TRANS_PRIV_H__
#define __XFS_TRANS_PRIV_H__ #define __XFS_TRANS_PRIV_H__
struct xlog;
struct xfs_log_item; struct xfs_log_item;
struct xfs_mount; struct xfs_mount;
struct xfs_trans; struct xfs_trans;
@ -50,7 +51,7 @@ struct xfs_ail_cursor {
* Eventually we need to drive the locking in here as well. * Eventually we need to drive the locking in here as well.
*/ */
struct xfs_ail { struct xfs_ail {
struct xfs_mount *ail_mount; struct xlog *ail_log;
struct task_struct *ail_task; struct task_struct *ail_task;
struct list_head ail_head; struct list_head ail_head;
xfs_lsn_t ail_target; xfs_lsn_t ail_target;