Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124858
b: refs/heads/master
c: 783a2f6
h: refs/heads/master
v: v3
  • Loading branch information
David Chinner authored and Lachlan McIlroy committed Oct 30, 2008
1 parent d8347c4 commit e36f41c
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 120 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fc1829f34d30899701dfd5890030d39e13e1f47d
refs/heads/master: 783a2f656f9674c31d4019708a94af93fa1d1c22
15 changes: 7 additions & 8 deletions trunk/fs/xfs/quota/xfs_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,8 +1319,10 @@ xfs_qm_dqflush_done(
xfs_dq_logitem_t *qip)
{
xfs_dquot_t *dqp;
struct xfs_ail *ailp;

dqp = qip->qli_dquot;
ailp = qip->qli_item.li_ailp;

/*
* We only want to pull the item from the AIL if its
Expand All @@ -1333,15 +1335,12 @@ 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->xa_lock);
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
/* xfs_trans_ail_delete() drops the AIL lock. */
spin_lock(&ailp->xa_lock);
if (qip->qli_item.li_lsn == qip->qli_flush_lsn)
xfs_trans_delete_ail(dqp->q_mount,
(xfs_log_item_t*)qip);
xfs_trans_ail_delete(ailp, (xfs_log_item_t*)qip);
else
spin_unlock(&dqp->q_mount->m_ail->xa_lock);
spin_unlock(&ailp->xa_lock);
}

/*
Expand Down Expand Up @@ -1371,7 +1370,7 @@ xfs_dqunlock(
mutex_unlock(&(dqp->q_qlock));
if (dqp->q_logitem.qli_dquot == dqp) {
/* Once was dqp->q_mount, but might just have been cleared */
xfs_trans_unlocked_item(dqp->q_logitem.qli_item.li_mountp,
xfs_trans_unlocked_item(dqp->q_logitem.qli_item.li_ailp,
(xfs_log_item_t*)&(dqp->q_logitem));
}
}
Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/xfs/quota/xfs_dquot_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,16 @@ xfs_qm_qoffend_logitem_committed(
xfs_lsn_t lsn)
{
xfs_qoff_logitem_t *qfs;
struct xfs_ail *ailp;

qfs = qfe->qql_start_lip;
spin_lock(&qfs->qql_item.li_mountp->m_ail->xa_lock);
ailp = qfs->qql_item.li_ailp;
spin_lock(&ailp->xa_lock);
/*
* Delete the qoff-start logitem from the AIL.
* xfs_trans_delete_ail() drops the AIL lock.
* xfs_trans_ail_delete() drops the AIL lock.
*/
xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs);
xfs_trans_ail_delete(ailp, (xfs_log_item_t *)qfs);
kmem_free(qfs);
kmem_free(qfe);
return (xfs_lsn_t)-1;
Expand Down
24 changes: 9 additions & 15 deletions trunk/fs/xfs/xfs_buf_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ xfs_buf_item_unpin(
xfs_buf_log_item_t *bip,
int stale)
{
xfs_mount_t *mp;
struct xfs_ail *ailp;
xfs_buf_t *bp;
int freed;

Expand All @@ -387,7 +387,7 @@ xfs_buf_item_unpin(
xfs_buftrace("XFS_UNPIN", bp);

freed = atomic_dec_and_test(&bip->bli_refcount);
mp = bip->bli_item.li_mountp;
ailp = bip->bli_item.li_ailp;
xfs_bunpin(bp);
if (freed && stale) {
ASSERT(bip->bli_flags & XFS_BLI_STALE);
Expand All @@ -399,17 +399,17 @@ xfs_buf_item_unpin(
xfs_buftrace("XFS_UNPIN STALE", bp);
/*
* If we get called here because of an IO error, we may
* or may not have the item on the AIL. xfs_trans_delete_ail()
* or may not have the item on the AIL. xfs_trans_ail_delete()
* will take care of that situation.
* xfs_trans_delete_ail() drops the AIL lock.
* xfs_trans_ail_delete() drops the AIL lock.
*/
if (bip->bli_flags & XFS_BLI_STALE_INODE) {
xfs_buf_do_callbacks(bp, (xfs_log_item_t *)bip);
XFS_BUF_SET_FSPRIVATE(bp, NULL);
XFS_BUF_CLR_IODONE_FUNC(bp);
} else {
spin_lock(&mp->m_ail->xa_lock);
xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
spin_lock(&ailp->xa_lock);
xfs_trans_ail_delete(ailp, (xfs_log_item_t *)bip);
xfs_buf_item_relse(bp);
ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL);
}
Expand Down Expand Up @@ -1123,29 +1123,23 @@ xfs_buf_iodone(
xfs_buf_t *bp,
xfs_buf_log_item_t *bip)
{
struct xfs_mount *mp;
struct xfs_ail *ailp;
struct xfs_ail *ailp = bip->bli_item.li_ailp;

ASSERT(bip->bli_buf == bp);

xfs_buf_rele(bp);
mp = bip->bli_item.li_mountp;
ailp = bip->bli_item.li_ailp;

/*
* If we are forcibly shutting down, this may well be
* off the AIL already. That's because we simulate the
* log-committed callbacks to unpin these buffers. Or we may never
* have put this item on AIL because of the transaction was
* aborted forcibly. xfs_trans_delete_ail() takes care of these.
* aborted forcibly. xfs_trans_ail_delete() takes care of these.
*
* Either way, AIL is useless if we're forcing a shutdown.
*/
spin_lock(&ailp->xa_lock);
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
xfs_trans_ail_delete(ailp, (xfs_log_item_t *)bip);
xfs_buf_item_free(bip);
}

Expand Down
35 changes: 10 additions & 25 deletions trunk/fs/xfs/xfs_extfree_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,12 @@ xfs_efi_item_pin(xfs_efi_log_item_t *efip)
STATIC void
xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
{
xfs_mount_t *mp;
struct xfs_ail *ailp;
struct xfs_ail *ailp = efip->efi_item.li_ailp;

mp = efip->efi_item.li_mountp;
ailp = efip->efi_item.li_ailp;
spin_lock(&ailp->xa_lock);
if (efip->efi_flags & XFS_EFI_CANCELED) {
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
/* xfs_trans_ail_delete() drops the AIL lock. */
xfs_trans_ail_delete(ailp, (xfs_log_item_t *)efip);
xfs_efi_item_free(efip);
} else {
efip->efi_flags |= XFS_EFI_COMMITTED;
Expand All @@ -136,24 +131,19 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
STATIC void
xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
{
xfs_mount_t *mp;
struct xfs_ail *ailp;
struct xfs_ail *ailp = efip->efi_item.li_ailp;
xfs_log_item_desc_t *lidp;

mp = efip->efi_item.li_mountp;
ailp = efip->efi_item.li_ailp;
spin_lock(&ailp->xa_lock);
if (efip->efi_flags & XFS_EFI_CANCELED) {
/*
* free the xaction descriptor pointing to this item
*/
lidp = xfs_trans_find_item(tp, (xfs_log_item_t *) efip);
xfs_trans_free_item(tp, lidp);
/*
* pull the item off the AIL.
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);

/* xfs_trans_ail_delete() drops the AIL lock. */
xfs_trans_ail_delete(ailp, (xfs_log_item_t *)efip);
xfs_efi_item_free(efip);
} else {
efip->efi_flags |= XFS_EFI_COMMITTED;
Expand Down Expand Up @@ -350,12 +340,9 @@ void
xfs_efi_release(xfs_efi_log_item_t *efip,
uint nextents)
{
xfs_mount_t *mp;
struct xfs_ail *ailp;
struct xfs_ail *ailp = efip->efi_item.li_ailp;
int extents_left;

mp = efip->efi_item.li_mountp;
ailp = efip->efi_item.li_ailp;
ASSERT(efip->efi_next_extent > 0);
ASSERT(efip->efi_flags & XFS_EFI_COMMITTED);

Expand All @@ -364,10 +351,8 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
efip->efi_next_extent -= nextents;
extents_left = efip->efi_next_extent;
if (extents_left == 0) {
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
/* xfs_trans_ail_delete() drops the AIL lock. */
xfs_trans_ail_delete(ailp, (xfs_log_item_t *)efip);
xfs_efi_item_free(efip);
} else {
spin_unlock(&ailp->xa_lock);
Expand Down
4 changes: 3 additions & 1 deletion trunk/fs/xfs/xfs_iget.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#include "xfs_ialloc.h"
#include "xfs_quota.h"
#include "xfs_utils.h"
#include "xfs_trans_priv.h"
#include "xfs_inode_item.h"

/*
* Check the validity of the inode we just found it the cache
Expand Down Expand Up @@ -616,7 +618,7 @@ xfs_iunlock(
* it is in the AIL and anyone is waiting on it. Don't do
* this if the caller has asked us not to.
*/
xfs_trans_unlocked_item(ip->i_mount,
xfs_trans_unlocked_item(ip->i_itemp->ili_item.li_ailp,
(xfs_log_item_t*)(ip->i_itemp));
}
xfs_ilock_trace(ip, 3, lock_flags, (inst_t *)__return_address);
Expand Down
8 changes: 4 additions & 4 deletions trunk/fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2709,17 +2709,17 @@ xfs_idestroy(
* inode still in the AIL. If it is there, we should remove
* it to prevent a use-after-free from occurring.
*/
xfs_mount_t *mp = ip->i_mount;
xfs_log_item_t *lip = &ip->i_itemp->ili_item;
struct xfs_ail *ailp = lip->li_ailp;

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->xa_lock);
spin_lock(&ailp->xa_lock);
if (lip->li_flags & XFS_LI_IN_AIL)
xfs_trans_delete_ail(mp, lip);
xfs_trans_ail_delete(ailp, lip);
else
spin_unlock(&mp->m_ail->xa_lock);
spin_unlock(&ailp->xa_lock);
}
xfs_inode_item_destroy(ip);
ip->i_itemp = NULL;
Expand Down
29 changes: 12 additions & 17 deletions trunk/fs/xfs/xfs_inode_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,8 @@ xfs_iflush_done(
xfs_buf_t *bp,
xfs_inode_log_item_t *iip)
{
xfs_inode_t *ip;

ip = iip->ili_inode;
xfs_inode_t *ip = iip->ili_inode;
struct xfs_ail *ailp = iip->ili_item.li_ailp;

/*
* We only want to pull the item from the AIL if it is
Expand All @@ -992,15 +991,12 @@ xfs_iflush_done(
*/
if (iip->ili_logged &&
(iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
spin_lock(&ip->i_mount->m_ail->xa_lock);
spin_lock(&ailp->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);
/* xfs_trans_ail_delete() drops the AIL lock. */
xfs_trans_ail_delete(ailp, (xfs_log_item_t*)iip);
} else {
spin_unlock(&ip->i_mount->m_ail->xa_lock);
spin_unlock(&ailp->xa_lock);
}
}

Expand Down Expand Up @@ -1032,21 +1028,20 @@ void
xfs_iflush_abort(
xfs_inode_t *ip)
{
xfs_inode_log_item_t *iip;
xfs_inode_log_item_t *iip = ip->i_itemp;
xfs_mount_t *mp;

iip = ip->i_itemp;
mp = ip->i_mount;
if (iip) {
struct xfs_ail *ailp = iip->ili_item.li_ailp;
if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
spin_lock(&mp->m_ail->xa_lock);
spin_lock(&ailp->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);
/* xfs_trans_ail_delete() drops the AIL lock. */
xfs_trans_ail_delete(ailp, (xfs_log_item_t *)iip);
} else
spin_unlock(&mp->m_ail->xa_lock);
spin_unlock(&ailp->xa_lock);
}
iip->ili_logged = 0;
/*
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/xfs/xfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ xlog_grant_push_ail(xfs_mount_t *mp,
*/
if (threshold_lsn &&
!XLOG_FORCED_SHUTDOWN(log))
xfs_trans_push_ail(mp, threshold_lsn);
xfs_trans_ail_push(log->l_ailp, threshold_lsn);
} /* xlog_grant_push_ail */


Expand Down
13 changes: 5 additions & 8 deletions trunk/fs/xfs/xfs_log_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -2683,9 +2683,9 @@ xlog_recover_do_efi_trans(

spin_lock(&log->l_ailp->xa_lock);
/*
* xfs_trans_update_ail() drops the AIL lock.
* xfs_trans_ail_update() drops the AIL lock.
*/
xfs_trans_update_ail(mp, (xfs_log_item_t *)efip, lsn);
xfs_trans_ail_update(log->l_ailp, (xfs_log_item_t *)efip, lsn);
return 0;
}

Expand All @@ -2704,13 +2704,12 @@ xlog_recover_do_efd_trans(
xlog_recover_item_t *item,
int pass)
{
xfs_mount_t *mp;
xfs_efd_log_format_t *efd_formatp;
xfs_efi_log_item_t *efip = NULL;
xfs_log_item_t *lip;
__uint64_t efi_id;
struct xfs_ail_cursor cur;
struct xfs_ail *ailp;
struct xfs_ail *ailp = log->l_ailp;

if (pass == XLOG_RECOVER_PASS1) {
return;
Expand All @@ -2727,19 +2726,17 @@ xlog_recover_do_efd_trans(
* Search for the efi with the id in the efd format structure
* in the AIL.
*/
mp = log->l_mp;
ailp = log->l_ailp;
spin_lock(&ailp->xa_lock);
lip = xfs_trans_ail_cursor_first(ailp, &cur, 0);
while (lip != NULL) {
if (lip->li_type == XFS_LI_EFI) {
efip = (xfs_efi_log_item_t *)lip;
if (efip->efi_format.efi_id == efi_id) {
/*
* xfs_trans_delete_ail() drops the
* xfs_trans_ail_delete() drops the
* AIL lock.
*/
xfs_trans_delete_ail(mp, lip);
xfs_trans_ail_delete(ailp, lip);
xfs_efi_item_free(efip);
spin_lock(&ailp->xa_lock);
break;
Expand Down
6 changes: 2 additions & 4 deletions trunk/fs/xfs/xfs_trans.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,6 @@ xfs_trans_chunk_committed(

lidp = licp->lic_descs;
for (i = 0; i < licp->lic_unused; i++, lidp++) {
struct xfs_mount *mp;
struct xfs_ail *ailp;

if (xfs_lic_isfree(licp, i)) {
Expand Down Expand Up @@ -1426,7 +1425,6 @@ xfs_trans_chunk_committed(
* This would cause the earlier transaction to fail
* the test below.
*/
mp = lip->li_mountp;
ailp = lip->li_ailp;
spin_lock(&ailp->xa_lock);
if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) {
Expand All @@ -1435,9 +1433,9 @@ xfs_trans_chunk_committed(
* and update the position of the item in
* the AIL.
*
* xfs_trans_update_ail() drops the AIL lock.
* xfs_trans_ail_update() drops the AIL lock.
*/
xfs_trans_update_ail(mp, lip, item_lsn);
xfs_trans_ail_update(ailp, lip, item_lsn);
} else {
spin_unlock(&ailp->xa_lock);
}
Expand Down
Loading

0 comments on commit e36f41c

Please sign in to comment.