aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans_ail.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-04-23 01:58:33 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:26 -0400
commit1c30462542bac8abffb4823638b6b1659c1cfcf5 (patch)
treeb86f1fc14eb0f41e224833128ecc81163227d044 /fs/xfs/xfs_trans_ail.c
parent32ce90a4b79155a155de2b284d8b69023e5e8fea (diff)
xfs: allow assigning the tail lsn with the AIL lock held
Provide a variant of xlog_assign_tail_lsn that has the AIL lock already held. By doing so we do an additional atomic_read + atomic_set under the lock, which comes down to two instructions. Switch xfs_trans_ail_update_bulk and xfs_trans_ail_delete_bulk to the new version to reduce the number of lock roundtrips, and prepare for a new addition that would require a third lock roundtrip in xfs_trans_ail_delete_bulk. This addition is also the reason for slightly rearranging the conditionals and relying on xfs_log_space_wake for checking that the filesystem has been shut down internally. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans_ail.c')
-rw-r--r--fs/xfs/xfs_trans_ail.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 1dead07f092c..77acc53f2f31 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -79,7 +79,7 @@ xfs_ail_check(
79 * Return a pointer to the first item in the AIL. If the AIL is empty, then 79 * Return a pointer to the first item in the AIL. If the AIL is empty, then
80 * return NULL. 80 * return NULL.
81 */ 81 */
82static xfs_log_item_t * 82xfs_log_item_t *
83xfs_ail_min( 83xfs_ail_min(
84 struct xfs_ail *ailp) 84 struct xfs_ail *ailp)
85{ 85{
@@ -667,11 +667,15 @@ xfs_trans_ail_update_bulk(
667 667
668 if (!list_empty(&tmp)) 668 if (!list_empty(&tmp))
669 xfs_ail_splice(ailp, cur, &tmp, lsn); 669 xfs_ail_splice(ailp, cur, &tmp, lsn);
670 spin_unlock(&ailp->xa_lock);
671 670
672 if (mlip_changed && !XFS_FORCED_SHUTDOWN(ailp->xa_mount)) { 671 if (mlip_changed) {
673 xlog_assign_tail_lsn(ailp->xa_mount); 672 if (!XFS_FORCED_SHUTDOWN(ailp->xa_mount))
673 xlog_assign_tail_lsn_locked(ailp->xa_mount);
674 spin_unlock(&ailp->xa_lock);
675
674 xfs_log_space_wake(ailp->xa_mount); 676 xfs_log_space_wake(ailp->xa_mount);
677 } else {
678 spin_unlock(&ailp->xa_lock);
675 } 679 }
676} 680}
677 681
@@ -729,11 +733,15 @@ xfs_trans_ail_delete_bulk(
729 if (mlip == lip) 733 if (mlip == lip)
730 mlip_changed = 1; 734 mlip_changed = 1;
731 } 735 }
732 spin_unlock(&ailp->xa_lock);
733 736
734 if (mlip_changed && !XFS_FORCED_SHUTDOWN(ailp->xa_mount)) { 737 if (mlip_changed) {
735 xlog_assign_tail_lsn(ailp->xa_mount); 738 if (!XFS_FORCED_SHUTDOWN(ailp->xa_mount))
739 xlog_assign_tail_lsn_locked(ailp->xa_mount);
740 spin_unlock(&ailp->xa_lock);
741
736 xfs_log_space_wake(ailp->xa_mount); 742 xfs_log_space_wake(ailp->xa_mount);
743 } else {
744 spin_unlock(&ailp->xa_lock);
737 } 745 }
738} 746}
739 747