[MTD] mtdpart: Make ecc_stats more realistic.
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Mon Apr 6 10:59:02 EDT 2009
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d8877f191e35718ba11a4d46950131e74c40566c
Commit: d8877f191e35718ba11a4d46950131e74c40566c
Parent: 7995c7e94ff4db2ddb865ab42cc5a2e6abbbd71a
Author: Yauhen Kharuzhy <jekhor at gmail.com>
AuthorDate: Fri Mar 27 00:41:09 2009 +0200
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Apr 6 07:22:28 2009 -0700
[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 at gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
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 02ce38f..29675ed 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,
size_t *retlen, u_char *buf)
{
struct mtd_part *part = PART(mtd);
+ struct mtd_ecc_stats stats;
int res;
+ stats = part->master->ecc_stats;
+
if (from >= mtd->size)
len = 0;
else if (from + len > mtd->size)
@@ -58,9 +61,9 @@ static int part_read(struct mtd_info *mtd, loff_t from, size_t len,
len, retlen, buf);
if (unlikely(res)) {
if (res == -EUCLEAN)
- mtd->ecc_stats.corrected++;
+ mtd->ecc_stats.corrected += part->master->ecc_stats.corrected - stats.corrected;
if (res == -EBADMSG)
- mtd->ecc_stats.failed++;
+ mtd->ecc_stats.failed += part->master->ecc_stats.failed - stats.failed;
}
return res;
}
More information about the linux-mtd-cvs
mailing list