/* This function calculates and returns the number of LEBs which should be kept for index usage.  */
int ubifs_calc_min_idx_lebs(struct ubifs_info *c)
/* This function calculates and returns the number of LEBs which should be kept for index usage.  */
int ubifs_calc_min_idx_lebs(struct ubifs_info *c)
{
	int idx_lebs;
	long long idx_size;
	idx_size = c->bi.old_idx_sz + c->bi.idx_growth + c->bi.uncommitted_idx;
	idx_size += idx_size << 1;
	idx_lebs = div_u64(idx_size + c->idx_leb_size - 1, c->idx_leb_size);
	idx_lebs += 1;
	if (idx_lebs < MIN_INDEX_LEBS)
		idx_lebs = MIN_INDEX_LEBS;
	return idx_lebs;
}