/* This function calculates and returns the number of eraseblocks 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 eraseblocks which should be kept for index usage.  */
int ubifs_calc_min_idx_lebs(struct ubifs_info *c)
{
	int idx_lebs, eff_leb_size = c->leb_size - c->max_idx_node_sz;
	long long idx_size;
	idx_size = c->old_idx_sz + c->budg_idx_growth + c->budg_uncommitted_idx;
	idx_size = idx_size + (idx_size << 1);
	idx_size += eff_leb_size - 1;
	idx_lebs = div_u64(idx_size, eff_leb_size);
	idx_lebs += 1;
	if (idx_lebs < MIN_INDEX_LEBS)
		idx_lebs = MIN_INDEX_LEBS;
	return idx_lebs;
}