/* Return the item in the AIL with the current lsn. Return the current tree generation number for use in calls to xfs_trans_next_ail().  */
xfs_log_item_t* xfs_trans_ail_cursor_first(struct xfs_ail *ailp, struct xfs_ail_cursor *cur, xfs_lsn_t lsn)
/* Return the item in the AIL with the current lsn. Return the current tree generation number for use in calls to xfs_trans_next_ail().  */
xfs_log_item_t* xfs_trans_ail_cursor_first(struct xfs_ail *ailp, struct xfs_ail_cursor *cur, xfs_lsn_t lsn)
{
	xfs_log_item_t		*lip;
	xfs_trans_ail_cursor_init(ailp, cur);
	lip = xfs_ail_min(ailp);
	if (lsn == 0)
		goto out;
	list_for_each_entry(lip, &ailp->xa_ail, li_ail) {
		if (XFS_LSN_CMP(lip->li_lsn, lsn) >= 0)
			goto out;
	}
	lip = NULL;
out:
	xfs_trans_ail_cursor_set(ailp, cur, lip);
	return lip;
}