diff options
| -rw-r--r-- | drivers/mtd/ubi/eba.c | 4 | ||||
| -rw-r--r-- | drivers/mtd/ubi/io.c | 33 | ||||
| -rw-r--r-- | drivers/mtd/ubi/scan.c | 8 | ||||
| -rw-r--r-- | drivers/mtd/ubi/scan.h | 2 | ||||
| -rw-r--r-- | drivers/mtd/ubi/ubi.h | 7 |
5 files changed, 30 insertions, 24 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index fe74749e0dae..334865ef5220 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
| @@ -418,7 +418,7 @@ retry: | |||
| 418 | * may try to recover data. FIXME: but this is | 418 | * may try to recover data. FIXME: but this is |
| 419 | * not implemented. | 419 | * not implemented. |
| 420 | */ | 420 | */ |
| 421 | if (err == UBI_IO_BAD_HDR_READ || | 421 | if (err == UBI_IO_BAD_HDR_EBADMSG || |
| 422 | err == UBI_IO_BAD_HDR) { | 422 | err == UBI_IO_BAD_HDR) { |
| 423 | ubi_warn("corrupted VID header at PEB " | 423 | ubi_warn("corrupted VID header at PEB " |
| 424 | "%d, LEB %d:%d", pnum, vol_id, | 424 | "%d, LEB %d:%d", pnum, vol_id, |
| @@ -963,7 +963,7 @@ write_error: | |||
| 963 | static int is_error_sane(int err) | 963 | static int is_error_sane(int err) |
| 964 | { | 964 | { |
| 965 | if (err == -EIO || err == -ENOMEM || err == UBI_IO_BAD_HDR || | 965 | if (err == -EIO || err == -ENOMEM || err == UBI_IO_BAD_HDR || |
| 966 | err == UBI_IO_BAD_HDR_READ || err == -ETIMEDOUT) | 966 | err == UBI_IO_BAD_HDR_EBADMSG || err == -ETIMEDOUT) |
| 967 | return 0; | 967 | return 0; |
| 968 | return 1; | 968 | return 1; |
| 969 | } | 969 | } |
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 332f992f13d9..05774da4abca 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
| @@ -517,7 +517,7 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum) | |||
| 517 | * In this case we probably anyway have garbage in this PEB. | 517 | * In this case we probably anyway have garbage in this PEB. |
| 518 | */ | 518 | */ |
| 519 | err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0); | 519 | err1 = ubi_io_read_vid_hdr(ubi, pnum, &vid_hdr, 0); |
| 520 | if (err1 == UBI_IO_BAD_HDR_READ || err1 == UBI_IO_BAD_HDR) | 520 | if (err1 == UBI_IO_BAD_HDR_EBADMSG || err1 == UBI_IO_BAD_HDR) |
| 521 | /* | 521 | /* |
| 522 | * The VID header is corrupted, so we can safely erase this | 522 | * The VID header is corrupted, so we can safely erase this |
| 523 | * PEB and not afraid that it will be treated as a valid PEB in | 523 | * PEB and not afraid that it will be treated as a valid PEB in |
| @@ -712,6 +712,8 @@ bad: | |||
| 712 | * and corrected by the flash driver; this is harmless but may indicate that | 712 | * and corrected by the flash driver; this is harmless but may indicate that |
| 713 | * this eraseblock may become bad soon (but may be not); | 713 | * this eraseblock may become bad soon (but may be not); |
| 714 | * o %UBI_IO_BAD_HDR if the erase counter header is corrupted (a CRC error); | 714 | * o %UBI_IO_BAD_HDR if the erase counter header is corrupted (a CRC error); |
| 715 | * o %UBI_IO_BAD_HDR_EBADMSG is the same as %UBI_IO_BAD_HDR, but there also was | ||
| 716 | * a data integrity error (uncorrectable ECC error in case of NAND); | ||
| 715 | * o %UBI_IO_PEB_EMPTY if the physical eraseblock is empty; | 717 | * o %UBI_IO_PEB_EMPTY if the physical eraseblock is empty; |
| 716 | * o a negative error code in case of failure. | 718 | * o a negative error code in case of failure. |
| 717 | */ | 719 | */ |
| @@ -731,15 +733,15 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, | |||
| 731 | 733 | ||
| 732 | /* | 734 | /* |
| 733 | * We read all the data, but either a correctable bit-flip | 735 | * We read all the data, but either a correctable bit-flip |
| 734 | * occurred, or MTD reported about some data integrity error, | 736 | * occurred, or MTD reported a data integrity error |
| 735 | * like an ECC error in case of NAND. The former is harmless, | 737 | * (uncorrectable ECC error in case of NAND). The former is |
| 736 | * the later may mean that the read data is corrupted. But we | 738 | * harmless, the later may mean that the read data is |
| 737 | * have a CRC check-sum and we will detect this. If the EC | 739 | * corrupted. But we have a CRC check-sum and we will detect |
| 738 | * header is still OK, we just report this as there was a | 740 | * this. If the EC header is still OK, we just report this as |
| 739 | * bit-flip. | 741 | * there was a bit-flip, to force scrubbing. |
| 740 | */ | 742 | */ |
| 741 | if (err == -EBADMSG) | 743 | if (err == -EBADMSG) |
| 742 | read_err = UBI_IO_BAD_HDR_READ; | 744 | read_err = UBI_IO_BAD_HDR_EBADMSG; |
| 743 | } | 745 | } |
| 744 | 746 | ||
| 745 | magic = be32_to_cpu(ec_hdr->magic); | 747 | magic = be32_to_cpu(ec_hdr->magic); |
| @@ -983,6 +985,8 @@ bad: | |||
| 983 | * this eraseblock may become bad soon; | 985 | * this eraseblock may become bad soon; |
| 984 | * o %UBI_IO_BAD_HDR if the volume identifier header is corrupted (a CRC | 986 | * o %UBI_IO_BAD_HDR if the volume identifier header is corrupted (a CRC |
| 985 | * error detected); | 987 | * error detected); |
| 988 | * o %UBI_IO_BAD_HDR_EBADMSG is the same as %UBI_IO_BAD_HDR, but there also was | ||
| 989 | * a data integrity error (uncorrectable ECC error in case of NAND); | ||
| 986 | * o %UBI_IO_PEB_FREE if the physical eraseblock is free (i.e., there is no VID | 990 | * o %UBI_IO_PEB_FREE if the physical eraseblock is free (i.e., there is no VID |
| 987 | * header there); | 991 | * header there); |
| 988 | * o a negative error code in case of failure. | 992 | * o a negative error code in case of failure. |
| @@ -1006,14 +1010,15 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, | |||
| 1006 | 1010 | ||
| 1007 | /* | 1011 | /* |
| 1008 | * We read all the data, but either a correctable bit-flip | 1012 | * We read all the data, but either a correctable bit-flip |
| 1009 | * occurred, or MTD reported about some data integrity error, | 1013 | * occurred, or MTD reported a data integrity error |
| 1010 | * like an ECC error in case of NAND. The former is harmless, | 1014 | * (uncorrectable ECC error in case of NAND). The former is |
| 1011 | * the later may mean the read data is corrupted. But we have a | 1015 | * harmless, the later may mean that the read data is |
| 1012 | * CRC check-sum and we will identify this. If the VID header is | 1016 | * corrupted. But we have a CRC check-sum and we will detect |
| 1013 | * still OK, we just report this as there was a bit-flip. | 1017 | * this. If the VID header is still OK, we just report this as |
| 1018 | * there was a bit-flip, to force scrubbing. | ||
| 1014 | */ | 1019 | */ |
| 1015 | if (err == -EBADMSG) | 1020 | if (err == -EBADMSG) |
| 1016 | read_err = UBI_IO_BAD_HDR_READ; | 1021 | read_err = UBI_IO_BAD_HDR_EBADMSG; |
| 1017 | } | 1022 | } |
| 1018 | 1023 | ||
| 1019 | magic = be32_to_cpu(vid_hdr->magic); | 1024 | magic = be32_to_cpu(vid_hdr->magic); |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index 69b52e9c9489..7e7c56d162ec 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
| @@ -750,7 +750,7 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
| 750 | bitflips = 1; | 750 | bitflips = 1; |
| 751 | else if (err == UBI_IO_PEB_EMPTY) | 751 | else if (err == UBI_IO_PEB_EMPTY) |
| 752 | return add_to_list(si, pnum, UBI_SCAN_UNKNOWN_EC, &si->erase); | 752 | return add_to_list(si, pnum, UBI_SCAN_UNKNOWN_EC, &si->erase); |
| 753 | else if (err == UBI_IO_BAD_HDR_READ || err == UBI_IO_BAD_HDR) { | 753 | else if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_BAD_HDR) { |
| 754 | /* | 754 | /* |
| 755 | * We have to also look at the VID header, possibly it is not | 755 | * We have to also look at the VID header, possibly it is not |
| 756 | * corrupted. Set %bitflips flag in order to make this PEB be | 756 | * corrupted. Set %bitflips flag in order to make this PEB be |
| @@ -816,11 +816,11 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
| 816 | return err; | 816 | return err; |
| 817 | else if (err == UBI_IO_BITFLIPS) | 817 | else if (err == UBI_IO_BITFLIPS) |
| 818 | bitflips = 1; | 818 | bitflips = 1; |
| 819 | else if (err == UBI_IO_BAD_HDR_READ || err == UBI_IO_BAD_HDR || | 819 | else if (err == UBI_IO_BAD_HDR_EBADMSG || err == UBI_IO_BAD_HDR || |
| 820 | (err == UBI_IO_PEB_FREE && ec_corr)) { | 820 | (err == UBI_IO_PEB_FREE && ec_corr)) { |
| 821 | /* VID header is corrupted */ | 821 | /* VID header is corrupted */ |
| 822 | if (err == UBI_IO_BAD_HDR_READ || | 822 | if (err == UBI_IO_BAD_HDR_EBADMSG || |
| 823 | ec_corr == UBI_IO_BAD_HDR_READ) | 823 | ec_corr == UBI_IO_BAD_HDR_EBADMSG) |
| 824 | si->read_err_count += 1; | 824 | si->read_err_count += 1; |
| 825 | err = add_to_list(si, pnum, ec, &si->corr); | 825 | err = add_to_list(si, pnum, ec, &si->corr); |
| 826 | if (err) | 826 | if (err) |
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h index 2576a8d1532b..0876649318dd 100644 --- a/drivers/mtd/ubi/scan.h +++ b/drivers/mtd/ubi/scan.h | |||
| @@ -93,7 +93,7 @@ struct ubi_scan_volume { | |||
| 93 | * those belonging to "preserve"-compatible internal volumes) | 93 | * those belonging to "preserve"-compatible internal volumes) |
| 94 | * @used_peb_count: count of used PEBs | 94 | * @used_peb_count: count of used PEBs |
| 95 | * @corr_peb_count: count of PEBs in the @corr list | 95 | * @corr_peb_count: count of PEBs in the @corr list |
| 96 | * @read_err_count: count of PEBs read with error (%UBI_IO_BAD_HDR_READ was | 96 | * @read_err_count: count of PEBs read with error (%UBI_IO_BAD_HDR_EBADMSG was |
| 97 | * returned) | 97 | * returned) |
| 98 | * @free_peb_count: count of PEBs in the @free list | 98 | * @free_peb_count: count of PEBs in the @free list |
| 99 | * @erase_peb_count: count of PEBs in the @erase list | 99 | * @erase_peb_count: count of PEBs in the @erase list |
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 0359e0cce482..24a7c7647cb7 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
| @@ -90,15 +90,16 @@ | |||
| 90 | * UBI_IO_PEB_FREE: the physical eraseblock is free, i.e. it contains only a | 90 | * UBI_IO_PEB_FREE: the physical eraseblock is free, i.e. it contains only a |
| 91 | * valid erase counter header, and the rest are %0xFF bytes | 91 | * valid erase counter header, and the rest are %0xFF bytes |
| 92 | * UBI_IO_BAD_HDR: the EC or VID header is corrupted (bad magic or CRC) | 92 | * UBI_IO_BAD_HDR: the EC or VID header is corrupted (bad magic or CRC) |
| 93 | * UBI_IO_BAD_HDR_READ: the same as %UBI_IO_BAD_HDR, but also there was a read | 93 | * UBI_IO_BAD_HDR_EBADMSG: the same as %UBI_IO_BAD_HDR, but also there was a |
| 94 | * error reported by the flash driver | 94 | * data integrity error reported by the MTD driver |
| 95 | * (uncorrectable ECC error in case of NAND) | ||
| 95 | * UBI_IO_BITFLIPS: bit-flips were detected and corrected | 96 | * UBI_IO_BITFLIPS: bit-flips were detected and corrected |
| 96 | */ | 97 | */ |
| 97 | enum { | 98 | enum { |
| 98 | UBI_IO_PEB_EMPTY = 1, | 99 | UBI_IO_PEB_EMPTY = 1, |
| 99 | UBI_IO_PEB_FREE, | 100 | UBI_IO_PEB_FREE, |
| 100 | UBI_IO_BAD_HDR, | 101 | UBI_IO_BAD_HDR, |
| 101 | UBI_IO_BAD_HDR_READ, | 102 | UBI_IO_BAD_HDR_EBADMSG, |
| 102 | UBI_IO_BITFLIPS | 103 | UBI_IO_BITFLIPS |
| 103 | }; | 104 | }; |
| 104 | 105 | ||
