All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 3/5] xfs: remove confusing ail cursor wrapper
Date: Mon,  4 Jul 2011 15:27:38 +1000	[thread overview]
Message-ID: <1309757260-5484-4-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1309757260-5484-1-git-send-email-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

xfs_trans_ail_cursor_set() doesn't set the cursor to the current log
item, it sets it to the next item. There is already a function for
doing this - xfs_trans_ail_cursor_next() - and the _set function is
simply a two line wrapper.  Remove it and open code the setting of
the cursor in the two locations that call it to remove the
confusion.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_trans_ail.c |   38 ++++++++++++--------------------------
 1 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 272e7fa..de7a52a 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -189,20 +189,6 @@ xfs_trans_ail_cursor_init(
 }
 
 /*
- * Set the cursor to the next item, because when we look
- * up the cursor the current item may have been freed.
- */
-STATIC void
-xfs_trans_ail_cursor_set(
-	struct xfs_ail		*ailp,
-	struct xfs_ail_cursor	*cur,
-	struct xfs_log_item	*lip)
-{
-	if (lip)
-		cur->item = xfs_ail_next(ailp, lip);
-}
-
-/*
  * Get the next item in the traversal and advance the cursor.
  * If the cursor was invalidated (inidicated by a lip of 1),
  * restart the traversal.
@@ -216,7 +202,8 @@ xfs_trans_ail_cursor_next(
 
 	if ((__psint_t)lip & 1)
 		lip = xfs_ail_min(ailp);
-	xfs_trans_ail_cursor_set(ailp, cur, lip);
+	if (lip)
+		cur->item = xfs_ail_next(ailp, lip);
 	return lip;
 }
 
@@ -272,9 +259,10 @@ xfs_trans_ail_cursor_clear(
 }
 
 /*
- * Initialise the cursor to the first item in the AIL with the given @lsn.
- * This searches the list from lowest LSN to highest. Pass a @lsn of zero
- * to initialise the cursor to the first item in the AIL.
+ * Find the first item in the AIL with the given @lsn by searching in ascending
+ * LSN order and initialise the cursor to point to the next item for a
+ * ascending traversal.  Pass a @lsn of zero to initialise the cursor to the
+ * first item in the AIL. Returns NULL if the list is empty.
  */
 xfs_log_item_t *
 xfs_trans_ail_cursor_first(
@@ -295,14 +283,11 @@ xfs_trans_ail_cursor_first(
 	}
 	lip = NULL;
 out:
-	xfs_trans_ail_cursor_set(ailp, cur, lip);
+	if (lip)
+		cur->item = xfs_ail_next(ailp, lip);
 	return lip;
 }
 
-/*
- * Initialise the cursor to the last item in the AIL with the given @lsn.
- * This searches the list from highest LSN to lowest.
- */
 static struct xfs_log_item *
 __xfs_trans_ail_cursor_last(
 	struct xfs_ail		*ailp,
@@ -329,8 +314,9 @@ out:
 }
 
 /*
- * Initialise the cursor to the last item in the AIL with the given @lsn.
- * This searches the list from highest LSN to lowest.
+ * Find the last item in the AIL with the given @lsn by searching in descending
+ * LSN order and initialise the cursor to point to that item.  Returns NULL is
+ * the list is empty.
  */
 struct xfs_log_item *
 xfs_trans_ail_cursor_last(
@@ -342,7 +328,7 @@ xfs_trans_ail_cursor_last(
 }
 
 /*
- * splice the log item list into the AIL at the given LSN. We splice to the
+ * Splice the log item list into the AIL at the given LSN. We splice to the
  * tail of the given LSN to maintain insert order for push traversals. The
  * cursor is optional, allowing repeated updates to the same LSN to avoid
  * repeated traversals.
-- 
1.7.5.1

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

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

Thread overview: 23+ 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
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 ` Dave Chinner [this message]
2011-07-04  8:16   ` [PATCH 3/5] xfs: remove confusing ail cursor wrapper 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

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=1309757260-5484-4-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.