Re: [PATCH v6 12/15] ubi: fastmap: Add all fastmap pebs into 'ai->fastmap' when fm->used_blocks>=2

From: Zhihao Cheng
Date: Sat Jan 15 2022 - 03:53:28 EST


Yes. But if you look into ubi_wl_init() you see that fastmap anchor PEBs
get erases synchronously(!). The comment before the erasure explains why.
About erasing fastmap anchor PEB synchronously, I admit curreunt UBI implementation cannot satisfy it, even with my fix applied. Wait, it seems that UBI has never made it sure. Old fastmap PEBs could be erased asynchronously, they could be counted into 'fmh->erase_peb_count' even in early UBI implementation code, so old fastmap anchor PEB will be added into 'ai->erase' and be erased asynchronously in next attaching.
In next attaching old fastmap PEBs will be processed as following:
ubi_attach_fastmap -> add_aeb(ai, &ai->erase...)
ubi_wl_init
list_for_each_entry_safe(aeb, tmp, &ai->erase)
erase_aeb // erase asynchronously
ubi->lookuptbl[e->pnum] = e
list_for_each_entry(aeb, &ai->fastmap, u.list)
e = ubi_find_fm_block(ubi, aeb->pnum)
if (e) {
...
} else {
if (ubi->lookuptbl[aeb->pnum]) // old fastmap PEBs are assigned to 'ubi->lookuptbl'
continue;
}
But, I feel it is not a problem, find_fm_anchor() can help us find out the right fastmap anchor PEB according seqnum.