[PATCH 2/5] xfs: use a cursor for bulk AIL insertion

Christoph Hellwig hch at infradead.org
Mon Jul 4 03:32:06 CDT 2011


>  /*
> + * 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,
> +	struct xfs_ail_cursor	*cur,
> +	xfs_lsn_t		lsn,
> +	bool			do_init)
>  {
> +	xfs_log_item_t		*lip = NULL;
>  
> +	if (do_init)
> +		xfs_trans_ail_cursor_init(ailp, cur);
> +
> +	if (list_empty(&ailp->xa_ail)) 
> +		goto out;
>  
> +	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;
> +}

Please just move the xfs_trans_ail_cursor_init call to
xfs_trans_ail_cursor_init instead of adding the do_init parameter.
Also the list_empty check is not needed due to the list_for_each*
macros handling that case just fine.

I haven't looked at the details of the new xfs_ail_splice code yet, so
more updates later.




More information about the xfs mailing list