aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2014-11-24 08:20:31 -0500
committerRichard Weinberger <richard@nod.at>2015-01-28 10:09:45 -0500
commit4f5e3b6fadf9513c770c62fce404cae890c15147 (patch)
tree9c8e56527c22f559f02ded9ae3f1c2996feffa4b
parentfb4325a3d9f983160f142b919880ccbe2304bc25 (diff)
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>
-rw-r--r--drivers/mtd/ubi/fastmap.c13
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,
1196 fm_pos += sizeof(*fec); 1196 fm_pos += sizeof(*fec);
1197 ubi_assert(fm_pos <= ubi->fm_size); 1197 ubi_assert(fm_pos <= ubi->fm_size);
1198 } 1198 }
1199
1200 for (i = 0; i < UBI_PROT_QUEUE_LEN; i++) {
1201 list_for_each_entry(wl_e, &ubi->pq[i], u.list) {
1202 fec = (struct ubi_fm_ec *)(fm_raw + fm_pos);
1203
1204 fec->pnum = cpu_to_be32(wl_e->pnum);
1205 fec->ec = cpu_to_be32(wl_e->ec);
1206
1207 used_peb_count++;
1208 fm_pos += sizeof(*fec);
1209 ubi_assert(fm_pos <= ubi->fm_size);
1210 }
1211 }
1199 fmh->used_peb_count = cpu_to_be32(used_peb_count); 1212 fmh->used_peb_count = cpu_to_be32(used_peb_count);
1200 1213
1201 for (node = rb_first(&ubi->scrub); node; node = rb_next(node)) { 1214 for (node = rb_first(&ubi->scrub); node; node = rb_next(node)) {