Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 783a2f65 authored by David Chinner's avatar David Chinner Committed by Lachlan McIlroy
Browse files

[XFS] Finish removing the mount pointer from the AIL API



Change all the remaining AIL API functions that are passed struct
xfs_mount pointers to pass pointers directly to the struct xfs_ail being
used. With this conversion, all external access to the AIL is via the
struct xfs_ail. Hence the operation and referencing of the AIL is almost
entirely independent of the xfs_mount that is using it - it is now much
more tightly tied to the log and the items it is tracking in the log than
it is tied to the xfs_mount.

SGI-PV: 988143

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

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 fc1829f3
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -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
@@ -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);
	}

	/*
@@ -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));
	}
}
+5 −3
Original line number Diff line number Diff line
@@ -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;
+9 −15
Original line number Diff line number Diff line
@@ -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;

@@ -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);
@@ -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);
		}
@@ -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);
}

+10 −25
Original line number Diff line number Diff line
@@ -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;
@@ -136,12 +131,9 @@ 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) {
		/*
@@ -149,11 +141,9 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
		 */
		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;
@@ -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);

@@ -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);
+3 −1
Original line number Diff line number Diff line
@@ -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
@@ -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);
Loading