/* This function commits orphans to flash. On success, %0 is returned, otherwise a negative error code is returned.  */
static int commit_orphans(struct ubifs_info *c)
/* This function commits orphans to flash. On success, %0 is returned, otherwise a negative error code is returned.  */
static int commit_orphans(struct ubifs_info *c)
{
	int avail, atomic = 0, err;
	ubifs_assert(c->cmt_orphans > 0);
	avail = avail_orphs(c);
	if (avail < c->cmt_orphans) {
		err = consolidate(c);
		if (err)
			return err;
		atomic = 1;
	}
	err = write_orph_nodes(c, atomic);
	return err;
}