Skip to content

Commit 8eda872

Browse files
dgchinnerDarrick J. Wong
authored andcommitted
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>
1 parent d86142d commit 8eda872

3 files changed

Lines changed: 16 additions & 15 deletions

File tree

fs/xfs/xfs_trans.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ xfs_trans_committed_bulk(
775775
* object into the AIL as we are in a shutdown situation.
776776
*/
777777
if (aborted) {
778-
ASSERT(xfs_is_shutdown(ailp->ail_mount));
778+
ASSERT(xlog_is_shutdown(ailp->ail_log));
779779
if (lip->li_ops->iop_unpin)
780780
lip->li_ops->iop_unpin(lip, 1);
781781
continue;

fs/xfs/xfs_trans_ail.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ xfsaild_push_item(
398398
* If log item pinning is enabled, skip the push and track the item as
399399
* pinned. This can help induce head-behind-tail conditions.
400400
*/
401-
if (XFS_TEST_ERROR(false, ailp->ail_mount, XFS_ERRTAG_LOG_ITEM_PIN))
401+
if (XFS_TEST_ERROR(false, ailp->ail_log->l_mp, XFS_ERRTAG_LOG_ITEM_PIN))
402402
return XFS_ITEM_PINNED;
403403

404404
/*
@@ -418,7 +418,7 @@ static long
418418
xfsaild_push(
419419
struct xfs_ail *ailp)
420420
{
421-
xfs_mount_t *mp = ailp->ail_mount;
421+
struct xfs_mount *mp = ailp->ail_log->l_mp;
422422
struct xfs_ail_cursor cur;
423423
struct xfs_log_item *lip;
424424
xfs_lsn_t lsn;
@@ -443,7 +443,7 @@ xfsaild_push(
443443
ailp->ail_log_flush = 0;
444444

445445
XFS_STATS_INC(mp, xs_push_ail_flush);
446-
xlog_cil_flush(mp->m_log);
446+
xlog_cil_flush(ailp->ail_log);
447447
}
448448

449449
spin_lock(&ailp->ail_lock);
@@ -632,7 +632,7 @@ xfsaild(
632632
* opportunity to release such buffers from the queue.
633633
*/
634634
ASSERT(list_empty(&ailp->ail_buf_list) ||
635-
xfs_is_shutdown(ailp->ail_mount));
635+
xlog_is_shutdown(ailp->ail_log));
636636
xfs_buf_delwri_cancel(&ailp->ail_buf_list);
637637
break;
638638
}
@@ -695,7 +695,7 @@ xfs_ail_push(
695695
struct xfs_log_item *lip;
696696

697697
lip = xfs_ail_min(ailp);
698-
if (!lip || xfs_is_shutdown(ailp->ail_mount) ||
698+
if (!lip || xlog_is_shutdown(ailp->ail_log) ||
699699
XFS_LSN_CMP(threshold_lsn, ailp->ail_target) <= 0)
700700
return;
701701

@@ -751,21 +751,21 @@ xfs_ail_update_finish(
751751
struct xfs_ail *ailp,
752752
xfs_lsn_t old_lsn) __releases(ailp->ail_lock)
753753
{
754-
struct xfs_mount *mp = ailp->ail_mount;
754+
struct xlog *log = ailp->ail_log;
755755

756756
/* if the tail lsn hasn't changed, don't do updates or wakeups. */
757757
if (!old_lsn || old_lsn == __xfs_ail_min_lsn(ailp)) {
758758
spin_unlock(&ailp->ail_lock);
759759
return;
760760
}
761761

762-
if (!xfs_is_shutdown(mp))
763-
xlog_assign_tail_lsn_locked(mp);
762+
if (!xlog_is_shutdown(log))
763+
xlog_assign_tail_lsn_locked(log->l_mp);
764764

765765
if (list_empty(&ailp->ail_head))
766766
wake_up_all(&ailp->ail_empty);
767767
spin_unlock(&ailp->ail_lock);
768-
xfs_log_space_wake(mp);
768+
xfs_log_space_wake(log->l_mp);
769769
}
770770

771771
/*
@@ -873,13 +873,13 @@ xfs_trans_ail_delete(
873873
int shutdown_type)
874874
{
875875
struct xfs_ail *ailp = lip->li_ailp;
876-
struct xfs_mount *mp = ailp->ail_mount;
876+
struct xfs_mount *mp = ailp->ail_log->l_mp;
877877
xfs_lsn_t tail_lsn;
878878

879879
spin_lock(&ailp->ail_lock);
880880
if (!test_bit(XFS_LI_IN_AIL, &lip->li_flags)) {
881881
spin_unlock(&ailp->ail_lock);
882-
if (shutdown_type && !xfs_is_shutdown(mp)) {
882+
if (shutdown_type && !xlog_is_shutdown(ailp->ail_log)) {
883883
xfs_alert_tag(mp, XFS_PTAG_AILDELETE,
884884
"%s: attempting to delete a log item that is not in the AIL",
885885
__func__);
@@ -904,15 +904,15 @@ xfs_trans_ail_init(
904904
if (!ailp)
905905
return -ENOMEM;
906906

907-
ailp->ail_mount = mp;
907+
ailp->ail_log = mp->m_log;
908908
INIT_LIST_HEAD(&ailp->ail_head);
909909
INIT_LIST_HEAD(&ailp->ail_cursors);
910910
spin_lock_init(&ailp->ail_lock);
911911
INIT_LIST_HEAD(&ailp->ail_buf_list);
912912
init_waitqueue_head(&ailp->ail_empty);
913913

914914
ailp->ail_task = kthread_run(xfsaild, ailp, "xfsaild/%s",
915-
ailp->ail_mount->m_super->s_id);
915+
mp->m_super->s_id);
916916
if (IS_ERR(ailp->ail_task))
917917
goto out_free_ailp;
918918

fs/xfs/xfs_trans_priv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#ifndef __XFS_TRANS_PRIV_H__
77
#define __XFS_TRANS_PRIV_H__
88

9+
struct xlog;
910
struct xfs_log_item;
1011
struct xfs_mount;
1112
struct xfs_trans;
@@ -50,7 +51,7 @@ struct xfs_ail_cursor {
5051
* Eventually we need to drive the locking in here as well.
5152
*/
5253
struct xfs_ail {
53-
struct xfs_mount *ail_mount;
54+
struct xlog *ail_log;
5455
struct task_struct *ail_task;
5556
struct list_head ail_head;
5657
xfs_lsn_t ail_target;

0 commit comments

Comments
 (0)