|
@@ -75,9 +75,10 @@ static int add_to_list(struct ubi_scan_info *si, int pnum, int ec,
|
|
|
dbg_bld("add to free: PEB %d, EC %d", pnum, ec);
|
|
|
else if (list == &si->erase)
|
|
|
dbg_bld("add to erase: PEB %d, EC %d", pnum, ec);
|
|
|
- else if (list == &si->corr)
|
|
|
+ else if (list == &si->corr) {
|
|
|
dbg_bld("add to corrupted: PEB %d, EC %d", pnum, ec);
|
|
|
- else if (list == &si->alien)
|
|
|
+ si->corr_count += 1;
|
|
|
+ } else if (list == &si->alien)
|
|
|
dbg_bld("add to alien: PEB %d, EC %d", pnum, ec);
|
|
|
else
|
|
|
BUG();
|
|
@@ -937,6 +938,19 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
|
|
|
if (si->is_empty)
|
|
|
ubi_msg("empty MTD device detected");
|
|
|
|
|
|
+ /*
|
|
|
+ * Few corrupted PEBs are not a problem and may be just a result of
|
|
|
+ * unclean reboots. However, many of them may indicate some problems
|
|
|
+ * with the flash HW or driver. Print a warning in this case.
|
|
|
+ */
|
|
|
+ if (si->corr_count >= 8 || si->corr_count >= ubi->peb_count / 4) {
|
|
|
+ ubi_warn("%d PEBs are corrupted", si->corr_count);
|
|
|
+ printk(KERN_WARNING "corrupted PEBs are:");
|
|
|
+ list_for_each_entry(seb, &si->corr, u.list)
|
|
|
+ printk(KERN_CONT " %d", seb->pnum);
|
|
|
+ printk(KERN_CONT "\n");
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* In case of unknown erase counter we use the mean erase counter
|
|
|
* value.
|