9
0
Fork 0

UBI: Fastmap: Prepare for variable sized fastmaps

The current code assumes that each fastmap has the same amount of PEBs.
So far this is true but will change soon.

Signed-off-by: Richard Weinberger <richard@nod.at>

Conflicts:
	drivers/mtd/ubi/fastmap.c

Fixed minor conflict.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Richard Weinberger 2016-05-27 09:44:27 +02:00 committed by Sascha Hauer
parent 631cecf7ef
commit 12be3f0f5b
1 changed files with 9 additions and 2 deletions

View File

@ -1384,7 +1384,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
ret = -ENOSPC;
goto err;
} else if (!tmp_e && old_fm) {
} else if (!tmp_e && old_fm && old_fm->e[i]) {
ret = erase_block(ubi, old_fm->e[i]->pnum);
if (ret < 0) {
int j;
@ -1400,12 +1400,19 @@ int ubi_update_fastmap(struct ubi_device *ubi)
} else {
new_fm->e[i] = tmp_e;
if (old_fm)
if (old_fm && old_fm->e[i])
ubi_wl_put_fm_peb(ubi, old_fm->e[i], i,
old_fm->to_be_tortured[i]);
}
}
if (old_fm && new_fm->used_blocks < old_fm->used_blocks) {
for (i = new_fm->used_blocks; i < old_fm->used_blocks; i++) {
ubi_wl_put_fm_peb(ubi, old_fm->e[i], i,
old_fm->to_be_tortured[i]);
}
}
tmp_e = ubi_wl_get_fm_peb(ubi, 1);
if (old_fm) {