diff options
author | Richard Weinberger <richard@nod.at> | 2014-11-24 14:20:31 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-01-28 16:09:45 +0100 |
commit | 4f5e3b6fadf9513c770c62fce404cae890c15147 (patch) | |
tree | 9c8e56527c22f559f02ded9ae3f1c2996feffa4b /drivers/mtd | |
parent | UBIFS: add a couple of extra asserts (diff) | |
download | linux-4f5e3b6fadf9513c770c62fce404cae890c15147.tar.xz linux-4f5e3b6fadf9513c770c62fce404cae890c15147.zip |
UBI: Fastmap: Care about the protection queue
Fastmap can miss a PEB if it is in the protection queue
and not jet in the used tree.
Treat every protected PEB as used.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ubi/fastmap.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index b56672bf3294..db3defdfc3c0 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -1196,6 +1196,19 @@ static int ubi_write_fastmap(struct ubi_device *ubi, fm_pos += sizeof(*fec); ubi_assert(fm_pos <= ubi->fm_size); } + + for (i = 0; i < UBI_PROT_QUEUE_LEN; i++) { + list_for_each_entry(wl_e, &ubi->pq[i], u.list) { + fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); + + fec->pnum = cpu_to_be32(wl_e->pnum); + fec->ec = cpu_to_be32(wl_e->ec); + + used_peb_count++; + fm_pos += sizeof(*fec); + ubi_assert(fm_pos <= ubi->fm_size); + } + } fmh->used_peb_count = cpu_to_be32(used_peb_count); for (node = rb_first(&ubi->scrub); node; node = rb_next(node)) { |