Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201811
b: refs/heads/master
c: 33789fb
h: refs/heads/master
i:
  201809: e1cb65b
  201807: 61db427
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Jun 4, 2010
1 parent a8aa6c2 commit f2def2d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 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: eb89580e1a8388d206bf143c6c39d001095106ba
refs/heads/master: 33789fb9d4470e27d18596c0966339e2ca8865a9
27 changes: 17 additions & 10 deletions trunk/drivers/mtd/ubi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,19 @@ static int add_to_list(struct ubi_scan_info *si, int pnum, int ec,
{
struct ubi_scan_leb *seb;

if (list == &si->free)
if (list == &si->free) {
dbg_bld("add to free: PEB %d, EC %d", pnum, ec);
else if (list == &si->erase)
si->free_peb_count += 1;
} else if (list == &si->erase) {
dbg_bld("add to erase: PEB %d, EC %d", pnum, ec);
else if (list == &si->corr) {
si->erase_peb_count += 1;
} else if (list == &si->corr) {
dbg_bld("add to corrupted: PEB %d, EC %d", pnum, ec);
si->corr_count += 1;
} else if (list == &si->alien)
si->corr_peb_count += 1;
} else if (list == &si->alien) {
dbg_bld("add to alien: PEB %d, EC %d", pnum, ec);
else
si->alien_peb_count += 1;
} else
BUG();

seb = kmalloc(sizeof(struct ubi_scan_leb), GFP_KERNEL);
Expand Down Expand Up @@ -517,6 +520,7 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si,
sv->leb_count += 1;
rb_link_node(&seb->u.rb, parent, p);
rb_insert_color(&seb->u.rb, &sv->root);
si->used_peb_count += 1;
return 0;
}

Expand Down Expand Up @@ -751,7 +755,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
* corrupted. Set %bitflips flag in order to make this PEB be
* moved and EC be re-created.
*/
ec_corr = 1;
ec_corr = err;
ec = UBI_SCAN_UNKNOWN_EC;
bitflips = 1;
}
Expand Down Expand Up @@ -816,6 +820,9 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
else if (err == UBI_IO_BAD_HDR_READ || err == UBI_IO_BAD_HDR ||
(err == UBI_IO_PEB_FREE && ec_corr)) {
/* VID header is corrupted */
if (err == UBI_IO_BAD_HDR_READ ||
ec_corr == UBI_IO_BAD_HDR_READ)
si->read_err_count += 1;
err = add_to_list(si, pnum, ec, &si->corr);
if (err)
return err;
Expand Down Expand Up @@ -855,7 +862,6 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
err = add_to_list(si, pnum, ec, &si->alien);
if (err)
return err;
si->alien_peb_count += 1;
return 0;

case UBI_COMPAT_REJECT:
Expand Down Expand Up @@ -943,8 +949,9 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
* 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);
if (si->corr_peb_count >= 8 ||
si->corr_peb_count >= ubi->peb_count / 4) {
ubi_warn("%d PEBs are corrupted", si->corr_peb_count);
printk(KERN_WARNING "corrupted PEBs are:");
list_for_each_entry(seb, &si->corr, u.list)
printk(KERN_CONT " %d", seb->pnum);
Expand Down
19 changes: 14 additions & 5 deletions trunk/drivers/mtd/ubi/scan.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,23 @@ struct ubi_scan_volume {
* @erase: list of physical eraseblocks which have to be erased
* @alien: list of physical eraseblocks which should not be used by UBI (e.g.,
* those belonging to "preserve"-compatible internal volumes)
* @used_peb_count: count of used PEBs
* @corr_peb_count: count of PEBs in the @corr list
* @read_err_count: count of PEBs read with error (%UBI_IO_BAD_HDR_READ was
* returned)
* @free_peb_count: count of PEBs in the @free list
* @erase_peb_count: count of PEBs in the @erase list
* @alien_peb_count: count of PEBs in the @alien list
* @bad_peb_count: count of bad physical eraseblocks
* @vols_found: number of volumes found during scanning
* @highest_vol_id: highest volume ID
* @alien_peb_count: count of physical eraseblocks in the @alien list
* @is_empty: flag indicating whether the MTD device is empty or not
* @min_ec: lowest erase counter value
* @max_ec: highest erase counter value
* @max_sqnum: highest sequence number value
* @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
*
* This data structure contains the result of scanning and may be used by other
* UBI sub-systems to build final UBI data structures, further error-recovery
Expand All @@ -114,18 +119,22 @@ struct ubi_scan_info {
struct list_head free;
struct list_head erase;
struct list_head alien;
int used_peb_count;
int corr_peb_count;
int read_err_count;
int free_peb_count;
int erase_peb_count;
int alien_peb_count;
int bad_peb_count;
int vols_found;
int highest_vol_id;
int alien_peb_count;
int is_empty;
int min_ec;
int max_ec;
unsigned long long max_sqnum;
int mean_ec;
uint64_t ec_sum;
int ec_count;
int corr_count;
};

struct ubi_device;
Expand All @@ -135,7 +144,7 @@ struct ubi_vid_hdr;
* ubi_scan_move_to_list - move a PEB from the volume tree to a list.
*
* @sv: volume scanning information
* @seb: scanning eraseblock infprmation
* @seb: scanning eraseblock information
* @list: the list to move to
*/
static inline void ubi_scan_move_to_list(struct ubi_scan_volume *sv,
Expand Down

0 comments on commit f2def2d

Please sign in to comment.