/* At some point this and xfs_trans_next_item() should be optimized to quickly look at the mask to determine if there is anything to look at.  */
xfs_log_item_desc_t* xfs_trans_first_item(xfs_trans_t *tp)
/* At some point this and xfs_trans_next_item() should be optimized to quickly look at the mask to determine if there is anything to look at.  */
xfs_log_item_desc_t* xfs_trans_first_item(xfs_trans_t *tp)
{
	xfs_log_item_chunk_t	*licp;
	int			i;
	licp = &tp->t_items;
	if (xfs_lic_are_all_free(licp)) {
		licp = licp->lic_next;
	}
	ASSERT(!xfs_lic_are_all_free(licp));
	for (i = 0; i < licp->lic_unused; i++) {
		if (xfs_lic_isfree(licp, i)) {
			continue;
		}
		return xfs_lic_slot(licp, i);
	}
	cmn_err(CE_WARN, "xfs_trans_first_item() -- no first item");
	return NULL;
}