/* This function returns the amount of free space in the index head LEB or a negative error code.  */
static int take_ihead(struct ubifs_info *c)
/* This function returns the amount of free space in the index head LEB or a negative error code.  */
static int take_ihead(struct ubifs_info *c)
{
	const struct ubifs_lprops *lp;
	int err, free;
	ubifs_get_lprops(c);
	lp = ubifs_lpt_lookup_dirty(c, c->ihead_lnum);
	if (IS_ERR(lp)) {
		err = PTR_ERR(lp);
		goto out;
	}
	free = lp->free;
	lp = ubifs_change_lp(c, lp, LPROPS_NC, LPROPS_NC,
			     lp->flags | LPROPS_TAKEN, 0);
	if (IS_ERR(lp)) {
		err = PTR_ERR(lp);
		goto out;
	}
	err = free;
out:
	ubifs_release_lprops(c);
	return err;
}