/* @ubi: UBI device description object @fm_e: physical eraseblock to return @lnum: the last used logical eraseblock number for the PEB @torture: if this physical eraseblock has to be tortured  */
int ubi_wl_put_fm_peb(struct ubi_device *ubi, struct ubi_wl_entry *fm_e, int lnum, int torture)
/* @ubi: UBI device description object @fm_e: physical eraseblock to return @lnum: the last used logical eraseblock number for the PEB @torture: if this physical eraseblock has to be tortured  */
int ubi_wl_put_fm_peb(struct ubi_device *ubi, struct ubi_wl_entry *fm_e, int lnum, int torture)
{
	struct ubi_wl_entry *e;
	int vol_id, pnum = fm_e->pnum;
	dbg_wl("PEB %d", pnum);
	ubi_assert(pnum >= 0);
	ubi_assert(pnum < ubi->peb_count);
	spin_lock(&ubi->wl_lock);
	e = ubi->lookuptbl[pnum];
	if (!e) {
		e = fm_e;
		ubi_assert(e->ec >= 0);
		ubi->lookuptbl[pnum] = e;
	}
	spin_unlock(&ubi->wl_lock);
	vol_id = lnum ? UBI_FM_DATA_VOLUME_ID : UBI_FM_SB_VOLUME_ID;
	return schedule_erase(ubi, e, vol_id, lnum, torture);
}