From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 8/8] xfs: use AIL bulk delete function to implement single delete
Date: Mon, 29 Nov 2010 12:12:32 +1100 [thread overview]
Message-ID: <1290993152-20999-9-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1290993152-20999-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
We now have two copies of AIL delete operations that are mostly
duplicate functionality. The single log item deletes can be
implemented via the bulk updates by turning xfs_trans_ail_delete()
into a simple wrapper. This removes all the duplicate delete
functionality and associated helpers.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/xfs_trans_ail.c | 70 +++-------------------------------------------
fs/xfs/xfs_trans_priv.h | 20 +++++++++-----
2 files changed, 18 insertions(+), 72 deletions(-)
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 2f44f92..91aaf7b 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -520,80 +520,21 @@ xfs_trans_ail_update_bulk(
}
/*
- * Delete the given item from the AIL. It must already be in
- * the AIL.
- *
- * Wakeup anyone with an lsn less than item's lsn. If the item
- * we delete in the AIL is the minimum one, update the tail lsn in the
- * log manager.
- *
- * Clear the IN_AIL flag from the item, reset its lsn to 0, and
- * bump the AIL's generation count to indicate that the tree
- * has changed.
- *
- * This function must be called with the AIL lock held. The lock
- * is dropped before returning.
- */
-void
-xfs_trans_ail_delete(
- struct xfs_ail *ailp,
- xfs_log_item_t *lip) __releases(ailp->xa_lock)
-{
- xfs_log_item_t *mlip;
- xfs_lsn_t tail_lsn;
-
- if (lip->li_flags & XFS_LI_IN_AIL) {
- mlip = xfs_ail_min(ailp);
- xfs_ail_delete(ailp, lip);
-
-
- lip->li_flags &= ~XFS_LI_IN_AIL;
- lip->li_lsn = 0;
-
- if (mlip == lip) {
- mlip = xfs_ail_min(ailp);
- /*
- * It is not safe to access mlip after the AIL lock
- * is dropped, so we must get a copy of li_lsn
- * before we do so. This is especially important
- * on 32-bit platforms where accessing and updating
- * 64-bit values like li_lsn is not atomic.
- */
- tail_lsn = mlip ? mlip->li_lsn : 0;
- spin_unlock(&ailp->xa_lock);
- xfs_log_move_tail(ailp->xa_mount, tail_lsn);
- } else {
- spin_unlock(&ailp->xa_lock);
- }
- }
- else {
- /*
- * If the file system is not being shutdown, we are in
- * serious trouble if we get to this stage.
- */
- struct xfs_mount *mp = ailp->xa_mount;
-
- spin_unlock(&ailp->xa_lock);
- if (!XFS_FORCED_SHUTDOWN(mp)) {
- xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp,
- "%s: attempting to delete a log item that is not in the AIL",
- __func__);
- xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
- }
- }
-}
-
-/*
* Bulk update version of xfs_trans_ail_delete
*
* This version takes an array of log items that all need to removed from the
* AIL. The caller is already holding the AIL lock, and done all the checks
* necessary to ensure the items passed in via @lgia are ready for deletion.
+ * If an item we delete in the AIL is the minimum one, update the tail lsn in
+ * the log manager.
*
* This function will not drop the AIL lock until all items are removed from
* the AIL to minimise the amount of lock traffic on the AIL. This does not
* greatly increase the AIL hold time, but does significantly reduce the amount
* of traffic on the lock, especially during IO completion.
+ *
+ * This function must be called with the AIL lock held. The lock is dropped
+ * before returning.
*/
void
xfs_trans_ail_delete_bulk(
@@ -648,7 +589,6 @@ xfs_trans_ail_delete_bulk(
xfs_log_move_tail(ailp->xa_mount, tail_lsn);
}
-
/*
* The active item list (AIL) is a doubly linked list of log
* items sorted by ascending lsn. The base of the list is
diff --git a/fs/xfs/xfs_trans_priv.h b/fs/xfs/xfs_trans_priv.h
index 1cf42e7..2bd3c19 100644
--- a/fs/xfs/xfs_trans_priv.h
+++ b/fs/xfs/xfs_trans_priv.h
@@ -89,13 +89,19 @@ xfs_trans_ail_update(
xfs_trans_ail_update_bulk(ailp, lgia, 1, lsn);
}
-void xfs_trans_ail_delete(struct xfs_ail *ailp,
- struct xfs_log_item *lip)
- __releases(ailp->xa_lock);
-void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp,
- struct xfs_log_item **lgia,
- int nr_items)
- __releases(ailp->xa_lock);
+void xfs_trans_ail_delete_bulk(struct xfs_ail *ailp,
+ struct xfs_log_item **lgia, int nr_items)
+ __releases(ailp->xa_lock);
+static inline void
+xfs_trans_ail_delete(
+ struct xfs_ail *ailp,
+ xfs_log_item_t *lip) __releases(ailp->xa_lock)
+{
+ struct xfs_log_item *lgia[1] = { lip, };
+
+ xfs_trans_ail_delete_bulk(ailp, lgia, 1);
+}
+
void xfs_trans_ail_push(struct xfs_ail *, xfs_lsn_t);
void xfs_trans_unlocked_item(struct xfs_ail *,
xfs_log_item_t *);
--
1.7.2.3
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-11-29 1:11 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 1:12 [PATCH 0/8] xfs: AIL lock contention reduction V2 Dave Chinner
2010-11-29 1:12 ` [PATCH 1/8] xfs: Pull EFI/EFD handling out from under the AIL lock Dave Chinner
2010-11-30 20:17 ` Christoph Hellwig
2010-12-02 1:28 ` Dave Chinner
2010-12-02 11:38 ` Christoph Hellwig
2010-12-03 5:24 ` Dave Chinner
2010-11-29 1:12 ` [PATCH 2/8] xfs: clean up xfs_ail_delete() Dave Chinner
2010-11-30 20:19 ` Christoph Hellwig
2010-11-29 1:12 ` [PATCH 3/8] xfs: bulk AIL insertion during transaction commit Dave Chinner
2010-11-30 22:40 ` Christoph Hellwig
2010-12-02 1:32 ` Dave Chinner
2010-11-29 1:12 ` [PATCH 4/8] xfs: reduce the number of AIL push wakeups Dave Chinner
2010-11-30 20:19 ` Christoph Hellwig
2010-11-29 1:12 ` [PATCH 5/8] xfs: consume iodone callback items on buffers as they are processed Dave Chinner
2010-11-30 20:24 ` Christoph Hellwig
2010-11-29 1:12 ` [PATCH 6/8] xfs: remove all the inodes on a buffer from the AIL in bulk Dave Chinner
2010-12-06 14:33 ` Christoph Hellwig
2010-12-07 3:44 ` Dave Chinner
2010-12-07 7:39 ` Christoph Hellwig
2010-11-29 1:12 ` Dave Chinner [this message]
2010-12-06 14:37 ` [PATCH 8/8] xfs: use AIL bulk delete function to implement single delete Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290993152-20999-9-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.