Skip to content

Commit

Permalink
[XFS] Move the AIL lock into the struct xfs_ail
Browse files Browse the repository at this point in the history
Bring the ail lock inside the struct xfs_ail. This means the AIL can be
entirely manipulated via the struct xfs_ail rather than needing both the
struct xfs_mount and the struct xfs_ail.

SGI-PV: 988143

SGI-Modid: xfs-linux-melb:xfs-kern:32350a

Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
  • Loading branch information
David Chinner authored and Lachlan McIlroy committed Oct 30, 2008
1 parent 7b2e2a3 commit c7e8f26
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 58 deletions.
4 changes: 2 additions & 2 deletions fs/xfs/quota/xfs_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1333,15 +1333,15 @@ xfs_qm_dqflush_done(
if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
qip->qli_item.li_lsn == qip->qli_flush_lsn) {

spin_lock(&dqp->q_mount->m_ail_lock);
spin_lock(&dqp->q_mount->m_ail->xa_lock);
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
if (qip->qli_item.li_lsn == qip->qli_flush_lsn)
xfs_trans_delete_ail(dqp->q_mount,
(xfs_log_item_t*)qip);
else
spin_unlock(&dqp->q_mount->m_ail_lock);
spin_unlock(&dqp->q_mount->m_ail->xa_lock);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion fs/xfs/quota/xfs_dquot_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ xfs_qm_qoffend_logitem_committed(
xfs_qoff_logitem_t *qfs;

qfs = qfe->qql_start_lip;
spin_lock(&qfs->qql_item.li_mountp->m_ail_lock);
spin_lock(&qfs->qql_item.li_mountp->m_ail->xa_lock);
/*
* Delete the qoff-start logitem from the AIL.
* xfs_trans_delete_ail() drops the AIL lock.
Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/xfs_buf_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ xfs_buf_item_unpin(
XFS_BUF_SET_FSPRIVATE(bp, NULL);
XFS_BUF_CLR_IODONE_FUNC(bp);
} else {
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
xfs_buf_item_relse(bp);
ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL);
Expand Down Expand Up @@ -1138,7 +1138,7 @@ xfs_buf_iodone(
*
* Either way, AIL is useless if we're forcing a shutdown.
*/
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
Expand Down
12 changes: 6 additions & 6 deletions fs/xfs/xfs_extfree_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
xfs_mount_t *mp;

mp = efip->efi_item.li_mountp;
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
if (efip->efi_flags & XFS_EFI_CANCELED) {
/*
* xfs_trans_delete_ail() drops the AIL lock.
Expand All @@ -120,7 +120,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
xfs_efi_item_free(efip);
} else {
efip->efi_flags |= XFS_EFI_COMMITTED;
spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
}
}

Expand All @@ -138,7 +138,7 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
xfs_log_item_desc_t *lidp;

mp = efip->efi_item.li_mountp;
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
if (efip->efi_flags & XFS_EFI_CANCELED) {
/*
* free the xaction descriptor pointing to this item
Expand All @@ -153,7 +153,7 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
xfs_efi_item_free(efip);
} else {
efip->efi_flags |= XFS_EFI_COMMITTED;
spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
}
}

Expand Down Expand Up @@ -352,7 +352,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
ASSERT(efip->efi_next_extent > 0);
ASSERT(efip->efi_flags & XFS_EFI_COMMITTED);

spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
ASSERT(efip->efi_next_extent >= nextents);
efip->efi_next_extent -= nextents;
extents_left = efip->efi_next_extent;
Expand All @@ -363,7 +363,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
xfs_efi_item_free(efip);
} else {
spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
}
}

Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2715,11 +2715,11 @@ xfs_idestroy(
ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) ||
XFS_FORCED_SHUTDOWN(ip->i_mount));
if (lip->li_flags & XFS_LI_IN_AIL) {
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
if (lip->li_flags & XFS_LI_IN_AIL)
xfs_trans_delete_ail(mp, lip);
else
spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
}
xfs_inode_item_destroy(ip);
ip->i_itemp = NULL;
Expand Down
8 changes: 4 additions & 4 deletions fs/xfs/xfs_inode_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,15 +991,15 @@ xfs_iflush_done(
*/
if (iip->ili_logged &&
(iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
spin_lock(&ip->i_mount->m_ail_lock);
spin_lock(&ip->i_mount->m_ail->xa_lock);
if (iip->ili_item.li_lsn == iip->ili_flush_lsn) {
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(ip->i_mount,
(xfs_log_item_t*)iip);
} else {
spin_unlock(&ip->i_mount->m_ail_lock);
spin_unlock(&ip->i_mount->m_ail->xa_lock);
}
}

Expand Down Expand Up @@ -1038,14 +1038,14 @@ xfs_iflush_abort(
mp = ip->i_mount;
if (iip) {
if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip);
} else
spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
}
iip->ili_logged = 0;
/*
Expand Down
1 change: 0 additions & 1 deletion fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,6 @@ xfs_log_mount(
/*
* Initialize the AIL now we have a log.
*/
spin_lock_init(&mp->m_ail_lock);
error = xfs_trans_ail_init(mp);
if (error) {
cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error);
Expand Down
16 changes: 8 additions & 8 deletions fs/xfs/xfs_log_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,7 @@ xlog_recover_do_efi_trans(
efip->efi_next_extent = efi_formatp->efi_nextents;
efip->efi_flags |= XFS_EFI_COMMITTED;

spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
/*
* xfs_trans_update_ail() drops the AIL lock.
*/
Expand Down Expand Up @@ -2727,7 +2727,7 @@ xlog_recover_do_efd_trans(
* in the AIL.
*/
mp = log->l_mp;
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0);
while (lip != NULL) {
if (lip->li_type == XFS_LI_EFI) {
Expand All @@ -2739,14 +2739,14 @@ xlog_recover_do_efd_trans(
*/
xfs_trans_delete_ail(mp, lip);
xfs_efi_item_free(efip);
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
break;
}
}
lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur);
}
xfs_trans_ail_cursor_done(mp->m_ail, &cur);
spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
}

/*
Expand Down Expand Up @@ -3058,7 +3058,7 @@ xlog_recover_process_efis(
struct xfs_ail_cursor cur;

mp = log->l_mp;
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);

lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0);
while (lip != NULL) {
Expand All @@ -3084,16 +3084,16 @@ xlog_recover_process_efis(
continue;
}

spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
error = xlog_recover_process_efi(mp, efip);
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
if (error)
goto out;
lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur);
}
out:
xfs_trans_ail_cursor_done(mp->m_ail, &cur);
spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
return error;
}

Expand Down
1 change: 0 additions & 1 deletion fs/xfs/xfs_mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ extern void xfs_icsb_sync_counters_locked(struct xfs_mount *, int);
typedef struct xfs_mount {
struct super_block *m_super;
xfs_tid_t m_tid; /* next unused tid for fs */
spinlock_t m_ail_lock; /* fs AIL mutex */
struct xfs_ail *m_ail; /* fs active log item list */
xfs_sb_t m_sb; /* copy of fs superblock */
spinlock_t m_sb_lock; /* sb counter lock */
Expand Down
4 changes: 2 additions & 2 deletions fs/xfs/xfs_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ xfs_trans_chunk_committed(
* the test below.
*/
mp = lip->li_mountp;
spin_lock(&mp->m_ail_lock);
spin_lock(&mp->m_ail->xa_lock);
if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) {
/*
* This will set the item's lsn to item_lsn
Expand All @@ -1436,7 +1436,7 @@ xfs_trans_chunk_committed(
*/
xfs_trans_update_ail(mp, lip, item_lsn);
} else {
spin_unlock(&mp->m_ail_lock);
spin_unlock(&mp->m_ail->xa_lock);
}

/*
Expand Down
Loading

0 comments on commit c7e8f26

Please sign in to comment.