/* Count the number of in-use tags in a journal descriptor block.  */
static int count_tags(struct buffer_head *bh, int size)
/* Count the number of in-use tags in a journal descriptor block.  */
static int count_tags(struct buffer_head *bh, int size)
{
	char *			tagp;
	journal_block_tag_t *	tag;
	int			nr = 0;
	tagp = &bh->b_data[sizeof(journal_header_t)];
	while ((tagp - bh->b_data + sizeof(journal_block_tag_t)) <= size) {
		tag = (journal_block_tag_t *) tagp;
		nr++;
		tagp += sizeof(journal_block_tag_t);
		if (!(tag->t_flags & cpu_to_be32(JFS_FLAG_SAME_UUID)))
			tagp += 16;
		if (tag->t_flags & cpu_to_be32(JFS_FLAG_LAST_TAG))
			break;
	}
	return nr;
}