/* return the total number of blocks to be allocate, including the direct and indirect blocks.  */
static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks, int blocks_to_boundary)
/* return the total number of blocks to be allocate, including the direct and indirect blocks.  */
static int ext3_blks_to_allocate(Indirect *branch, int k, unsigned long blks, int blocks_to_boundary)
{
	unsigned long count = 0;
	if (k > 0) {
		if (blks < blocks_to_boundary + 1)
			count += blks;
		else
			count += blocks_to_boundary + 1;
		return count;
	}
	count++;
	while (count < blks && count <= blocks_to_boundary &&
		le32_to_cpu(*(branch[0].p + count)) == 0) {
		count++;
	}
	return count;
}