/* This function reads the contents of the given LEB number @lnum, then fixes it up, so that empty min. I/O units in the end of LEB are actually erased on flash (rather than being just all-0xff real data). If the LEB is completely empty, it is simply unmapped.  */
static int fixup_leb(struct ubifs_info *c, int lnum, int len)
/* This function reads the contents of the given LEB number @lnum, then fixes it up, so that empty min. I/O units in the end of LEB are actually erased on flash (rather than being just all-0xff real data). If the LEB is completely empty, it is simply unmapped.  */
static int fixup_leb(struct ubifs_info *c, int lnum, int len)
{
	int err;
	ubifs_assert(len >= 0);
	ubifs_assert(len % c->min_io_size == 0);
	ubifs_assert(len < c->leb_size);
	if (len == 0) {
		dbg_mnt("unmap empty LEB %d", lnum);
		return ubifs_leb_unmap(c, lnum);
	}
	dbg_mnt("fixup LEB %d, data len %d", lnum, len);
	err = ubifs_leb_read(c, lnum, c->sbuf, 0, len, 1);
	if (err)
		return err;
	return ubifs_leb_change(c, lnum, c->sbuf, len);
}