/* We do this by first locating the chunk in which the descriptor resides, and then scanning forward in the chunk and the list for the next used descriptor.  */
xfs_log_item_desc_t* xfs_trans_next_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp)
/* We do this by first locating the chunk in which the descriptor resides, and then scanning forward in the chunk and the list for the next used descriptor.  */
xfs_log_item_desc_t* xfs_trans_next_item(xfs_trans_t *tp, xfs_log_item_desc_t *lidp)
{
	xfs_log_item_chunk_t	*licp;
	int			i;
	licp = xfs_lic_desc_to_chunk(lidp);
	for (i = (int)xfs_lic_desc_to_slot(lidp) + 1; i < licp->lic_unused; i++) {
		if (xfs_lic_isfree(licp, i)) {
			continue;
		}
		return xfs_lic_slot(licp, i);
	}
	if (licp->lic_next == NULL) {
		return NULL;
	}
	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);
	}
	ASSERT(0);
	return NULL;
}