Re: [PATCH 4/5] xfs: convert AIL cursors to use struct list_head

Christoph Hellwig
2011-07-04T08:43:18Z

On Mon, Jul 04, 2011 at 03:27:39PM +1000, Dave Chinner wrote:
> /*
> * AIL traversal cursor initialisation.
> *
> + * The cursor keeps track of where our current traversal is up to by tracking
> + * the next ??tem in the list for us. However, for this to be safe, removing an
^^
Non-ASCSI character.

> + * object from the AIL needs to invalidate any cursor that points to it. hence
> + * the traversal cursor needs to be linked to the struct xfs_ail so that
> + * deletion can search all the active cursors for invalidation.
> */
> STATIC void
> xfs_trans_ail_cursor_init(
> @@ -181,17 +177,13 @@ xfs_trans_ail_cursor_init(
> struct xfs_ail_cursor *cur)
> {
> cur->item = NULL;
> - if (cur == &ailp->xa_cursors)
> - return;
> -
> - cur->next = ailp->xa_cursors.next;
> - ailp->xa_cursors.next = cur;
> + INIT_LIST_HEAD(&cur->list);
> + list_add_tail(&cur->list, &ailp->xa_cursors);
> }

There is no need to initialize a list_head before adding it to a list.

Otherwise looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>