diff options
author | Yauhen Kharuzhy <jekhor@gmail.com> | 2009-03-26 18:41:09 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-04-06 10:22:28 -0400 |
commit | d8877f191e35718ba11a4d46950131e74c40566c (patch) | |
tree | 1c52c60c4ef35b11a4d74cea99159f562204bcb4 /drivers/mtd/mtdpart.c | |
parent | 7995c7e94ff4db2ddb865ab42cc5a2e6abbbd71a (diff) |
[MTD] mtdpart: Make ecc_stats more realistic.
In the existing implementation, ecc_stats fields are incremented only by
one, regardless of master mtd errors number. For example, if there are N
errors were corrected by ECC, partition ecc_stats.corrected will be
incremented by one.
This commit changes simple increment to sum of old value and parent mtd
error count.
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r-- | drivers/mtd/mtdpart.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 02ce38fb1fc3..29675edb44b4 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -48,8 +48,11 @@ static int part_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
48 | size_t *retlen, u_char *buf) | 48 | size_t *retlen, u_char *buf) |
49 | { | 49 | { |
50 | struct mtd_part *part = PART(mtd); | 50 | struct mtd_part *part = PART(mtd); |
51 | struct mtd_ecc_stats stats; | ||
51 | int res; | 52 | int res; |
52 | 53 | ||
54 | stats = part->master->ecc_stats; | ||
55 | |||
53 | if (from >= mtd->size) | 56 | if (from >= mtd->size) |
54 | len = 0; | 57 | len = 0; |
55 | else if (from + len > mtd->size) | 58 | else if (from + len > mtd->size) |
@@ -58,9 +61,9 @@ static int part_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
58 | len, retlen, buf); | 61 | len, retlen, buf); |
59 | if (unlikely(res)) { | 62 | if (unlikely(res)) { |
60 | if (res == -EUCLEAN) | 63 | if (res == -EUCLEAN) |
61 | mtd->ecc_stats.corrected++; | 64 | mtd->ecc_stats.corrected += part->master->ecc_stats.corrected - stats.corrected; |
62 | if (res == -EBADMSG) | 65 | if (res == -EBADMSG) |
63 | mtd->ecc_stats.failed++; | 66 | mtd->ecc_stats.failed += part->master->ecc_stats.failed - stats.failed; |
64 | } | 67 | } |
65 | return res; | 68 | return res; |
66 | } | 69 | } |