/* This function returns %0 on success and a negative error code on failure.  */
int ubifs_calc_lpt_geom(struct ubifs_info *c)
/* This function returns %0 on success and a negative error code on failure.  */
int ubifs_calc_lpt_geom(struct ubifs_info *c)
{
	int lebs_needed;
	long long sz;
	do_calc_lpt_geom(c);
	sz = c->lpt_sz * 2;
	lebs_needed = div_u64(sz + c->leb_size - 1, c->leb_size);
	if (lebs_needed > c->lpt_lebs) {
		ubifs_err("too few LPT LEBs");
		return -EINVAL;
	}
	if (c->ltab_sz > c->leb_size) {
		ubifs_err("LPT ltab too big");
		return -EINVAL;
	}
	c->check_lpt_free = c->big_lpt;
	return 0;
}