/* This function returns %1 if the LPT area is running out of free space and %0 if it is not.  */
static int need_write_all(struct ubifs_info *c)
/* This function returns %1 if the LPT area is running out of free space and %0 if it is not.  */
static int need_write_all(struct ubifs_info *c)
{
	long long free = 0;
	int i;
	for (i = 0; i < c->lpt_lebs; i++) {
		if (i + c->lpt_first == c->nhead_lnum)
			free += c->leb_size - c->nhead_offs;
		else if (c->ltab[i].free == c->leb_size)
			free += c->leb_size;
		else if (c->ltab[i].free + c->ltab[i].dirty == c->leb_size)
			free += c->leb_size;
	}
	if (free <= c->lpt_sz * 2)
		return 1;
	return 0;
}