Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84439
b: refs/heads/master
c: 287f3da
h: refs/heads/master
i:
  84437: 4552fac
  84435: 988789b
  84431: 37ba56f
v: v3
  • Loading branch information
Donald Douwsma authored and Lachlan McIlroy committed Feb 7, 2008
1 parent ca5d742 commit 6289892
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 115 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: 541d7d3c4b31e2b0ac846fe6d2eb5cdbe1353095
refs/heads/master: 287f3dad14828275d2517c8696ad118c82b9243f
12 changes: 5 additions & 7 deletions trunk/fs/xfs/quota/xfs_dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,6 @@ xfs_qm_dqflush(
xfs_buf_t *bp;
xfs_disk_dquot_t *ddqp;
int error;
SPLDECL(s);

ASSERT(XFS_DQ_IS_LOCKED(dqp));
ASSERT(XFS_DQ_IS_FLUSH_LOCKED(dqp));
Expand Down Expand Up @@ -1270,9 +1269,9 @@ xfs_qm_dqflush(
mp = dqp->q_mount;

/* lsn is 64 bits */
AIL_LOCK(mp, s);
spin_lock(&mp->m_ail_lock);
dqp->q_logitem.qli_flush_lsn = dqp->q_logitem.qli_item.li_lsn;
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);

/*
* Attach an iodone routine so that we can remove this dquot from the
Expand Down Expand Up @@ -1318,7 +1317,6 @@ xfs_qm_dqflush_done(
xfs_dq_logitem_t *qip)
{
xfs_dquot_t *dqp;
SPLDECL(s);

dqp = qip->qli_dquot;

Expand All @@ -1333,15 +1331,15 @@ xfs_qm_dqflush_done(
if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
qip->qli_item.li_lsn == qip->qli_flush_lsn) {

AIL_LOCK(dqp->q_mount, s);
spin_lock(&dqp->q_mount->m_ail_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, s);
(xfs_log_item_t*)qip);
else
AIL_UNLOCK(dqp->q_mount, s);
spin_unlock(&dqp->q_mount->m_ail_lock);
}

/*
Expand Down
11 changes: 5 additions & 6 deletions trunk/fs/xfs/quota/xfs_dquot_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ xfs_qm_dqunpin_wait(
* If so, we want to push it out to help us take this item off the AIL as soon
* as possible.
*
* We must not be holding the AIL_LOCK at this point. Calling incore() to
* search the buffer cache can be a time consuming thing, and AIL_LOCK is a
* We must not be holding the AIL lock at this point. Calling incore() to
* search the buffer cache can be a time consuming thing, and AIL lock is a
* spinlock.
*/
STATIC void
Expand Down Expand Up @@ -322,7 +322,7 @@ xfs_qm_dquot_logitem_trylock(
* want to do that now since we might sleep in the device
* strategy routine. We also don't want to grab the buffer lock
* here because we'd like not to call into the buffer cache
* while holding the AIL_LOCK.
* while holding the AIL lock.
* Make sure to only return PUSHBUF if we set pushbuf_flag
* ourselves. If someone else is doing it then we don't
* want to go to the push routine and duplicate their efforts.
Expand Down Expand Up @@ -562,15 +562,14 @@ xfs_qm_qoffend_logitem_committed(
xfs_lsn_t lsn)
{
xfs_qoff_logitem_t *qfs;
SPLDECL(s);

qfs = qfe->qql_start_lip;
AIL_LOCK(qfs->qql_item.li_mountp,s);
spin_lock(&qfs->qql_item.li_mountp->m_ail_lock);
/*
* Delete the qoff-start logitem from the AIL.
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs, s);
xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs);
kmem_free(qfs, sizeof(xfs_qoff_logitem_t));
kmem_free(qfe, sizeof(xfs_qoff_logitem_t));
return (xfs_lsn_t)-1;
Expand Down
10 changes: 4 additions & 6 deletions trunk/fs/xfs/xfs_buf_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,6 @@ xfs_buf_item_unpin(
xfs_mount_t *mp;
xfs_buf_t *bp;
int freed;
SPLDECL(s);

bp = bip->bli_buf;
ASSERT(bp != NULL);
Expand Down Expand Up @@ -409,8 +408,8 @@ xfs_buf_item_unpin(
XFS_BUF_SET_FSPRIVATE(bp, NULL);
XFS_BUF_CLR_IODONE_FUNC(bp);
} else {
AIL_LOCK(mp,s);
xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip, s);
spin_lock(&mp->m_ail_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 @@ -1113,7 +1112,6 @@ xfs_buf_iodone(
xfs_buf_log_item_t *bip)
{
struct xfs_mount *mp;
SPLDECL(s);

ASSERT(bip->bli_buf == bp);

Expand All @@ -1128,11 +1126,11 @@ xfs_buf_iodone(
*
* Either way, AIL is useless if we're forcing a shutdown.
*/
AIL_LOCK(mp,s);
spin_lock(&mp->m_ail_lock);
/*
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip, s);
xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);

#ifdef XFS_TRANS_DEBUG
kmem_free(bip->bli_orig, XFS_BUF_COUNT(bp));
Expand Down
21 changes: 9 additions & 12 deletions trunk/fs/xfs/xfs_extfree_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,18 @@ STATIC void
xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
{
xfs_mount_t *mp;
SPLDECL(s);

mp = efip->efi_item.li_mountp;
AIL_LOCK(mp, s);
spin_lock(&mp->m_ail_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, s);
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
xfs_efi_item_free(efip);
} else {
efip->efi_flags |= XFS_EFI_COMMITTED;
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);
}
}

Expand All @@ -138,10 +137,9 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
{
xfs_mount_t *mp;
xfs_log_item_desc_t *lidp;
SPLDECL(s);

mp = efip->efi_item.li_mountp;
AIL_LOCK(mp, s);
spin_lock(&mp->m_ail_lock);
if (efip->efi_flags & XFS_EFI_CANCELED) {
/*
* free the xaction descriptor pointing to this item
Expand All @@ -152,11 +150,11 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
* pull the item off the AIL.
* xfs_trans_delete_ail() drops the AIL lock.
*/
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
xfs_efi_item_free(efip);
} else {
efip->efi_flags |= XFS_EFI_COMMITTED;
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);
}
}

Expand Down Expand Up @@ -350,24 +348,23 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
{
xfs_mount_t *mp;
int extents_left;
SPLDECL(s);

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

AIL_LOCK(mp, s);
spin_lock(&mp->m_ail_lock);
ASSERT(efip->efi_next_extent >= nextents);
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, s);
xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
xfs_efi_item_free(efip);
} else {
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);
}
}

Expand Down
22 changes: 9 additions & 13 deletions trunk/fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,6 @@ xfs_ifree_cluster(
xfs_inode_log_item_t *iip;
xfs_log_item_t *lip;
xfs_perag_t *pag = xfs_get_perag(mp, inum);
SPLDECL(s);

if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) {
blks_per_cluster = 1;
Expand Down Expand Up @@ -2307,9 +2306,9 @@ xfs_ifree_cluster(
iip = (xfs_inode_log_item_t *)lip;
ASSERT(iip->ili_logged == 1);
lip->li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) xfs_istale_done;
AIL_LOCK(mp,s);
spin_lock(&mp->m_ail_lock);
iip->ili_flush_lsn = iip->ili_item.li_lsn;
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);
xfs_iflags_set(iip->ili_inode, XFS_ISTALE);
pre_flushed++;
}
Expand All @@ -2330,9 +2329,9 @@ xfs_ifree_cluster(
iip->ili_last_fields = iip->ili_format.ilf_fields;
iip->ili_format.ilf_fields = 0;
iip->ili_logged = 1;
AIL_LOCK(mp,s);
spin_lock(&mp->m_ail_lock);
iip->ili_flush_lsn = iip->ili_item.li_lsn;
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);

xfs_buf_attach_iodone(bp,
(void(*)(xfs_buf_t*,xfs_log_item_t*))
Expand Down Expand Up @@ -2731,7 +2730,6 @@ void
xfs_idestroy(
xfs_inode_t *ip)
{

switch (ip->i_d.di_mode & S_IFMT) {
case S_IFREG:
case S_IFDIR:
Expand Down Expand Up @@ -2771,16 +2769,15 @@ xfs_idestroy(
*/
xfs_mount_t *mp = ip->i_mount;
xfs_log_item_t *lip = &ip->i_itemp->ili_item;
int s;

ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) ||
XFS_FORCED_SHUTDOWN(ip->i_mount));
if (lip->li_flags & XFS_LI_IN_AIL) {
AIL_LOCK(mp, s);
spin_lock(&mp->m_ail_lock);
if (lip->li_flags & XFS_LI_IN_AIL)
xfs_trans_delete_ail(mp, lip, s);
xfs_trans_delete_ail(mp, lip);
else
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);
}
xfs_inode_item_destroy(ip);
}
Expand Down Expand Up @@ -3334,7 +3331,6 @@ xfs_iflush_int(
#ifdef XFS_TRANS_DEBUG
int first;
#endif
SPLDECL(s);

ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE|MR_ACCESS));
ASSERT(issemalocked(&(ip->i_flock)));
Expand Down Expand Up @@ -3529,9 +3525,9 @@ xfs_iflush_int(
iip->ili_logged = 1;

ASSERT(sizeof(xfs_lsn_t) == 8); /* don't lock if it shrinks */
AIL_LOCK(mp,s);
spin_lock(&mp->m_ail_lock);
iip->ili_flush_lsn = iip->ili_item.li_lsn;
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);

/*
* Attach the function xfs_iflush_done to the inode's
Expand Down
21 changes: 9 additions & 12 deletions trunk/fs/xfs/xfs_inode_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ xfs_inode_item_trylock(
return XFS_ITEM_PUSHBUF;
} else {
/*
* We hold the AIL_LOCK, so we must specify the
* We hold the AIL lock, so we must specify the
* NONOTIFY flag so that we won't double trip.
*/
xfs_iunlock(ip, XFS_ILOCK_SHARED|XFS_IUNLOCK_NONOTIFY);
Expand Down Expand Up @@ -749,7 +749,7 @@ xfs_inode_item_committed(
* marked delayed write. If that's the case, we'll initiate a bawrite on that
* buffer to expedite the process.
*
* We aren't holding the AIL_LOCK (or the flush lock) when this gets called,
* We aren't holding the AIL lock (or the flush lock) when this gets called,
* so it is inherently race-y.
*/
STATIC void
Expand Down Expand Up @@ -792,7 +792,7 @@ xfs_inode_item_pushbuf(
if (XFS_BUF_ISDELAYWRITE(bp)) {
/*
* We were racing with iflush because we don't hold
* the AIL_LOCK or the flush lock. However, at this point,
* the AIL lock or the flush lock. However, at this point,
* we have the buffer, and we know that it's dirty.
* So, it's possible that iflush raced with us, and
* this item is already taken off the AIL.
Expand Down Expand Up @@ -968,7 +968,6 @@ xfs_iflush_done(
xfs_inode_log_item_t *iip)
{
xfs_inode_t *ip;
SPLDECL(s);

ip = iip->ili_inode;

Expand All @@ -983,15 +982,15 @@ xfs_iflush_done(
*/
if (iip->ili_logged &&
(iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
AIL_LOCK(ip->i_mount, s);
spin_lock(&ip->i_mount->m_ail_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, s);
(xfs_log_item_t*)iip);
} else {
AIL_UNLOCK(ip->i_mount, s);
spin_unlock(&ip->i_mount->m_ail_lock);
}
}

Expand Down Expand Up @@ -1025,21 +1024,19 @@ xfs_iflush_abort(
{
xfs_inode_log_item_t *iip;
xfs_mount_t *mp;
SPLDECL(s);

iip = ip->i_itemp;
mp = ip->i_mount;
if (iip) {
if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
AIL_LOCK(mp, s);
spin_lock(&mp->m_ail_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,
s);
xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip);
} else
AIL_UNLOCK(mp, s);
spin_unlock(&mp->m_ail_lock);
}
iip->ili_logged = 0;
/*
Expand Down
Loading

0 comments on commit 6289892

Please sign in to comment.