diff options
author | David Chinner <david@fromorbit.com> | 2008-10-30 02:39:58 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 02:39:58 -0400 |
commit | 783a2f656f9674c31d4019708a94af93fa1d1c22 (patch) | |
tree | 7ac2123b187c0522dbd8a0d94de3856b33147c46 /fs/xfs | |
parent | fc1829f34d30899701dfd5890030d39e13e1f47d (diff) |
[XFS] Finish removing the mount pointer from the AIL API
Change all the remaining AIL API functions that are passed struct
xfs_mount pointers to pass pointers directly to the struct xfs_ail being
used. With this conversion, all external access to the AIL is via the
struct xfs_ail. Hence the operation and referencing of the AIL is almost
entirely independent of the xfs_mount that is using it - it is now much
more tightly tied to the log and the items it is tracking in the log than
it is tied to the xfs_mount.
SGI-PV: 988143
SGI-Modid: xfs-linux-melb:xfs-kern:32353a
Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/quota/xfs_dquot.c | 15 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot_item.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_buf_item.c | 24 | ||||
-rw-r--r-- | fs/xfs/xfs_extfree_item.c | 35 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_inode_item.c | 29 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.c | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_ail.c | 41 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_buf.c | 7 | ||||
-rw-r--r-- | fs/xfs/xfs_trans_priv.h | 15 |
14 files changed, 91 insertions, 119 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index 0d7a62bffeed..591ca6602bfb 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c | |||
@@ -1319,8 +1319,10 @@ xfs_qm_dqflush_done( | |||
1319 | xfs_dq_logitem_t *qip) | 1319 | xfs_dq_logitem_t *qip) |
1320 | { | 1320 | { |
1321 | xfs_dquot_t *dqp; | 1321 | xfs_dquot_t *dqp; |
1322 | struct xfs_ail *ailp; | ||
1322 | 1323 | ||
1323 | dqp = qip->qli_dquot; | 1324 | dqp = qip->qli_dquot; |
1325 | ailp = qip->qli_item.li_ailp; | ||
1324 | 1326 | ||
1325 | /* | 1327 | /* |
1326 | * We only want to pull the item from the AIL if its | 1328 | * We only want to pull the item from the AIL if its |
@@ -1333,15 +1335,12 @@ xfs_qm_dqflush_done( | |||
1333 | if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) && | 1335 | if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) && |
1334 | qip->qli_item.li_lsn == qip->qli_flush_lsn) { | 1336 | qip->qli_item.li_lsn == qip->qli_flush_lsn) { |
1335 | 1337 | ||
1336 | spin_lock(&dqp->q_mount->m_ail->xa_lock); | 1338 | /* xfs_trans_ail_delete() drops the AIL lock. */ |
1337 | /* | 1339 | spin_lock(&ailp->xa_lock); |
1338 | * xfs_trans_delete_ail() drops the AIL lock. | ||
1339 | */ | ||
1340 | if (qip->qli_item.li_lsn == qip->qli_flush_lsn) | 1340 | if (qip->qli_item.li_lsn == qip->qli_flush_lsn) |
1341 | xfs_trans_delete_ail(dqp->q_mount, | 1341 | xfs_trans_ail_delete(ailp, (xfs_log_item_t*)qip); |
1342 | (xfs_log_item_t*)qip); | ||
1343 | else | 1342 | else |
1344 | spin_unlock(&dqp->q_mount->m_ail->xa_lock); | 1343 | spin_unlock(&ailp->xa_lock); |
1345 | } | 1344 | } |
1346 | 1345 | ||
1347 | /* | 1346 | /* |
@@ -1371,7 +1370,7 @@ xfs_dqunlock( | |||
1371 | mutex_unlock(&(dqp->q_qlock)); | 1370 | mutex_unlock(&(dqp->q_qlock)); |
1372 | if (dqp->q_logitem.qli_dquot == dqp) { | 1371 | if (dqp->q_logitem.qli_dquot == dqp) { |
1373 | /* Once was dqp->q_mount, but might just have been cleared */ | 1372 | /* Once was dqp->q_mount, but might just have been cleared */ |
1374 | xfs_trans_unlocked_item(dqp->q_logitem.qli_item.li_mountp, | 1373 | xfs_trans_unlocked_item(dqp->q_logitem.qli_item.li_ailp, |
1375 | (xfs_log_item_t*)&(dqp->q_logitem)); | 1374 | (xfs_log_item_t*)&(dqp->q_logitem)); |
1376 | } | 1375 | } |
1377 | } | 1376 | } |
diff --git a/fs/xfs/quota/xfs_dquot_item.c b/fs/xfs/quota/xfs_dquot_item.c index 0e1fa517db09..1728f6a7c4f5 100644 --- a/fs/xfs/quota/xfs_dquot_item.c +++ b/fs/xfs/quota/xfs_dquot_item.c | |||
@@ -553,14 +553,16 @@ xfs_qm_qoffend_logitem_committed( | |||
553 | xfs_lsn_t lsn) | 553 | xfs_lsn_t lsn) |
554 | { | 554 | { |
555 | xfs_qoff_logitem_t *qfs; | 555 | xfs_qoff_logitem_t *qfs; |
556 | struct xfs_ail *ailp; | ||
556 | 557 | ||
557 | qfs = qfe->qql_start_lip; | 558 | qfs = qfe->qql_start_lip; |
558 | spin_lock(&qfs->qql_item.li_mountp->m_ail->xa_lock); | 559 | ailp = qfs->qql_item.li_ailp; |
560 | spin_lock(&ailp->xa_lock); | ||
559 | /* | 561 | /* |
560 | * Delete the qoff-start logitem from the AIL. | 562 | * Delete the qoff-start logitem from the AIL. |
561 | * xfs_trans_delete_ail() drops the AIL lock. | 563 | * xfs_trans_ail_delete() drops the AIL lock. |
562 | */ | 564 | */ |
563 | xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs); | 565 | xfs_trans_ail_delete(ailp, (xfs_log_item_t *)qfs); |
564 | kmem_free(qfs); | 566 | kmem_free(qfs); |
565 | kmem_free(qfe); | 567 | kmem_free(qfe); |
566 | return (xfs_lsn_t)-1; | 568 | return (xfs_lsn_t)-1; |
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c index 793e53c01dc0..d245d04e10ca 100644 --- a/fs/xfs/xfs_buf_item.c +++ b/fs/xfs/xfs_buf_item.c | |||
@@ -375,7 +375,7 @@ xfs_buf_item_unpin( | |||
375 | xfs_buf_log_item_t *bip, | 375 | xfs_buf_log_item_t *bip, |
376 | int stale) | 376 | int stale) |
377 | { | 377 | { |
378 | xfs_mount_t *mp; | 378 | struct xfs_ail *ailp; |
379 | xfs_buf_t *bp; | 379 | xfs_buf_t *bp; |
380 | int freed; | 380 | int freed; |
381 | 381 | ||
@@ -387,7 +387,7 @@ xfs_buf_item_unpin( | |||
387 | xfs_buftrace("XFS_UNPIN", bp); | 387 | xfs_buftrace("XFS_UNPIN", bp); |
388 | 388 | ||
389 | freed = atomic_dec_and_test(&bip->bli_refcount); | 389 | freed = atomic_dec_and_test(&bip->bli_refcount); |
390 | mp = bip->bli_item.li_mountp; | 390 | ailp = bip->bli_item.li_ailp; |
391 | xfs_bunpin(bp); | 391 | xfs_bunpin(bp); |
392 | if (freed && stale) { | 392 | if (freed && stale) { |
393 | ASSERT(bip->bli_flags & XFS_BLI_STALE); | 393 | ASSERT(bip->bli_flags & XFS_BLI_STALE); |
@@ -399,17 +399,17 @@ xfs_buf_item_unpin( | |||
399 | xfs_buftrace("XFS_UNPIN STALE", bp); | 399 | xfs_buftrace("XFS_UNPIN STALE", bp); |
400 | /* | 400 | /* |
401 | * If we get called here because of an IO error, we may | 401 | * If we get called here because of an IO error, we may |
402 | * or may not have the item on the AIL. xfs_trans_delete_ail() | 402 | * or may not have the item on the AIL. xfs_trans_ail_delete() |
403 | * will take care of that situation. | 403 | * will take care of that situation. |
404 | * xfs_trans_delete_ail() drops the AIL lock. | 404 | * xfs_trans_ail_delete() drops the AIL lock. |
405 | */ | 405 | */ |
406 | if (bip->bli_flags & XFS_BLI_STALE_INODE) { | 406 | if (bip->bli_flags & XFS_BLI_STALE_INODE) { |
407 | xfs_buf_do_callbacks(bp, (xfs_log_item_t *)bip); | 407 | xfs_buf_do_callbacks(bp, (xfs_log_item_t *)bip); |
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->xa_lock); | 411 | spin_lock(&ailp->xa_lock); |
412 | xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip); | 412 | xfs_trans_ail_delete(ailp, (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); |
415 | } | 415 | } |
@@ -1123,29 +1123,23 @@ xfs_buf_iodone( | |||
1123 | xfs_buf_t *bp, | 1123 | xfs_buf_t *bp, |
1124 | xfs_buf_log_item_t *bip) | 1124 | xfs_buf_log_item_t *bip) |
1125 | { | 1125 | { |
1126 | struct xfs_mount *mp; | 1126 | struct xfs_ail *ailp = bip->bli_item.li_ailp; |
1127 | struct xfs_ail *ailp; | ||
1128 | 1127 | ||
1129 | ASSERT(bip->bli_buf == bp); | 1128 | ASSERT(bip->bli_buf == bp); |
1130 | 1129 | ||
1131 | xfs_buf_rele(bp); | 1130 | xfs_buf_rele(bp); |
1132 | mp = bip->bli_item.li_mountp; | ||
1133 | ailp = bip->bli_item.li_ailp; | ||
1134 | 1131 | ||
1135 | /* | 1132 | /* |
1136 | * If we are forcibly shutting down, this may well be | 1133 | * If we are forcibly shutting down, this may well be |
1137 | * off the AIL already. That's because we simulate the | 1134 | * off the AIL already. That's because we simulate the |
1138 | * log-committed callbacks to unpin these buffers. Or we may never | 1135 | * log-committed callbacks to unpin these buffers. Or we may never |
1139 | * have put this item on AIL because of the transaction was | 1136 | * have put this item on AIL because of the transaction was |
1140 | * aborted forcibly. xfs_trans_delete_ail() takes care of these. | 1137 | * aborted forcibly. xfs_trans_ail_delete() takes care of these. |
1141 | * | 1138 | * |
1142 | * Either way, AIL is useless if we're forcing a shutdown. | 1139 | * Either way, AIL is useless if we're forcing a shutdown. |
1143 | */ | 1140 | */ |
1144 | spin_lock(&ailp->xa_lock); | 1141 | spin_lock(&ailp->xa_lock); |
1145 | /* | 1142 | xfs_trans_ail_delete(ailp, (xfs_log_item_t *)bip); |
1146 | * xfs_trans_delete_ail() drops the AIL lock. | ||
1147 | */ | ||
1148 | xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip); | ||
1149 | xfs_buf_item_free(bip); | 1143 | xfs_buf_item_free(bip); |
1150 | } | 1144 | } |
1151 | 1145 | ||
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c index dab57374e1fe..05a4bdd4be39 100644 --- a/fs/xfs/xfs_extfree_item.c +++ b/fs/xfs/xfs_extfree_item.c | |||
@@ -108,17 +108,12 @@ xfs_efi_item_pin(xfs_efi_log_item_t *efip) | |||
108 | STATIC void | 108 | STATIC void |
109 | xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale) | 109 | xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale) |
110 | { | 110 | { |
111 | xfs_mount_t *mp; | 111 | struct xfs_ail *ailp = efip->efi_item.li_ailp; |
112 | struct xfs_ail *ailp; | ||
113 | 112 | ||
114 | mp = efip->efi_item.li_mountp; | ||
115 | ailp = efip->efi_item.li_ailp; | ||
116 | spin_lock(&ailp->xa_lock); | 113 | spin_lock(&ailp->xa_lock); |
117 | if (efip->efi_flags & XFS_EFI_CANCELED) { | 114 | if (efip->efi_flags & XFS_EFI_CANCELED) { |
118 | /* | 115 | /* xfs_trans_ail_delete() drops the AIL lock. */ |
119 | * xfs_trans_delete_ail() drops the AIL lock. | 116 | xfs_trans_ail_delete(ailp, (xfs_log_item_t *)efip); |
120 | */ | ||
121 | xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip); | ||
122 | xfs_efi_item_free(efip); | 117 | xfs_efi_item_free(efip); |
123 | } else { | 118 | } else { |
124 | efip->efi_flags |= XFS_EFI_COMMITTED; | 119 | efip->efi_flags |= XFS_EFI_COMMITTED; |
@@ -136,12 +131,9 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale) | |||
136 | STATIC void | 131 | STATIC void |
137 | xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp) | 132 | xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp) |
138 | { | 133 | { |
139 | xfs_mount_t *mp; | 134 | struct xfs_ail *ailp = efip->efi_item.li_ailp; |
140 | struct xfs_ail *ailp; | ||
141 | xfs_log_item_desc_t *lidp; | 135 | xfs_log_item_desc_t *lidp; |
142 | 136 | ||
143 | mp = efip->efi_item.li_mountp; | ||
144 | ailp = efip->efi_item.li_ailp; | ||
145 | spin_lock(&ailp->xa_lock); | 137 | spin_lock(&ailp->xa_lock); |
146 | if (efip->efi_flags & XFS_EFI_CANCELED) { | 138 | if (efip->efi_flags & XFS_EFI_CANCELED) { |
147 | /* | 139 | /* |
@@ -149,11 +141,9 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp) | |||
149 | */ | 141 | */ |
150 | lidp = xfs_trans_find_item(tp, (xfs_log_item_t *) efip); | 142 | lidp = xfs_trans_find_item(tp, (xfs_log_item_t *) efip); |
151 | xfs_trans_free_item(tp, lidp); | 143 | xfs_trans_free_item(tp, lidp); |
152 | /* | 144 | |
153 | * pull the item off the AIL. | 145 | /* xfs_trans_ail_delete() drops the AIL lock. */ |
154 | * xfs_trans_delete_ail() drops the AIL lock. | 146 | xfs_trans_ail_delete(ailp, (xfs_log_item_t *)efip); |
155 | */ | ||
156 | xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip); | ||
157 | xfs_efi_item_free(efip); | 147 | xfs_efi_item_free(efip); |
158 | } else { | 148 | } else { |
159 | efip->efi_flags |= XFS_EFI_COMMITTED; | 149 | efip->efi_flags |= XFS_EFI_COMMITTED; |
@@ -350,12 +340,9 @@ void | |||
350 | xfs_efi_release(xfs_efi_log_item_t *efip, | 340 | xfs_efi_release(xfs_efi_log_item_t *efip, |
351 | uint nextents) | 341 | uint nextents) |
352 | { | 342 | { |
353 | xfs_mount_t *mp; | 343 | struct xfs_ail *ailp = efip->efi_item.li_ailp; |
354 | struct xfs_ail *ailp; | ||
355 | int extents_left; | 344 | int extents_left; |
356 | 345 | ||
357 | mp = efip->efi_item.li_mountp; | ||
358 | ailp = efip->efi_item.li_ailp; | ||
359 | ASSERT(efip->efi_next_extent > 0); | 346 | ASSERT(efip->efi_next_extent > 0); |
360 | ASSERT(efip->efi_flags & XFS_EFI_COMMITTED); | 347 | ASSERT(efip->efi_flags & XFS_EFI_COMMITTED); |
361 | 348 | ||
@@ -364,10 +351,8 @@ xfs_efi_release(xfs_efi_log_item_t *efip, | |||
364 | efip->efi_next_extent -= nextents; | 351 | efip->efi_next_extent -= nextents; |
365 | extents_left = efip->efi_next_extent; | 352 | extents_left = efip->efi_next_extent; |
366 | if (extents_left == 0) { | 353 | if (extents_left == 0) { |
367 | /* | 354 | /* xfs_trans_ail_delete() drops the AIL lock. */ |
368 | * xfs_trans_delete_ail() drops the AIL lock. | 355 | xfs_trans_ail_delete(ailp, (xfs_log_item_t *)efip); |
369 | */ | ||
370 | xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip); | ||
371 | xfs_efi_item_free(efip); | 356 | xfs_efi_item_free(efip); |
372 | } else { | 357 | } else { |
373 | spin_unlock(&ailp->xa_lock); | 358 | spin_unlock(&ailp->xa_lock); |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 800133805ca1..a1f209b0596f 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -38,6 +38,8 @@ | |||
38 | #include "xfs_ialloc.h" | 38 | #include "xfs_ialloc.h" |
39 | #include "xfs_quota.h" | 39 | #include "xfs_quota.h" |
40 | #include "xfs_utils.h" | 40 | #include "xfs_utils.h" |
41 | #include "xfs_trans_priv.h" | ||
42 | #include "xfs_inode_item.h" | ||
41 | 43 | ||
42 | /* | 44 | /* |
43 | * Check the validity of the inode we just found it the cache | 45 | * Check the validity of the inode we just found it the cache |
@@ -616,7 +618,7 @@ xfs_iunlock( | |||
616 | * it is in the AIL and anyone is waiting on it. Don't do | 618 | * it is in the AIL and anyone is waiting on it. Don't do |
617 | * this if the caller has asked us not to. | 619 | * this if the caller has asked us not to. |
618 | */ | 620 | */ |
619 | xfs_trans_unlocked_item(ip->i_mount, | 621 | xfs_trans_unlocked_item(ip->i_itemp->ili_item.li_ailp, |
620 | (xfs_log_item_t*)(ip->i_itemp)); | 622 | (xfs_log_item_t*)(ip->i_itemp)); |
621 | } | 623 | } |
622 | xfs_ilock_trace(ip, 3, lock_flags, (inst_t *)__return_address); | 624 | xfs_ilock_trace(ip, 3, lock_flags, (inst_t *)__return_address); |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 6d82c23629e1..c83f6998f95e 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2709,17 +2709,17 @@ xfs_idestroy( | |||
2709 | * inode still in the AIL. If it is there, we should remove | 2709 | * inode still in the AIL. If it is there, we should remove |
2710 | * it to prevent a use-after-free from occurring. | 2710 | * it to prevent a use-after-free from occurring. |
2711 | */ | 2711 | */ |
2712 | xfs_mount_t *mp = ip->i_mount; | ||
2713 | xfs_log_item_t *lip = &ip->i_itemp->ili_item; | 2712 | xfs_log_item_t *lip = &ip->i_itemp->ili_item; |
2713 | struct xfs_ail *ailp = lip->li_ailp; | ||
2714 | 2714 | ||
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->xa_lock); | 2718 | spin_lock(&ailp->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_ail_delete(ailp, lip); |
2721 | else | 2721 | else |
2722 | spin_unlock(&mp->m_ail->xa_lock); | 2722 | spin_unlock(&ailp->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 47594f4b51db..aa9bf05060c6 100644 --- a/fs/xfs/xfs_inode_item.c +++ b/fs/xfs/xfs_inode_item.c | |||
@@ -977,9 +977,8 @@ xfs_iflush_done( | |||
977 | xfs_buf_t *bp, | 977 | xfs_buf_t *bp, |
978 | xfs_inode_log_item_t *iip) | 978 | xfs_inode_log_item_t *iip) |
979 | { | 979 | { |
980 | xfs_inode_t *ip; | 980 | xfs_inode_t *ip = iip->ili_inode; |
981 | 981 | struct xfs_ail *ailp = iip->ili_item.li_ailp; | |
982 | ip = iip->ili_inode; | ||
983 | 982 | ||
984 | /* | 983 | /* |
985 | * We only want to pull the item from the AIL if it is | 984 | * We only want to pull the item from the AIL if it is |
@@ -992,15 +991,12 @@ xfs_iflush_done( | |||
992 | */ | 991 | */ |
993 | if (iip->ili_logged && | 992 | if (iip->ili_logged && |
994 | (iip->ili_item.li_lsn == iip->ili_flush_lsn)) { | 993 | (iip->ili_item.li_lsn == iip->ili_flush_lsn)) { |
995 | spin_lock(&ip->i_mount->m_ail->xa_lock); | 994 | spin_lock(&ailp->xa_lock); |
996 | if (iip->ili_item.li_lsn == iip->ili_flush_lsn) { | 995 | if (iip->ili_item.li_lsn == iip->ili_flush_lsn) { |
997 | /* | 996 | /* xfs_trans_ail_delete() drops the AIL lock. */ |
998 | * xfs_trans_delete_ail() drops the AIL lock. | 997 | xfs_trans_ail_delete(ailp, (xfs_log_item_t*)iip); |
999 | */ | ||
1000 | xfs_trans_delete_ail(ip->i_mount, | ||
1001 | (xfs_log_item_t*)iip); | ||
1002 | } else { | 998 | } else { |
1003 | spin_unlock(&ip->i_mount->m_ail->xa_lock); | 999 | spin_unlock(&ailp->xa_lock); |
1004 | } | 1000 | } |
1005 | } | 1001 | } |
1006 | 1002 | ||
@@ -1032,21 +1028,20 @@ void | |||
1032 | xfs_iflush_abort( | 1028 | xfs_iflush_abort( |
1033 | xfs_inode_t *ip) | 1029 | xfs_inode_t *ip) |
1034 | { | 1030 | { |
1035 | xfs_inode_log_item_t *iip; | 1031 | xfs_inode_log_item_t *iip = ip->i_itemp; |
1036 | xfs_mount_t *mp; | 1032 | xfs_mount_t *mp; |
1037 | 1033 | ||
1038 | iip = ip->i_itemp; | 1034 | iip = ip->i_itemp; |
1039 | mp = ip->i_mount; | 1035 | mp = ip->i_mount; |
1040 | if (iip) { | 1036 | if (iip) { |
1037 | struct xfs_ail *ailp = iip->ili_item.li_ailp; | ||
1041 | if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { | 1038 | if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { |
1042 | spin_lock(&mp->m_ail->xa_lock); | 1039 | spin_lock(&ailp->xa_lock); |
1043 | if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { | 1040 | if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { |
1044 | /* | 1041 | /* xfs_trans_ail_delete() drops the AIL lock. */ |
1045 | * xfs_trans_delete_ail() drops the AIL lock. | 1042 | xfs_trans_ail_delete(ailp, (xfs_log_item_t *)iip); |
1046 | */ | ||
1047 | xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip); | ||
1048 | } else | 1043 | } else |
1049 | spin_unlock(&mp->m_ail->xa_lock); | 1044 | spin_unlock(&ailp->xa_lock); |
1050 | } | 1045 | } |
1051 | iip->ili_logged = 0; | 1046 | iip->ili_logged = 0; |
1052 | /* | 1047 | /* |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 405a41ab6855..51840170b16c 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -1413,7 +1413,7 @@ xlog_grant_push_ail(xfs_mount_t *mp, | |||
1413 | */ | 1413 | */ |
1414 | if (threshold_lsn && | 1414 | if (threshold_lsn && |
1415 | !XLOG_FORCED_SHUTDOWN(log)) | 1415 | !XLOG_FORCED_SHUTDOWN(log)) |
1416 | xfs_trans_push_ail(mp, threshold_lsn); | 1416 | xfs_trans_ail_push(log->l_ailp, threshold_lsn); |
1417 | } /* xlog_grant_push_ail */ | 1417 | } /* xlog_grant_push_ail */ |
1418 | 1418 | ||
1419 | 1419 | ||
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 0bbde7b84fc9..cff901efc24b 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -2683,9 +2683,9 @@ xlog_recover_do_efi_trans( | |||
2683 | 2683 | ||
2684 | spin_lock(&log->l_ailp->xa_lock); | 2684 | spin_lock(&log->l_ailp->xa_lock); |
2685 | /* | 2685 | /* |
2686 | * xfs_trans_update_ail() drops the AIL lock. | 2686 | * xfs_trans_ail_update() drops the AIL lock. |
2687 | */ | 2687 | */ |
2688 | xfs_trans_update_ail(mp, (xfs_log_item_t *)efip, lsn); | 2688 | xfs_trans_ail_update(log->l_ailp, (xfs_log_item_t *)efip, lsn); |
2689 | return 0; | 2689 | return 0; |
2690 | } | 2690 | } |
2691 | 2691 | ||
@@ -2704,13 +2704,12 @@ xlog_recover_do_efd_trans( | |||
2704 | xlog_recover_item_t *item, | 2704 | xlog_recover_item_t *item, |
2705 | int pass) | 2705 | int pass) |
2706 | { | 2706 | { |
2707 | xfs_mount_t *mp; | ||
2708 | xfs_efd_log_format_t *efd_formatp; | 2707 | xfs_efd_log_format_t *efd_formatp; |
2709 | xfs_efi_log_item_t *efip = NULL; | 2708 | xfs_efi_log_item_t *efip = NULL; |
2710 | xfs_log_item_t *lip; | 2709 | xfs_log_item_t *lip; |
2711 | __uint64_t efi_id; | 2710 | __uint64_t efi_id; |
2712 | struct xfs_ail_cursor cur; | 2711 | struct xfs_ail_cursor cur; |
2713 | struct xfs_ail *ailp; | 2712 | struct xfs_ail *ailp = log->l_ailp; |
2714 | 2713 | ||
2715 | if (pass == XLOG_RECOVER_PASS1) { | 2714 | if (pass == XLOG_RECOVER_PASS1) { |
2716 | return; | 2715 | return; |
@@ -2727,8 +2726,6 @@ xlog_recover_do_efd_trans( | |||
2727 | * Search for the efi with the id in the efd format structure | 2726 | * Search for the efi with the id in the efd format structure |
2728 | * in the AIL. | 2727 | * in the AIL. |
2729 | */ | 2728 | */ |
2730 | mp = log->l_mp; | ||
2731 | ailp = log->l_ailp; | ||
2732 | spin_lock(&ailp->xa_lock); | 2729 | spin_lock(&ailp->xa_lock); |
2733 | lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); | 2730 | lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); |
2734 | while (lip != NULL) { | 2731 | while (lip != NULL) { |
@@ -2736,10 +2733,10 @@ xlog_recover_do_efd_trans( | |||
2736 | efip = (xfs_efi_log_item_t *)lip; | 2733 | efip = (xfs_efi_log_item_t *)lip; |
2737 | if (efip->efi_format.efi_id == efi_id) { | 2734 | if (efip->efi_format.efi_id == efi_id) { |
2738 | /* | 2735 | /* |
2739 | * xfs_trans_delete_ail() drops the | 2736 | * xfs_trans_ail_delete() drops the |
2740 | * AIL lock. | 2737 | * AIL lock. |
2741 | */ | 2738 | */ |
2742 | xfs_trans_delete_ail(mp, lip); | 2739 | xfs_trans_ail_delete(ailp, lip); |
2743 | xfs_efi_item_free(efip); | 2740 | xfs_efi_item_free(efip); |
2744 | spin_lock(&ailp->xa_lock); | 2741 | spin_lock(&ailp->xa_lock); |
2745 | break; | 2742 | break; |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 5163e1216c8e..ad137efc8702 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -1387,7 +1387,6 @@ xfs_trans_chunk_committed( | |||
1387 | 1387 | ||
1388 | lidp = licp->lic_descs; | 1388 | lidp = licp->lic_descs; |
1389 | for (i = 0; i < licp->lic_unused; i++, lidp++) { | 1389 | for (i = 0; i < licp->lic_unused; i++, lidp++) { |
1390 | struct xfs_mount *mp; | ||
1391 | struct xfs_ail *ailp; | 1390 | struct xfs_ail *ailp; |
1392 | 1391 | ||
1393 | if (xfs_lic_isfree(licp, i)) { | 1392 | if (xfs_lic_isfree(licp, i)) { |
@@ -1426,7 +1425,6 @@ xfs_trans_chunk_committed( | |||
1426 | * This would cause the earlier transaction to fail | 1425 | * This would cause the earlier transaction to fail |
1427 | * the test below. | 1426 | * the test below. |
1428 | */ | 1427 | */ |
1429 | mp = lip->li_mountp; | ||
1430 | ailp = lip->li_ailp; | 1428 | ailp = lip->li_ailp; |
1431 | spin_lock(&ailp->xa_lock); | 1429 | spin_lock(&ailp->xa_lock); |
1432 | if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) { | 1430 | if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) { |
@@ -1435,9 +1433,9 @@ xfs_trans_chunk_committed( | |||
1435 | * and update the position of the item in | 1433 | * and update the position of the item in |
1436 | * the AIL. | 1434 | * the AIL. |
1437 | * | 1435 | * |
1438 | * xfs_trans_update_ail() drops the AIL lock. | 1436 | * xfs_trans_ail_update() drops the AIL lock. |
1439 | */ | 1437 | */ |
1440 | xfs_trans_update_ail(mp, lip, item_lsn); | 1438 | xfs_trans_ail_update(ailp, lip, item_lsn); |
1441 | } else { | 1439 | } else { |
1442 | spin_unlock(&ailp->xa_lock); | 1440 | spin_unlock(&ailp->xa_lock); |
1443 | } | 1441 | } |
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h index 0df515477577..d6fe4a88d79f 100644 --- a/fs/xfs/xfs_trans.h +++ b/fs/xfs/xfs_trans.h | |||
@@ -971,9 +971,6 @@ int _xfs_trans_commit(xfs_trans_t *, | |||
971 | void xfs_trans_cancel(xfs_trans_t *, int); | 971 | void xfs_trans_cancel(xfs_trans_t *, int); |
972 | int xfs_trans_ail_init(struct xfs_mount *); | 972 | int xfs_trans_ail_init(struct xfs_mount *); |
973 | void xfs_trans_ail_destroy(struct xfs_mount *); | 973 | void xfs_trans_ail_destroy(struct xfs_mount *); |
974 | void xfs_trans_push_ail(struct xfs_mount *, xfs_lsn_t); | ||
975 | void xfs_trans_unlocked_item(struct xfs_mount *, | ||
976 | xfs_log_item_t *); | ||
977 | xfs_log_busy_slot_t *xfs_trans_add_busy(xfs_trans_t *tp, | 974 | xfs_log_busy_slot_t *xfs_trans_add_busy(xfs_trans_t *tp, |
978 | xfs_agnumber_t ag, | 975 | xfs_agnumber_t ag, |
979 | xfs_extlen_t idx); | 976 | xfs_extlen_t idx); |
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c index 0cd47a797d32..67ee4663336c 100644 --- a/fs/xfs/xfs_trans_ail.c +++ b/fs/xfs/xfs_trans_ail.c | |||
@@ -86,16 +86,16 @@ xfs_trans_ail_tail( | |||
86 | * any of the objects, so the lock is not needed. | 86 | * any of the objects, so the lock is not needed. |
87 | */ | 87 | */ |
88 | void | 88 | void |
89 | xfs_trans_push_ail( | 89 | xfs_trans_ail_push( |
90 | xfs_mount_t *mp, | 90 | struct xfs_ail *ailp, |
91 | xfs_lsn_t threshold_lsn) | 91 | xfs_lsn_t threshold_lsn) |
92 | { | 92 | { |
93 | xfs_log_item_t *lip; | 93 | xfs_log_item_t *lip; |
94 | 94 | ||
95 | lip = xfs_ail_min(mp->m_ail); | 95 | lip = xfs_ail_min(ailp); |
96 | if (lip && !XFS_FORCED_SHUTDOWN(mp)) { | 96 | if (lip && !XFS_FORCED_SHUTDOWN(ailp->xa_mount)) { |
97 | if (XFS_LSN_CMP(threshold_lsn, mp->m_ail->xa_target) > 0) | 97 | if (XFS_LSN_CMP(threshold_lsn, ailp->xa_target) > 0) |
98 | xfsaild_wakeup(mp->m_ail, threshold_lsn); | 98 | xfsaild_wakeup(ailp, threshold_lsn); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
@@ -412,7 +412,7 @@ xfsaild_push( | |||
412 | */ | 412 | */ |
413 | void | 413 | void |
414 | xfs_trans_unlocked_item( | 414 | xfs_trans_unlocked_item( |
415 | xfs_mount_t *mp, | 415 | struct xfs_ail *ailp, |
416 | xfs_log_item_t *lip) | 416 | xfs_log_item_t *lip) |
417 | { | 417 | { |
418 | xfs_log_item_t *min_lip; | 418 | xfs_log_item_t *min_lip; |
@@ -424,7 +424,7 @@ xfs_trans_unlocked_item( | |||
424 | * over some potentially valid data. | 424 | * over some potentially valid data. |
425 | */ | 425 | */ |
426 | if (!(lip->li_flags & XFS_LI_IN_AIL) || | 426 | if (!(lip->li_flags & XFS_LI_IN_AIL) || |
427 | XFS_FORCED_SHUTDOWN(mp)) { | 427 | XFS_FORCED_SHUTDOWN(ailp->xa_mount)) { |
428 | return; | 428 | return; |
429 | } | 429 | } |
430 | 430 | ||
@@ -440,10 +440,10 @@ xfs_trans_unlocked_item( | |||
440 | * the call to xfs_log_move_tail() doesn't do anything if there's | 440 | * the call to xfs_log_move_tail() doesn't do anything if there's |
441 | * not enough free space to wake people up so we're safe calling it. | 441 | * not enough free space to wake people up so we're safe calling it. |
442 | */ | 442 | */ |
443 | min_lip = xfs_ail_min(mp->m_ail); | 443 | min_lip = xfs_ail_min(ailp); |
444 | 444 | ||
445 | if (min_lip == lip) | 445 | if (min_lip == lip) |
446 | xfs_log_move_tail(mp, 1); | 446 | xfs_log_move_tail(ailp->xa_mount, 1); |
447 | } /* xfs_trans_unlocked_item */ | 447 | } /* xfs_trans_unlocked_item */ |
448 | 448 | ||
449 | 449 | ||
@@ -460,12 +460,11 @@ xfs_trans_unlocked_item( | |||
460 | * is dropped before returning. | 460 | * is dropped before returning. |
461 | */ | 461 | */ |
462 | void | 462 | void |
463 | xfs_trans_update_ail( | 463 | xfs_trans_ail_update( |
464 | xfs_mount_t *mp, | 464 | struct xfs_ail *ailp, |
465 | xfs_log_item_t *lip, | 465 | xfs_log_item_t *lip, |
466 | xfs_lsn_t lsn) __releases(ailp->xa_lock) | 466 | xfs_lsn_t lsn) __releases(ailp->xa_lock) |
467 | { | 467 | { |
468 | struct xfs_ail *ailp = mp->m_ail; | ||
469 | xfs_log_item_t *dlip = NULL; | 468 | xfs_log_item_t *dlip = NULL; |
470 | xfs_log_item_t *mlip; /* ptr to minimum lip */ | 469 | xfs_log_item_t *mlip; /* ptr to minimum lip */ |
471 | 470 | ||
@@ -485,7 +484,7 @@ xfs_trans_update_ail( | |||
485 | if (mlip == dlip) { | 484 | if (mlip == dlip) { |
486 | mlip = xfs_ail_min(ailp); | 485 | mlip = xfs_ail_min(ailp); |
487 | spin_unlock(&ailp->xa_lock); | 486 | spin_unlock(&ailp->xa_lock); |
488 | xfs_log_move_tail(mp, mlip->li_lsn); | 487 | xfs_log_move_tail(ailp->xa_mount, mlip->li_lsn); |
489 | } else { | 488 | } else { |
490 | spin_unlock(&ailp->xa_lock); | 489 | spin_unlock(&ailp->xa_lock); |
491 | } | 490 | } |
@@ -509,11 +508,10 @@ xfs_trans_update_ail( | |||
509 | * is dropped before returning. | 508 | * is dropped before returning. |
510 | */ | 509 | */ |
511 | void | 510 | void |
512 | xfs_trans_delete_ail( | 511 | xfs_trans_ail_delete( |
513 | xfs_mount_t *mp, | 512 | struct xfs_ail *ailp, |
514 | xfs_log_item_t *lip) __releases(ailp->xa_lock) | 513 | xfs_log_item_t *lip) __releases(ailp->xa_lock) |
515 | { | 514 | { |
516 | struct xfs_ail *ailp = mp->m_ail; | ||
517 | xfs_log_item_t *dlip; | 515 | xfs_log_item_t *dlip; |
518 | xfs_log_item_t *mlip; | 516 | xfs_log_item_t *mlip; |
519 | 517 | ||
@@ -530,7 +528,8 @@ xfs_trans_delete_ail( | |||
530 | if (mlip == dlip) { | 528 | if (mlip == dlip) { |
531 | mlip = xfs_ail_min(ailp); | 529 | mlip = xfs_ail_min(ailp); |
532 | spin_unlock(&ailp->xa_lock); | 530 | spin_unlock(&ailp->xa_lock); |
533 | xfs_log_move_tail(mp, (mlip ? mlip->li_lsn : 0)); | 531 | xfs_log_move_tail(ailp->xa_mount, |
532 | (mlip ? mlip->li_lsn : 0)); | ||
534 | } else { | 533 | } else { |
535 | spin_unlock(&ailp->xa_lock); | 534 | spin_unlock(&ailp->xa_lock); |
536 | } | 535 | } |
@@ -540,6 +539,8 @@ xfs_trans_delete_ail( | |||
540 | * If the file system is not being shutdown, we are in | 539 | * If the file system is not being shutdown, we are in |
541 | * serious trouble if we get to this stage. | 540 | * serious trouble if we get to this stage. |
542 | */ | 541 | */ |
542 | struct xfs_mount *mp = ailp->xa_mount; | ||
543 | |||
543 | spin_unlock(&ailp->xa_lock); | 544 | spin_unlock(&ailp->xa_lock); |
544 | if (!XFS_FORCED_SHUTDOWN(mp)) { | 545 | if (!XFS_FORCED_SHUTDOWN(mp)) { |
545 | xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp, | 546 | xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp, |
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index 4e855b5ced66..8ee2f8c8b0a6 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c | |||
@@ -527,9 +527,8 @@ xfs_trans_brelse(xfs_trans_t *tp, | |||
527 | lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *); | 527 | lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *); |
528 | if (lip->li_type == XFS_LI_BUF) { | 528 | if (lip->li_type == XFS_LI_BUF) { |
529 | bip = XFS_BUF_FSPRIVATE(bp,xfs_buf_log_item_t*); | 529 | bip = XFS_BUF_FSPRIVATE(bp,xfs_buf_log_item_t*); |
530 | xfs_trans_unlocked_item( | 530 | xfs_trans_unlocked_item(bip->bli_item.li_ailp, |
531 | bip->bli_item.li_mountp, | 531 | lip); |
532 | lip); | ||
533 | } | 532 | } |
534 | } | 533 | } |
535 | xfs_buf_relse(bp); | 534 | xfs_buf_relse(bp); |
@@ -626,7 +625,7 @@ xfs_trans_brelse(xfs_trans_t *tp, | |||
626 | * tell the AIL that the buffer is being unlocked. | 625 | * tell the AIL that the buffer is being unlocked. |
627 | */ | 626 | */ |
628 | if (bip != NULL) { | 627 | if (bip != NULL) { |
629 | xfs_trans_unlocked_item(bip->bli_item.li_mountp, | 628 | xfs_trans_unlocked_item(bip->bli_item.li_ailp, |
630 | (xfs_log_item_t*)bip); | 629 | (xfs_log_item_t*)bip); |
631 | } | 630 | } |
632 | 631 | ||
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h index 6ca0a7a7e3df..73e2ad397432 100644 --- a/fs/xfs/xfs_trans_priv.h +++ b/fs/xfs/xfs_trans_priv.h | |||
@@ -85,12 +85,15 @@ struct xfs_ail { | |||
85 | /* | 85 | /* |
86 | * From xfs_trans_ail.c | 86 | * From xfs_trans_ail.c |
87 | */ | 87 | */ |
88 | void xfs_trans_update_ail(struct xfs_mount *mp, | 88 | void xfs_trans_ail_update(struct xfs_ail *ailp, |
89 | struct xfs_log_item *lip, xfs_lsn_t lsn) | 89 | struct xfs_log_item *lip, xfs_lsn_t lsn) |
90 | __releases(mp->m_ail_lock); | 90 | __releases(ailp->xa_lock); |
91 | void xfs_trans_delete_ail(struct xfs_mount *mp, | 91 | void xfs_trans_ail_delete(struct xfs_ail *ailp, |
92 | struct xfs_log_item *lip) | 92 | struct xfs_log_item *lip) |
93 | __releases(mp->m_ail_lock); | 93 | __releases(ailp->xa_lock); |
94 | void xfs_trans_ail_push(struct xfs_ail *, xfs_lsn_t); | ||
95 | void xfs_trans_unlocked_item(struct xfs_ail *, | ||
96 | xfs_log_item_t *); | ||
94 | 97 | ||
95 | xfs_lsn_t xfs_trans_ail_tail(struct xfs_ail *ailp); | 98 | xfs_lsn_t xfs_trans_ail_tail(struct xfs_ail *ailp); |
96 | 99 | ||