public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/5] xfs: use a cursor for bulk AIL insertion
Date: Mon, 4 Jul 2011 17:20:56 -0400	[thread overview]
Message-ID: <20110704212055.GA24500@infradead.org> (raw)
In-Reply-To: <1309757260-5484-3-git-send-email-david@fromorbit.com>

FYI: the following patch implementing my suggested cleanups survived a
few rounds of xfsqa:


Index: xfs/fs/xfs/xfs_trans_ail.c
===================================================================
--- xfs.orig/fs/xfs/xfs_trans_ail.c	2011-07-04 16:04:08.932174424 +0200
+++ xfs/fs/xfs/xfs_trans_ail.c	2011-07-04 16:12:51.402677292 +0200
@@ -267,26 +267,14 @@ out:
 static struct xfs_log_item *
 __xfs_trans_ail_cursor_last(
 	struct xfs_ail		*ailp,
-	struct xfs_ail_cursor	*cur,
-	xfs_lsn_t		lsn,
-	bool			do_init)
+	xfs_lsn_t		lsn)
 {
-	xfs_log_item_t		*lip = NULL;
-
-	if (do_init)
-		xfs_trans_ail_cursor_init(ailp, cur);
+	struct xfs_log_item	*lip;
 
-	if (list_empty(&ailp->xa_ail)) 
-		goto out;
-
-	list_for_each_entry_reverse(lip, &ailp->xa_ail, li_ail) {
+	list_for_each_entry_reverse(lip, &ailp->xa_ail, li_ail)
 		if (XFS_LSN_CMP(lip->li_lsn, lsn) <= 0)
-			break;
-	}
-out:
-	if (cur)
-		cur->item = lip;
-	return lip;
+			return lip;
+	return NULL;
 }
 
 /*
@@ -300,7 +288,9 @@ xfs_trans_ail_cursor_last(
 	struct xfs_ail_cursor	*cur,
 	xfs_lsn_t		lsn)
 {
-	return __xfs_trans_ail_cursor_last(ailp, cur, lsn, true);
+	xfs_trans_ail_cursor_init(ailp, cur);
+	cur->item = __xfs_trans_ail_cursor_last(ailp, lsn);
+	return cur->item;
 }
 
 /*
@@ -319,27 +309,22 @@ xfs_ail_splice(
 	struct xfs_log_item	*lip = cur ? cur->item : NULL;
 	struct xfs_log_item	*next_lip;
 
-	do {
-		/* no placeholder, so get our insert location */
-		if (!lip)
-			lip = __xfs_trans_ail_cursor_last(ailp, cur,
-								lsn, false);
-
+	/*
+	 * Get a new cursor if we do not have a placeholder or an
+	 * invalidated one.
+	 */
+	if (!lip || (__psint_t)lip & 1) {
+		lip = __xfs_trans_ail_cursor_last(ailp, lsn);
 		if (!lip) {
 			/*
-			 * The list is empty, so just splice and return.  Our
-			 * cursor is already guaranteed to be up to date, so we
-			 * don't need to touch it here.
+			 * The list is empty, so just splice and return.
 			 */
+			if (cur)
+				cur->item = NULL;
 			list_splice(list, &ailp->xa_ail);
 			return;
 		}
-
-		/* The placeholder was invalidated, need to get a new cursor */
-		if ((__psint_t)lip & 1)
-			lip = NULL;
-
-	} while (lip == NULL);
+	}
 
 	/*
 	 * Our cursor points to the item we want to insert _after_, so we have

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2011-07-04 21:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04  5:27 [PATCH 0/5] xfs: fix AIL bulk insert issues and cleanups Dave Chinner
2011-07-04  5:27 ` [PATCH 1/5] xfs: unpin stale inodes directly in IOP_COMMITTED Dave Chinner
2011-07-04  8:13   ` Christoph Hellwig
2011-07-06 20:45   ` Alex Elder
2011-07-04  5:27 ` [PATCH 2/5] xfs: use a cursor for bulk AIL insertion Dave Chinner
2011-07-04  8:32   ` Christoph Hellwig
2011-07-04 11:16   ` Christoph Hellwig
2011-07-04 21:20   ` Christoph Hellwig [this message]
2011-07-07 21:26     ` Alex Elder
2011-07-08  1:04       ` Dave Chinner
2011-07-07 20:29   ` Alex Elder
2011-07-04  5:27 ` [PATCH 3/5] xfs: remove confusing ail cursor wrapper Dave Chinner
2011-07-04  8:16   ` Christoph Hellwig
2011-07-07 20:33   ` Alex Elder
2011-07-04  5:27 ` [PATCH 4/5] xfs: convert AIL cursors to use struct list_head Dave Chinner
2011-07-04  8:43   ` Christoph Hellwig
2011-07-07 21:15   ` Alex Elder
2011-07-08  1:54     ` Dave Chinner
2011-07-04  5:27 ` [PATCH 5/5] xfs: add size update tracepoint to IO completion Dave Chinner
2011-07-04  8:16   ` Christoph Hellwig
2011-07-07 21:18   ` Alex Elder
2011-07-04  8:13 ` [PATCH 0/5] xfs: fix AIL bulk insert issues and cleanups Christoph Hellwig
2011-07-04 11:26   ` Dave Chinner
     [not found] <20111014185048.893798829@bombadil.infradead.org>
2011-10-14 18:50 ` [PATCH 2/5] xfs: use a cursor for bulk AIL insertion 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=20110704212055.GA24500@infradead.org \
    --to=hch@infradead.org \
    --cc=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox