/* We need the AIL lock in order to get a coherent read of the lsn of the last item in the AIL.  */
xfs_lsn_t xfs_trans_ail_tail(struct xfs_ail *ailp)
/* We need the AIL lock in order to get a coherent read of the lsn of the last item in the AIL.  */
xfs_lsn_t xfs_trans_ail_tail(struct xfs_ail *ailp)
{
	xfs_lsn_t	lsn;
	xfs_log_item_t	*lip;
	spin_lock(&ailp->xa_lock);
	lip = xfs_ail_min(ailp);
	if (lip == NULL) {
		lsn = (xfs_lsn_t)0;
	} else {
		lsn = lip->li_lsn;
	}
	spin_unlock(&ailp->xa_lock);
	return lsn;
}