aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/quota/xfs_dquot.c4
-rw-r--r--fs/xfs/quota/xfs_dquot_item.c2
-rw-r--r--fs/xfs/xfs_buf_item.c4
-rw-r--r--fs/xfs/xfs_extfree_item.c12
-rw-r--r--fs/xfs/xfs_inode.c4
-rw-r--r--fs/xfs/xfs_inode_item.c8
-rw-r--r--fs/xfs/xfs_log.c1
-rw-r--r--fs/xfs/xfs_log_recover.c16
-rw-r--r--fs/xfs/xfs_mount.h1
-rw-r--r--fs/xfs/xfs_trans.c4
-rw-r--r--fs/xfs/xfs_trans_ail.c56
-rw-r--r--fs/xfs/xfs_trans_priv.h5
12 files changed, 59 insertions, 58 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index 59c1081412ec..0d7a62bffeed 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -1333,7 +1333,7 @@ xfs_qm_dqflush_done(
1333 if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) && 1333 if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
1334 qip->qli_item.li_lsn == qip->qli_flush_lsn) { 1334 qip->qli_item.li_lsn == qip->qli_flush_lsn) {
1335 1335
1336 spin_lock(&dqp->q_mount->m_ail_lock); 1336 spin_lock(&dqp->q_mount->m_ail->xa_lock);
1337 /* 1337 /*
1338 * xfs_trans_delete_ail() drops the AIL lock. 1338 * xfs_trans_delete_ail() drops the AIL lock.
1339 */ 1339 */
@@ -1341,7 +1341,7 @@ xfs_qm_dqflush_done(
1341 xfs_trans_delete_ail(dqp->q_mount, 1341 xfs_trans_delete_ail(dqp->q_mount,
1342 (xfs_log_item_t*)qip); 1342 (xfs_log_item_t*)qip);
1343 else 1343 else
1344 spin_unlock(&dqp->q_mount->m_ail_lock); 1344 spin_unlock(&dqp->q_mount->m_ail->xa_lock);
1345 } 1345 }
1346 1346
1347 /* 1347 /*
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c
index 48f08109621f..0e1fa517db09 100644
--- a/fs/xfs/quota/xfs_dquot_item.c
+++ b/fs/xfs/quota/xfs_dquot_item.c
@@ -555,7 +555,7 @@ xfs_qm_qoffend_logitem_committed(
555 xfs_qoff_logitem_t *qfs; 555 xfs_qoff_logitem_t *qfs;
556 556
557 qfs = qfe->qql_start_lip; 557 qfs = qfe->qql_start_lip;
558 spin_lock(&qfs->qql_item.li_mountp->m_ail_lock); 558 spin_lock(&qfs->qql_item.li_mountp->m_ail->xa_lock);
559 /* 559 /*
560 * Delete the qoff-start logitem from the AIL. 560 * Delete the qoff-start logitem from the AIL.
561 * xfs_trans_delete_ail() drops the AIL lock. 561 * xfs_trans_delete_ail() drops the AIL lock.
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 002fc2617c8e..c557fd682527 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -408,7 +408,7 @@ xfs_buf_item_unpin(
408 XFS_BUF_SET_FSPRIVATE(bp, NULL); 408 XFS_BUF_SET_FSPRIVATE(bp, NULL);
409 XFS_BUF_CLR_IODONE_FUNC(bp); 409 XFS_BUF_CLR_IODONE_FUNC(bp);
410 } else { 410 } else {
411 spin_lock(&mp->m_ail_lock); 411 spin_lock(&mp->m_ail->xa_lock);
412 xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip); 412 xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
413 xfs_buf_item_relse(bp); 413 xfs_buf_item_relse(bp);
414 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL); 414 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL);
@@ -1138,7 +1138,7 @@ xfs_buf_iodone(
1138 * 1138 *
1139 * Either way, AIL is useless if we're forcing a shutdown. 1139 * Either way, AIL is useless if we're forcing a shutdown.
1140 */ 1140 */
1141 spin_lock(&mp->m_ail_lock); 1141 spin_lock(&mp->m_ail->xa_lock);
1142 /* 1142 /*
1143 * xfs_trans_delete_ail() drops the AIL lock. 1143 * xfs_trans_delete_ail() drops the AIL lock.
1144 */ 1144 */
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 8aa28f751b2a..f1dcd80cf066 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -111,7 +111,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
111 xfs_mount_t *mp; 111 xfs_mount_t *mp;
112 112
113 mp = efip->efi_item.li_mountp; 113 mp = efip->efi_item.li_mountp;
114 spin_lock(&mp->m_ail_lock); 114 spin_lock(&mp->m_ail->xa_lock);
115 if (efip->efi_flags & XFS_EFI_CANCELED) { 115 if (efip->efi_flags & XFS_EFI_CANCELED) {
116 /* 116 /*
117 * xfs_trans_delete_ail() drops the AIL lock. 117 * xfs_trans_delete_ail() drops the AIL lock.
@@ -120,7 +120,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
120 xfs_efi_item_free(efip); 120 xfs_efi_item_free(efip);
121 } else { 121 } else {
122 efip->efi_flags |= XFS_EFI_COMMITTED; 122 efip->efi_flags |= XFS_EFI_COMMITTED;
123 spin_unlock(&mp->m_ail_lock); 123 spin_unlock(&mp->m_ail->xa_lock);
124 } 124 }
125} 125}
126 126
@@ -138,7 +138,7 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
138 xfs_log_item_desc_t *lidp; 138 xfs_log_item_desc_t *lidp;
139 139
140 mp = efip->efi_item.li_mountp; 140 mp = efip->efi_item.li_mountp;
141 spin_lock(&mp->m_ail_lock); 141 spin_lock(&mp->m_ail->xa_lock);
142 if (efip->efi_flags & XFS_EFI_CANCELED) { 142 if (efip->efi_flags & XFS_EFI_CANCELED) {
143 /* 143 /*
144 * free the xaction descriptor pointing to this item 144 * free the xaction descriptor pointing to this item
@@ -153,7 +153,7 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
153 xfs_efi_item_free(efip); 153 xfs_efi_item_free(efip);
154 } else { 154 } else {
155 efip->efi_flags |= XFS_EFI_COMMITTED; 155 efip->efi_flags |= XFS_EFI_COMMITTED;
156 spin_unlock(&mp->m_ail_lock); 156 spin_unlock(&mp->m_ail->xa_lock);
157 } 157 }
158} 158}
159 159
@@ -352,7 +352,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
352 ASSERT(efip->efi_next_extent > 0); 352 ASSERT(efip->efi_next_extent > 0);
353 ASSERT(efip->efi_flags & XFS_EFI_COMMITTED); 353 ASSERT(efip->efi_flags & XFS_EFI_COMMITTED);
354 354
355 spin_lock(&mp->m_ail_lock); 355 spin_lock(&mp->m_ail->xa_lock);
356 ASSERT(efip->efi_next_extent >= nextents); 356 ASSERT(efip->efi_next_extent >= nextents);
357 efip->efi_next_extent -= nextents; 357 efip->efi_next_extent -= nextents;
358 extents_left = efip->efi_next_extent; 358 extents_left = efip->efi_next_extent;
@@ -363,7 +363,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
363 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip); 363 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
364 xfs_efi_item_free(efip); 364 xfs_efi_item_free(efip);
365 } else { 365 } else {
366 spin_unlock(&mp->m_ail_lock); 366 spin_unlock(&mp->m_ail->xa_lock);
367 } 367 }
368} 368}
369 369
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 2951ffd83066..6d82c23629e1 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2715,11 +2715,11 @@ xfs_idestroy(
2715 ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) || 2715 ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) ||
2716 XFS_FORCED_SHUTDOWN(ip->i_mount)); 2716 XFS_FORCED_SHUTDOWN(ip->i_mount));
2717 if (lip->li_flags & XFS_LI_IN_AIL) { 2717 if (lip->li_flags & XFS_LI_IN_AIL) {
2718 spin_lock(&mp->m_ail_lock); 2718 spin_lock(&mp->m_ail->xa_lock);
2719 if (lip->li_flags & XFS_LI_IN_AIL) 2719 if (lip->li_flags & XFS_LI_IN_AIL)
2720 xfs_trans_delete_ail(mp, lip); 2720 xfs_trans_delete_ail(mp, lip);
2721 else 2721 else
2722 spin_unlock(&mp->m_ail_lock); 2722 spin_unlock(&mp->m_ail->xa_lock);
2723 } 2723 }
2724 xfs_inode_item_destroy(ip); 2724 xfs_inode_item_destroy(ip);
2725 ip->i_itemp = NULL; 2725 ip->i_itemp = NULL;
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 97c7452e2620..291d30aded69 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -991,7 +991,7 @@ xfs_iflush_done(
991 */ 991 */
992 if (iip->ili_logged && 992 if (iip->ili_logged &&
993 (iip->ili_item.li_lsn == iip->ili_flush_lsn)) { 993 (iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
994 spin_lock(&ip->i_mount->m_ail_lock); 994 spin_lock(&ip->i_mount->m_ail->xa_lock);
995 if (iip->ili_item.li_lsn == iip->ili_flush_lsn) { 995 if (iip->ili_item.li_lsn == iip->ili_flush_lsn) {
996 /* 996 /*
997 * xfs_trans_delete_ail() drops the AIL lock. 997 * xfs_trans_delete_ail() drops the AIL lock.
@@ -999,7 +999,7 @@ xfs_iflush_done(
999 xfs_trans_delete_ail(ip->i_mount, 999 xfs_trans_delete_ail(ip->i_mount,
1000 (xfs_log_item_t*)iip); 1000 (xfs_log_item_t*)iip);
1001 } else { 1001 } else {
1002 spin_unlock(&ip->i_mount->m_ail_lock); 1002 spin_unlock(&ip->i_mount->m_ail->xa_lock);
1003 } 1003 }
1004 } 1004 }
1005 1005
@@ -1038,14 +1038,14 @@ xfs_iflush_abort(
1038 mp = ip->i_mount; 1038 mp = ip->i_mount;
1039 if (iip) { 1039 if (iip) {
1040 if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { 1040 if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
1041 spin_lock(&mp->m_ail_lock); 1041 spin_lock(&mp->m_ail->xa_lock);
1042 if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { 1042 if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
1043 /* 1043 /*
1044 * xfs_trans_delete_ail() drops the AIL lock. 1044 * xfs_trans_delete_ail() drops the AIL lock.
1045 */ 1045 */
1046 xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip); 1046 xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip);
1047 } else 1047 } else
1048 spin_unlock(&mp->m_ail_lock); 1048 spin_unlock(&mp->m_ail->xa_lock);
1049 } 1049 }
1050 iip->ili_logged = 0; 1050 iip->ili_logged = 0;
1051 /* 1051 /*
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 31fbb2eea092..a2f7422a749f 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -567,7 +567,6 @@ xfs_log_mount(
567 /* 567 /*
568 * Initialize the AIL now we have a log. 568 * Initialize the AIL now we have a log.
569 */ 569 */
570 spin_lock_init(&mp->m_ail_lock);
571 error = xfs_trans_ail_init(mp); 570 error = xfs_trans_ail_init(mp);
572 if (error) { 571 if (error) {
573 cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error); 572 cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error);
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 45ea0d950138..a484febb9ec6 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2681,7 +2681,7 @@ xlog_recover_do_efi_trans(
2681 efip->efi_next_extent = efi_formatp->efi_nextents; 2681 efip->efi_next_extent = efi_formatp->efi_nextents;
2682 efip->efi_flags |= XFS_EFI_COMMITTED; 2682 efip->efi_flags |= XFS_EFI_COMMITTED;
2683 2683
2684 spin_lock(&mp->m_ail_lock); 2684 spin_lock(&mp->m_ail->xa_lock);
2685 /* 2685 /*
2686 * xfs_trans_update_ail() drops the AIL lock. 2686 * xfs_trans_update_ail() drops the AIL lock.
2687 */ 2687 */
@@ -2727,7 +2727,7 @@ xlog_recover_do_efd_trans(
2727 * in the AIL. 2727 * in the AIL.
2728 */ 2728 */
2729 mp = log->l_mp; 2729 mp = log->l_mp;
2730 spin_lock(&mp->m_ail_lock); 2730 spin_lock(&mp->m_ail->xa_lock);
2731 lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0); 2731 lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0);
2732 while (lip != NULL) { 2732 while (lip != NULL) {
2733 if (lip->li_type == XFS_LI_EFI) { 2733 if (lip->li_type == XFS_LI_EFI) {
@@ -2739,14 +2739,14 @@ xlog_recover_do_efd_trans(
2739 */ 2739 */
2740 xfs_trans_delete_ail(mp, lip); 2740 xfs_trans_delete_ail(mp, lip);
2741 xfs_efi_item_free(efip); 2741 xfs_efi_item_free(efip);
2742 spin_lock(&mp->m_ail_lock); 2742 spin_lock(&mp->m_ail->xa_lock);
2743 break; 2743 break;
2744 } 2744 }
2745 } 2745 }
2746 lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); 2746 lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur);
2747 } 2747 }
2748 xfs_trans_ail_cursor_done(mp->m_ail, &cur); 2748 xfs_trans_ail_cursor_done(mp->m_ail, &cur);
2749 spin_unlock(&mp->m_ail_lock); 2749 spin_unlock(&mp->m_ail->xa_lock);
2750} 2750}
2751 2751
2752/* 2752/*
@@ -3058,7 +3058,7 @@ xlog_recover_process_efis(
3058 struct xfs_ail_cursor cur; 3058 struct xfs_ail_cursor cur;
3059 3059
3060 mp = log->l_mp; 3060 mp = log->l_mp;
3061 spin_lock(&mp->m_ail_lock); 3061 spin_lock(&mp->m_ail->xa_lock);
3062 3062
3063 lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0); 3063 lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0);
3064 while (lip != NULL) { 3064 while (lip != NULL) {
@@ -3084,16 +3084,16 @@ xlog_recover_process_efis(
3084 continue; 3084 continue;
3085 } 3085 }
3086 3086
3087 spin_unlock(&mp->m_ail_lock); 3087 spin_unlock(&mp->m_ail->xa_lock);
3088 error = xlog_recover_process_efi(mp, efip); 3088 error = xlog_recover_process_efi(mp, efip);
3089 spin_lock(&mp->m_ail_lock); 3089 spin_lock(&mp->m_ail->xa_lock);
3090 if (error) 3090 if (error)
3091 goto out; 3091 goto out;
3092 lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); 3092 lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur);
3093 } 3093 }
3094out: 3094out:
3095 xfs_trans_ail_cursor_done(mp->m_ail, &cur); 3095 xfs_trans_ail_cursor_done(mp->m_ail, &cur);
3096 spin_unlock(&mp->m_ail_lock); 3096 spin_unlock(&mp->m_ail->xa_lock);
3097 return error; 3097 return error;
3098} 3098}
3099 3099
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 287f90011ed5..d3b75257602a 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -228,7 +228,6 @@ extern void xfs_icsb_sync_counters_locked(struct xfs_mount *, int);
228typedef struct xfs_mount { 228typedef struct xfs_mount {
229 struct super_block *m_super; 229 struct super_block *m_super;
230 xfs_tid_t m_tid; /* next unused tid for fs */ 230 xfs_tid_t m_tid; /* next unused tid for fs */
231 spinlock_t m_ail_lock; /* fs AIL mutex */
232 struct xfs_ail *m_ail; /* fs active log item list */ 231 struct xfs_ail *m_ail; /* fs active log item list */
233 xfs_sb_t m_sb; /* copy of fs superblock */ 232 xfs_sb_t m_sb; /* copy of fs superblock */
234 spinlock_t m_sb_lock; /* sb counter lock */ 233 spinlock_t m_sb_lock; /* sb counter lock */
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 4e1c22a23be5..99ba0e2658b7 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -1425,7 +1425,7 @@ xfs_trans_chunk_committed(
1425 * the test below. 1425 * the test below.
1426 */ 1426 */
1427 mp = lip->li_mountp; 1427 mp = lip->li_mountp;
1428 spin_lock(&mp->m_ail_lock); 1428 spin_lock(&mp->m_ail->xa_lock);
1429 if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) { 1429 if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) {
1430 /* 1430 /*
1431 * This will set the item's lsn to item_lsn 1431 * This will set the item's lsn to item_lsn
@@ -1436,7 +1436,7 @@ xfs_trans_chunk_committed(
1436 */ 1436 */
1437 xfs_trans_update_ail(mp, lip, item_lsn); 1437 xfs_trans_update_ail(mp, lip, item_lsn);
1438 } else { 1438 } else {
1439 spin_unlock(&mp->m_ail_lock); 1439 spin_unlock(&mp->m_ail->xa_lock);
1440 } 1440 }
1441 1441
1442 /* 1442 /*
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 286934d56ec7..0cd47a797d32 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. 2 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
3 * Copyright (c) 2008 Dave Chinner
3 * All Rights Reserved. 4 * All Rights Reserved.
4 * 5 *
5 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -56,14 +57,14 @@ xfs_trans_ail_tail(
56 xfs_lsn_t lsn; 57 xfs_lsn_t lsn;
57 xfs_log_item_t *lip; 58 xfs_log_item_t *lip;
58 59
59 spin_lock(&ailp->xa_mount->m_ail_lock); 60 spin_lock(&ailp->xa_lock);
60 lip = xfs_ail_min(ailp); 61 lip = xfs_ail_min(ailp);
61 if (lip == NULL) { 62 if (lip == NULL) {
62 lsn = (xfs_lsn_t)0; 63 lsn = (xfs_lsn_t)0;
63 } else { 64 } else {
64 lsn = lip->li_lsn; 65 lsn = lip->li_lsn;
65 } 66 }
66 spin_unlock(&ailp->xa_mount->m_ail_lock); 67 spin_unlock(&ailp->xa_lock);
67 68
68 return lsn; 69 return lsn;
69} 70}
@@ -252,7 +253,7 @@ xfsaild_push(
252 xfs_mount_t *mp = ailp->xa_mount; 253 xfs_mount_t *mp = ailp->xa_mount;
253 struct xfs_ail_cursor *cur = &ailp->xa_cursors; 254 struct xfs_ail_cursor *cur = &ailp->xa_cursors;
254 255
255 spin_lock(&mp->m_ail_lock); 256 spin_lock(&ailp->xa_lock);
256 xfs_trans_ail_cursor_init(ailp, cur); 257 xfs_trans_ail_cursor_init(ailp, cur);
257 lip = xfs_trans_ail_cursor_first(ailp, cur, *last_lsn); 258 lip = xfs_trans_ail_cursor_first(ailp, cur, *last_lsn);
258 if (!lip || XFS_FORCED_SHUTDOWN(mp)) { 259 if (!lip || XFS_FORCED_SHUTDOWN(mp)) {
@@ -260,7 +261,7 @@ xfsaild_push(
260 * AIL is empty or our push has reached the end. 261 * AIL is empty or our push has reached the end.
261 */ 262 */
262 xfs_trans_ail_cursor_done(ailp, cur); 263 xfs_trans_ail_cursor_done(ailp, cur);
263 spin_unlock(&mp->m_ail_lock); 264 spin_unlock(&ailp->xa_lock);
264 last_pushed_lsn = 0; 265 last_pushed_lsn = 0;
265 return tout; 266 return tout;
266 } 267 }
@@ -295,7 +296,7 @@ xfsaild_push(
295 * skip to the next item in the list. 296 * skip to the next item in the list.
296 */ 297 */
297 lock_result = IOP_TRYLOCK(lip); 298 lock_result = IOP_TRYLOCK(lip);
298 spin_unlock(&mp->m_ail_lock); 299 spin_unlock(&ailp->xa_lock);
299 switch (lock_result) { 300 switch (lock_result) {
300 case XFS_ITEM_SUCCESS: 301 case XFS_ITEM_SUCCESS:
301 XFS_STATS_INC(xs_push_ail_success); 302 XFS_STATS_INC(xs_push_ail_success);
@@ -332,7 +333,7 @@ xfsaild_push(
332 break; 333 break;
333 } 334 }
334 335
335 spin_lock(&mp->m_ail_lock); 336 spin_lock(&ailp->xa_lock);
336 /* should we bother continuing? */ 337 /* should we bother continuing? */
337 if (XFS_FORCED_SHUTDOWN(mp)) 338 if (XFS_FORCED_SHUTDOWN(mp))
338 break; 339 break;
@@ -361,7 +362,7 @@ xfsaild_push(
361 lsn = lip->li_lsn; 362 lsn = lip->li_lsn;
362 } 363 }
363 xfs_trans_ail_cursor_done(ailp, cur); 364 xfs_trans_ail_cursor_done(ailp, cur);
364 spin_unlock(&mp->m_ail_lock); 365 spin_unlock(&ailp->xa_lock);
365 366
366 if (flush_log) { 367 if (flush_log) {
367 /* 368 /*
@@ -462,30 +463,31 @@ void
462xfs_trans_update_ail( 463xfs_trans_update_ail(
463 xfs_mount_t *mp, 464 xfs_mount_t *mp,
464 xfs_log_item_t *lip, 465 xfs_log_item_t *lip,
465 xfs_lsn_t lsn) __releases(mp->m_ail_lock) 466 xfs_lsn_t lsn) __releases(ailp->xa_lock)
466{ 467{
467 xfs_log_item_t *dlip=NULL; 468 struct xfs_ail *ailp = mp->m_ail;
469 xfs_log_item_t *dlip = NULL;
468 xfs_log_item_t *mlip; /* ptr to minimum lip */ 470 xfs_log_item_t *mlip; /* ptr to minimum lip */
469 471
470 mlip = xfs_ail_min(mp->m_ail); 472 mlip = xfs_ail_min(ailp);
471 473
472 if (lip->li_flags & XFS_LI_IN_AIL) { 474 if (lip->li_flags & XFS_LI_IN_AIL) {
473 dlip = xfs_ail_delete(mp->m_ail, lip); 475 dlip = xfs_ail_delete(ailp, lip);
474 ASSERT(dlip == lip); 476 ASSERT(dlip == lip);
475 xfs_trans_ail_cursor_clear(mp->m_ail, dlip); 477 xfs_trans_ail_cursor_clear(ailp, dlip);
476 } else { 478 } else {
477 lip->li_flags |= XFS_LI_IN_AIL; 479 lip->li_flags |= XFS_LI_IN_AIL;
478 } 480 }
479 481
480 lip->li_lsn = lsn; 482 lip->li_lsn = lsn;
481 xfs_ail_insert(mp->m_ail, lip); 483 xfs_ail_insert(ailp, lip);
482 484
483 if (mlip == dlip) { 485 if (mlip == dlip) {
484 mlip = xfs_ail_min(mp->m_ail); 486 mlip = xfs_ail_min(ailp);
485 spin_unlock(&mp->m_ail_lock); 487 spin_unlock(&ailp->xa_lock);
486 xfs_log_move_tail(mp, mlip->li_lsn); 488 xfs_log_move_tail(mp, mlip->li_lsn);
487 } else { 489 } else {
488 spin_unlock(&mp->m_ail_lock); 490 spin_unlock(&ailp->xa_lock);
489 } 491 }
490 492
491 493
@@ -509,27 +511,28 @@ xfs_trans_update_ail(
509void 511void
510xfs_trans_delete_ail( 512xfs_trans_delete_ail(
511 xfs_mount_t *mp, 513 xfs_mount_t *mp,
512 xfs_log_item_t *lip) __releases(mp->m_ail_lock) 514 xfs_log_item_t *lip) __releases(ailp->xa_lock)
513{ 515{
516 struct xfs_ail *ailp = mp->m_ail;
514 xfs_log_item_t *dlip; 517 xfs_log_item_t *dlip;
515 xfs_log_item_t *mlip; 518 xfs_log_item_t *mlip;
516 519
517 if (lip->li_flags & XFS_LI_IN_AIL) { 520 if (lip->li_flags & XFS_LI_IN_AIL) {
518 mlip = xfs_ail_min(mp->m_ail); 521 mlip = xfs_ail_min(ailp);
519 dlip = xfs_ail_delete(mp->m_ail, lip); 522 dlip = xfs_ail_delete(ailp, lip);
520 ASSERT(dlip == lip); 523 ASSERT(dlip == lip);
521 xfs_trans_ail_cursor_clear(mp->m_ail, dlip); 524 xfs_trans_ail_cursor_clear(ailp, dlip);
522 525
523 526
524 lip->li_flags &= ~XFS_LI_IN_AIL; 527 lip->li_flags &= ~XFS_LI_IN_AIL;
525 lip->li_lsn = 0; 528 lip->li_lsn = 0;
526 529
527 if (mlip == dlip) { 530 if (mlip == dlip) {
528 mlip = xfs_ail_min(mp->m_ail); 531 mlip = xfs_ail_min(ailp);
529 spin_unlock(&mp->m_ail_lock); 532 spin_unlock(&ailp->xa_lock);
530 xfs_log_move_tail(mp, (mlip ? mlip->li_lsn : 0)); 533 xfs_log_move_tail(mp, (mlip ? mlip->li_lsn : 0));
531 } else { 534 } else {
532 spin_unlock(&mp->m_ail_lock); 535 spin_unlock(&ailp->xa_lock);
533 } 536 }
534 } 537 }
535 else { 538 else {
@@ -537,13 +540,11 @@ xfs_trans_delete_ail(
537 * If the file system is not being shutdown, we are in 540 * If the file system is not being shutdown, we are in
538 * serious trouble if we get to this stage. 541 * serious trouble if we get to this stage.
539 */ 542 */
540 if (XFS_FORCED_SHUTDOWN(mp)) 543 spin_unlock(&ailp->xa_lock);
541 spin_unlock(&mp->m_ail_lock); 544 if (!XFS_FORCED_SHUTDOWN(mp)) {
542 else {
543 xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp, 545 xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp,
544 "%s: attempting to delete a log item that is not in the AIL", 546 "%s: attempting to delete a log item that is not in the AIL",
545 __func__); 547 __func__);
546 spin_unlock(&mp->m_ail_lock);
547 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); 548 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
548 } 549 }
549 } 550 }
@@ -578,6 +579,7 @@ xfs_trans_ail_init(
578 579
579 ailp->xa_mount = mp; 580 ailp->xa_mount = mp;
580 INIT_LIST_HEAD(&ailp->xa_ail); 581 INIT_LIST_HEAD(&ailp->xa_ail);
582 spin_lock_init(&ailp->xa_lock);
581 error = xfsaild_start(ailp); 583 error = xfsaild_start(ailp);
582 if (error) 584 if (error)
583 goto out_free_ailp; 585 goto out_free_ailp;
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
index 708cff72d209..6ca0a7a7e3df 100644
--- a/fs/xfs/xfs_trans_priv.h
+++ b/fs/xfs/xfs_trans_priv.h
@@ -79,6 +79,7 @@ struct xfs_ail {
79 struct task_struct *xa_task; 79 struct task_struct *xa_task;
80 xfs_lsn_t xa_target; 80 xfs_lsn_t xa_target;
81 struct xfs_ail_cursor xa_cursors; 81 struct xfs_ail_cursor xa_cursors;
82 spinlock_t xa_lock;
82}; 83};
83 84
84/* 85/*
@@ -114,9 +115,9 @@ xfs_trans_ail_copy_lsn(
114 xfs_lsn_t *src) 115 xfs_lsn_t *src)
115{ 116{
116 ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */ 117 ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */
117 spin_lock(&ailp->xa_mount->m_ail_lock); 118 spin_lock(&ailp->xa_lock);
118 *dst = *src; 119 *dst = *src;
119 spin_unlock(&ailp->xa_mount->m_ail_lock); 120 spin_unlock(&ailp->xa_lock);
120} 121}
121#else 122#else
122static inline void 123static inline void