Commit c7e8f268 authored by David Chinner's avatar David Chinner Committed by Lachlan McIlroy

[XFS] Move the AIL lock into the struct xfs_ail

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: default avatarDavid Chinner <david@fromorbit.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
parent 7b2e2a31
...@@ -1333,7 +1333,7 @@ xfs_qm_dqflush_done( ...@@ -1333,7 +1333,7 @@ xfs_qm_dqflush_done(
if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) && if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
qip->qli_item.li_lsn == qip->qli_flush_lsn) { 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. * xfs_trans_delete_ail() drops the AIL lock.
*/ */
...@@ -1341,7 +1341,7 @@ xfs_qm_dqflush_done( ...@@ -1341,7 +1341,7 @@ xfs_qm_dqflush_done(
xfs_trans_delete_ail(dqp->q_mount, xfs_trans_delete_ail(dqp->q_mount,
(xfs_log_item_t*)qip); (xfs_log_item_t*)qip);
else else
spin_unlock(&dqp->q_mount->m_ail_lock); spin_unlock(&dqp->q_mount->m_ail->xa_lock);
} }
/* /*
......
...@@ -555,7 +555,7 @@ xfs_qm_qoffend_logitem_committed( ...@@ -555,7 +555,7 @@ xfs_qm_qoffend_logitem_committed(
xfs_qoff_logitem_t *qfs; xfs_qoff_logitem_t *qfs;
qfs = qfe->qql_start_lip; 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. * Delete the qoff-start logitem from the AIL.
* xfs_trans_delete_ail() drops the AIL lock. * xfs_trans_delete_ail() drops the AIL lock.
......
...@@ -408,7 +408,7 @@ xfs_buf_item_unpin( ...@@ -408,7 +408,7 @@ xfs_buf_item_unpin(
XFS_BUF_SET_FSPRIVATE(bp, NULL); XFS_BUF_SET_FSPRIVATE(bp, NULL);
XFS_BUF_CLR_IODONE_FUNC(bp); XFS_BUF_CLR_IODONE_FUNC(bp);
} else { } 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_trans_delete_ail(mp, (xfs_log_item_t *)bip);
xfs_buf_item_relse(bp); xfs_buf_item_relse(bp);
ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL); ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL);
...@@ -1138,7 +1138,7 @@ xfs_buf_iodone( ...@@ -1138,7 +1138,7 @@ xfs_buf_iodone(
* *
* Either way, AIL is useless if we're forcing a shutdown. * 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. * xfs_trans_delete_ail() drops the AIL lock.
*/ */
......
...@@ -111,7 +111,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale) ...@@ -111,7 +111,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
xfs_mount_t *mp; xfs_mount_t *mp;
mp = efip->efi_item.li_mountp; 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) { if (efip->efi_flags & XFS_EFI_CANCELED) {
/* /*
* xfs_trans_delete_ail() drops the AIL lock. * 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,7 +120,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
xfs_efi_item_free(efip); xfs_efi_item_free(efip);
} else { } else {
efip->efi_flags |= XFS_EFI_COMMITTED; efip->efi_flags |= XFS_EFI_COMMITTED;
spin_unlock(&mp->m_ail_lock); spin_unlock(&mp->m_ail->xa_lock);
} }
} }
...@@ -138,7 +138,7 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp) ...@@ -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; xfs_log_item_desc_t *lidp;
mp = efip->efi_item.li_mountp; 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) { if (efip->efi_flags & XFS_EFI_CANCELED) {
/* /*
* free the xaction descriptor pointing to this item * 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,7 +153,7 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
xfs_efi_item_free(efip); xfs_efi_item_free(efip);
} else { } else {
efip->efi_flags |= XFS_EFI_COMMITTED; efip->efi_flags |= XFS_EFI_COMMITTED;
spin_unlock(&mp->m_ail_lock); spin_unlock(&mp->m_ail->xa_lock);
} }
} }
...@@ -352,7 +352,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip, ...@@ -352,7 +352,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
ASSERT(efip->efi_next_extent > 0); ASSERT(efip->efi_next_extent > 0);
ASSERT(efip->efi_flags & XFS_EFI_COMMITTED); 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); ASSERT(efip->efi_next_extent >= nextents);
efip->efi_next_extent -= nextents; efip->efi_next_extent -= nextents;
extents_left = efip->efi_next_extent; extents_left = efip->efi_next_extent;
...@@ -363,7 +363,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip, ...@@ -363,7 +363,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip); xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
xfs_efi_item_free(efip); xfs_efi_item_free(efip);
} else { } else {
spin_unlock(&mp->m_ail_lock); spin_unlock(&mp->m_ail->xa_lock);
} }
} }
......
...@@ -2715,11 +2715,11 @@ xfs_idestroy( ...@@ -2715,11 +2715,11 @@ xfs_idestroy(
ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) || ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) ||
XFS_FORCED_SHUTDOWN(ip->i_mount)); XFS_FORCED_SHUTDOWN(ip->i_mount));
if (lip->li_flags & XFS_LI_IN_AIL) { 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) if (lip->li_flags & XFS_LI_IN_AIL)
xfs_trans_delete_ail(mp, lip); xfs_trans_delete_ail(mp, lip);
else else
spin_unlock(&mp->m_ail_lock); spin_unlock(&mp->m_ail->xa_lock);
} }
xfs_inode_item_destroy(ip); xfs_inode_item_destroy(ip);
ip->i_itemp = NULL; ip->i_itemp = NULL;
......
...@@ -991,7 +991,7 @@ xfs_iflush_done( ...@@ -991,7 +991,7 @@ xfs_iflush_done(
*/ */
if (iip->ili_logged && if (iip->ili_logged &&
(iip->ili_item.li_lsn == iip->ili_flush_lsn)) { (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) { if (iip->ili_item.li_lsn == iip->ili_flush_lsn) {
/* /*
* xfs_trans_delete_ail() drops the AIL lock. * xfs_trans_delete_ail() drops the AIL lock.
...@@ -999,7 +999,7 @@ xfs_iflush_done( ...@@ -999,7 +999,7 @@ xfs_iflush_done(
xfs_trans_delete_ail(ip->i_mount, xfs_trans_delete_ail(ip->i_mount,
(xfs_log_item_t*)iip); (xfs_log_item_t*)iip);
} else { } else {
spin_unlock(&ip->i_mount->m_ail_lock); spin_unlock(&ip->i_mount->m_ail->xa_lock);
} }
} }
...@@ -1038,14 +1038,14 @@ xfs_iflush_abort( ...@@ -1038,14 +1038,14 @@ xfs_iflush_abort(
mp = ip->i_mount; mp = ip->i_mount;
if (iip) { if (iip) {
if (iip->ili_item.li_flags & XFS_LI_IN_AIL) { 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) { if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
/* /*
* xfs_trans_delete_ail() drops the AIL lock. * xfs_trans_delete_ail() drops the AIL lock.
*/ */
xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip); xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip);
} else } else
spin_unlock(&mp->m_ail_lock); spin_unlock(&mp->m_ail->xa_lock);
} }
iip->ili_logged = 0; iip->ili_logged = 0;
/* /*
......
...@@ -567,7 +567,6 @@ xfs_log_mount( ...@@ -567,7 +567,6 @@ xfs_log_mount(
/* /*
* Initialize the AIL now we have a log. * Initialize the AIL now we have a log.
*/ */
spin_lock_init(&mp->m_ail_lock);
error = xfs_trans_ail_init(mp); error = xfs_trans_ail_init(mp);
if (error) { if (error) {
cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error); cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error);
......
...@@ -2681,7 +2681,7 @@ xlog_recover_do_efi_trans( ...@@ -2681,7 +2681,7 @@ xlog_recover_do_efi_trans(
efip->efi_next_extent = efi_formatp->efi_nextents; efip->efi_next_extent = efi_formatp->efi_nextents;
efip->efi_flags |= XFS_EFI_COMMITTED; 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. * xfs_trans_update_ail() drops the AIL lock.
*/ */
...@@ -2727,7 +2727,7 @@ xlog_recover_do_efd_trans( ...@@ -2727,7 +2727,7 @@ xlog_recover_do_efd_trans(
* in the AIL. * in the AIL.
*/ */
mp = log->l_mp; 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); lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0);
while (lip != NULL) { while (lip != NULL) {
if (lip->li_type == XFS_LI_EFI) { if (lip->li_type == XFS_LI_EFI) {
...@@ -2739,14 +2739,14 @@ xlog_recover_do_efd_trans( ...@@ -2739,14 +2739,14 @@ xlog_recover_do_efd_trans(
*/ */
xfs_trans_delete_ail(mp, lip); xfs_trans_delete_ail(mp, lip);
xfs_efi_item_free(efip); xfs_efi_item_free(efip);
spin_lock(&mp->m_ail_lock); spin_lock(&mp->m_ail->xa_lock);
break; break;
} }
} }
lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur);
} }
xfs_trans_ail_cursor_done(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);
} }
/* /*
...@@ -3058,7 +3058,7 @@ xlog_recover_process_efis( ...@@ -3058,7 +3058,7 @@ xlog_recover_process_efis(
struct xfs_ail_cursor cur; struct xfs_ail_cursor cur;
mp = log->l_mp; 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); lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0);
while (lip != NULL) { while (lip != NULL) {
...@@ -3084,16 +3084,16 @@ xlog_recover_process_efis( ...@@ -3084,16 +3084,16 @@ xlog_recover_process_efis(
continue; continue;
} }
spin_unlock(&mp->m_ail_lock); spin_unlock(&mp->m_ail->xa_lock);
error = xlog_recover_process_efi(mp, efip); error = xlog_recover_process_efi(mp, efip);
spin_lock(&mp->m_ail_lock); spin_lock(&mp->m_ail->xa_lock);
if (error) if (error)
goto out; goto out;
lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur);
} }
out: out:
xfs_trans_ail_cursor_done(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);
return error; return error;
} }
......
...@@ -228,7 +228,6 @@ extern void xfs_icsb_sync_counters_locked(struct xfs_mount *, int); ...@@ -228,7 +228,6 @@ extern void xfs_icsb_sync_counters_locked(struct xfs_mount *, int);
typedef struct xfs_mount { typedef struct xfs_mount {
struct super_block *m_super; struct super_block *m_super;
xfs_tid_t m_tid; /* next unused tid for fs */ 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 */ struct xfs_ail *m_ail; /* fs active log item list */
xfs_sb_t m_sb; /* copy of fs superblock */ xfs_sb_t m_sb; /* copy of fs superblock */
spinlock_t m_sb_lock; /* sb counter lock */ spinlock_t m_sb_lock; /* sb counter lock */
......
...@@ -1425,7 +1425,7 @@ xfs_trans_chunk_committed( ...@@ -1425,7 +1425,7 @@ xfs_trans_chunk_committed(
* the test below. * the test below.
*/ */
mp = lip->li_mountp; 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) { if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) {
/* /*
* This will set the item's lsn to item_lsn * This will set the item's lsn to item_lsn
...@@ -1436,7 +1436,7 @@ xfs_trans_chunk_committed( ...@@ -1436,7 +1436,7 @@ xfs_trans_chunk_committed(
*/ */
xfs_trans_update_ail(mp, lip, item_lsn); xfs_trans_update_ail(mp, lip, item_lsn);
} else { } else {
spin_unlock(&mp->m_ail_lock); spin_unlock(&mp->m_ail->xa_lock);
} }
/* /*
......
/* /*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* Copyright (c) 2008 Dave Chinner
* All Rights Reserved. * All Rights Reserved.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -56,14 +57,14 @@ xfs_trans_ail_tail( ...@@ -56,14 +57,14 @@ xfs_trans_ail_tail(
xfs_lsn_t lsn; xfs_lsn_t lsn;
xfs_log_item_t *lip; xfs_log_item_t *lip;
spin_lock(&ailp->xa_mount->m_ail_lock); spin_lock(&ailp->xa_lock);
lip = xfs_ail_min(ailp); lip = xfs_ail_min(ailp);
if (lip == NULL) { if (lip == NULL) {
lsn = (xfs_lsn_t)0; lsn = (xfs_lsn_t)0;
} else { } else {
lsn = lip->li_lsn; lsn = lip->li_lsn;
} }
spin_unlock(&ailp->xa_mount->m_ail_lock); spin_unlock(&ailp->xa_lock);
return lsn; return lsn;
} }
...@@ -252,7 +253,7 @@ xfsaild_push( ...@@ -252,7 +253,7 @@ xfsaild_push(
xfs_mount_t *mp = ailp->xa_mount; xfs_mount_t *mp = ailp->xa_mount;
struct xfs_ail_cursor *cur = &ailp->xa_cursors; struct xfs_ail_cursor *cur = &ailp->xa_cursors;
spin_lock(&mp->m_ail_lock); spin_lock(&ailp->xa_lock);
xfs_trans_ail_cursor_init(ailp, cur); xfs_trans_ail_cursor_init(ailp, cur);
lip = xfs_trans_ail_cursor_first(ailp, cur, *last_lsn); lip = xfs_trans_ail_cursor_first(ailp, cur, *last_lsn);
if (!lip || XFS_FORCED_SHUTDOWN(mp)) { if (!lip || XFS_FORCED_SHUTDOWN(mp)) {
...@@ -260,7 +261,7 @@ xfsaild_push( ...@@ -260,7 +261,7 @@ xfsaild_push(
* AIL is empty or our push has reached the end. * AIL is empty or our push has reached the end.
*/ */
xfs_trans_ail_cursor_done(ailp, cur); xfs_trans_ail_cursor_done(ailp, cur);
spin_unlock(&mp->m_ail_lock); spin_unlock(&ailp->xa_lock);
last_pushed_lsn = 0; last_pushed_lsn = 0;
return tout; return tout;
} }
...@@ -295,7 +296,7 @@ xfsaild_push( ...@@ -295,7 +296,7 @@ xfsaild_push(
* skip to the next item in the list. * skip to the next item in the list.
*/ */
lock_result = IOP_TRYLOCK(lip); lock_result = IOP_TRYLOCK(lip);
spin_unlock(&mp->m_ail_lock); spin_unlock(&ailp->xa_lock);
switch (lock_result) { switch (lock_result) {
case XFS_ITEM_SUCCESS: case XFS_ITEM_SUCCESS:
XFS_STATS_INC(xs_push_ail_success); XFS_STATS_INC(xs_push_ail_success);
...@@ -332,7 +333,7 @@ xfsaild_push( ...@@ -332,7 +333,7 @@ xfsaild_push(
break; break;
} }
spin_lock(&mp->m_ail_lock); spin_lock(&ailp->xa_lock);
/* should we bother continuing? */ /* should we bother continuing? */
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
break; break;
...@@ -361,7 +362,7 @@ xfsaild_push( ...@@ -361,7 +362,7 @@ xfsaild_push(
lsn = lip->li_lsn; lsn = lip->li_lsn;
} }
xfs_trans_ail_cursor_done(ailp, cur); xfs_trans_ail_cursor_done(ailp, cur);
spin_unlock(&mp->m_ail_lock); spin_unlock(&ailp->xa_lock);
if (flush_log) { if (flush_log) {
/* /*
...@@ -462,30 +463,31 @@ void ...@@ -462,30 +463,31 @@ void
xfs_trans_update_ail( xfs_trans_update_ail(
xfs_mount_t *mp, xfs_mount_t *mp,
xfs_log_item_t *lip, xfs_log_item_t *lip,
xfs_lsn_t lsn) __releases(mp->m_ail_lock) xfs_lsn_t lsn) __releases(ailp->xa_lock)
{ {
xfs_log_item_t *dlip=NULL; struct xfs_ail *ailp = mp->m_ail;
xfs_log_item_t *dlip = NULL;
xfs_log_item_t *mlip; /* ptr to minimum lip */ xfs_log_item_t *mlip; /* ptr to minimum lip */
mlip = xfs_ail_min(mp->m_ail); mlip = xfs_ail_min(ailp);
if (lip->li_flags & XFS_LI_IN_AIL) { if (lip->li_flags & XFS_LI_IN_AIL) {
dlip = xfs_ail_delete(mp->m_ail, lip); dlip = xfs_ail_delete(ailp, lip);
ASSERT(dlip == lip); ASSERT(dlip == lip);
xfs_trans_ail_cursor_clear(mp->m_ail, dlip); xfs_trans_ail_cursor_clear(ailp, dlip);
} else { } else {
lip->li_flags |= XFS_LI_IN_AIL; lip->li_flags |= XFS_LI_IN_AIL;
} }
lip->li_lsn = lsn; lip->li_lsn = lsn;
xfs_ail_insert(mp->m_ail, lip); xfs_ail_insert(ailp, lip);
if (mlip == dlip) { if (mlip == dlip) {
mlip = xfs_ail_min(mp->m_ail); mlip = xfs_ail_min(ailp);
spin_unlock(&mp->m_ail_lock); spin_unlock(&ailp->xa_lock);
xfs_log_move_tail(mp, mlip->li_lsn); xfs_log_move_tail(mp, mlip->li_lsn);
} else { } else {
spin_unlock(&mp->m_ail_lock); spin_unlock(&ailp->xa_lock);
} }
...@@ -509,27 +511,28 @@ xfs_trans_update_ail( ...@@ -509,27 +511,28 @@ xfs_trans_update_ail(
void void
xfs_trans_delete_ail( xfs_trans_delete_ail(
xfs_mount_t *mp, xfs_mount_t *mp,
xfs_log_item_t *lip) __releases(mp->m_ail_lock) xfs_log_item_t *lip) __releases(ailp->xa_lock)
{ {
struct xfs_ail *ailp = mp->m_ail;
xfs_log_item_t *dlip; xfs_log_item_t *dlip;
xfs_log_item_t *mlip; xfs_log_item_t *mlip;
if (lip->li_flags & XFS_LI_IN_AIL) { if (lip->li_flags & XFS_LI_IN_AIL) {
mlip = xfs_ail_min(mp->m_ail); mlip = xfs_ail_min(ailp);
dlip = xfs_ail_delete(mp->m_ail, lip); dlip = xfs_ail_delete(ailp, lip);
ASSERT(dlip == lip); ASSERT(dlip == lip);
xfs_trans_ail_cursor_clear(mp->m_ail, dlip); xfs_trans_ail_cursor_clear(ailp, dlip);
lip->li_flags &= ~XFS_LI_IN_AIL; lip->li_flags &= ~XFS_LI_IN_AIL;
lip->li_lsn = 0; lip->li_lsn = 0;
if (mlip == dlip) { if (mlip == dlip) {
mlip = xfs_ail_min(mp->m_ail); mlip = xfs_ail_min(ailp);
spin_unlock(&mp->m_ail_lock); spin_unlock(&ailp->xa_lock);
xfs_log_move_tail(mp, (mlip ? mlip->li_lsn : 0)); xfs_log_move_tail(mp, (mlip ? mlip->li_lsn : 0));
} else { } else {
spin_unlock(&mp->m_ail_lock); spin_unlock(&ailp->xa_lock);
} }
} }
else { else {
...@@ -537,13 +540,11 @@ xfs_trans_delete_ail( ...@@ -537,13 +540,11 @@ xfs_trans_delete_ail(
* If the file system is not being shutdown, we are in * If the file system is not being shutdown, we are in
* serious trouble if we get to this stage. * serious trouble if we get to this stage.
*/ */
if (XFS_FORCED_SHUTDOWN(mp)) spin_unlock(&ailp->xa_lock);
spin_unlock(&mp->m_ail_lock); if (!XFS_FORCED_SHUTDOWN(mp)) {
else {
xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp, xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp,
"%s: attempting to delete a log item that is not in the AIL", "%s: attempting to delete a log item that is not in the AIL",
__func__); __func__);
spin_unlock(&mp->m_ail_lock);
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
} }
} }
...@@ -578,6 +579,7 @@ xfs_trans_ail_init( ...@@ -578,6 +579,7 @@ xfs_trans_ail_init(
ailp->xa_mount = mp; ailp->xa_mount = mp;
INIT_LIST_HEAD(&ailp->xa_ail); INIT_LIST_HEAD(&ailp->xa_ail);
spin_lock_init(&ailp->xa_lock);
error = xfsaild_start(ailp); error = xfsaild_start(ailp);
if (error) if (error)
goto out_free_ailp; goto out_free_ailp;
......
...@@ -79,6 +79,7 @@ struct xfs_ail { ...@@ -79,6 +79,7 @@ struct xfs_ail {
struct task_struct *xa_task; struct task_struct *xa_task;
xfs_lsn_t xa_target; xfs_lsn_t xa_target;
struct xfs_ail_cursor xa_cursors; struct xfs_ail_cursor xa_cursors;
spinlock_t xa_lock;
}; };
/* /*
...@@ -114,9 +115,9 @@ xfs_trans_ail_copy_lsn( ...@@ -114,9 +115,9 @@ xfs_trans_ail_copy_lsn(
xfs_lsn_t *src) xfs_lsn_t *src)
{ {
ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */ ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */
spin_lock(&ailp->xa_mount->m_ail_lock); spin_lock(&ailp->xa_lock);
*dst = *src; *dst = *src;
spin_unlock(&ailp->xa_mount->m_ail_lock); spin_unlock(&ailp->xa_lock);
} }
#else #else
static inline void static inline void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment