Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164041
b: refs/heads/master
c: 4a40685
h: refs/heads/master
i:
  164039: fb41221
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Aug 14, 2009
1 parent 8adf384 commit 8d639c1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b289b562f6d236108569a880cb38cc03d17a50d
refs/heads/master: 4a406856ea6830d8b8dba6a27d9f9331c5f4c13a
18 changes: 16 additions & 2 deletions trunk/drivers/mtd/ubi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/mtd/ubi/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ struct ubi_scan_volume {
* @mean_ec: mean erase counter value
* @ec_sum: a temporary variable used when calculating @mean_ec
* @ec_count: a temporary variable used when calculating @mean_ec
* @corr_count: count of corrupted PEBs
* @image_seq_set: indicates @ubi->image_seq is known
*
* This data structure contains the result of scanning and may be used by other
Expand All @@ -125,6 +126,7 @@ struct ubi_scan_info {
int mean_ec;
uint64_t ec_sum;
int ec_count;
int corr_count;
int image_seq_set;
};

Expand Down

0 comments on commit 8d639c1

Please sign in to comment.