Allow for controller errors when reading
Controller errors while reading can be caused by corruption caused by a previous powerloss. Because upper level software like JFFS2 treat -EIO as fatal, it is necessary to treat the error as an ECC error.
---drivers/mtd/onenand/onenand_base.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
drivers/mtd/onenand/onenand_base.c +0 -0
@@ -329,6 +329,16 @@ static int onenand_wait(struct mtd_info *mtd, int state)
printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n", ctrl); if (ctrl & ONENAND_CTRL_LOCK) printk(KERN_ERR "onenand_wait: it's locked error.\n");
+ if (state == FL_READING) {
+ /*
+ * Controller errors while reading can be caused by
+ * corruption caused by a previous powerloss. Because
+ * upper level software like JFFS2 treat -EIO as fatal,
+ * it is necessary to treat the error as an ECC error.
+ */
+ mtd->ecc_stats.failed++;
+ return -EBADMSG;
+ }
return -EIO; }
Signature · 1 line
1.5.2.5
Hi,
Quoted 5 lines · Adrian Hunter
Controller errors while reading can be caused by
corruption caused by a previous powerloss. Because upper level software like JFFS2 treat-EIOas fatal, it is necessary to treat the error as an ECC error.
Umm interesting. You mean it occurs controller error before ecc error at power loss case.
And it needs to define the terminology the Sudden Power Off Recovery or POR shortly.
I'm not sure a previous powerloss means POR.
Anyway could you show the controller error value? Since it needs to distinguish others e.g., initial bad blocks condition.
Thank you,
Kyungmin Park
Quoted 8 lines · Kyungmin Park
Quoted 5 lines · Adrian Hunter
Controller errors while reading can be caused by
corruption caused by a previous powerloss. Because upper level software like JFFS2 treat-EIOas fatal, it is necessary to treat the error as an ECC error.
Quoted 5 lines
Umm interesting. You mean it occurs controller error before ecc error at power loss case.
And it needs to define the terminology the Sudden Power Off Recovery or POR shortly.
I'm not sure a previous powerloss means POR.
No it is not what I meant. I have sent another patch which I hope is clearer.
Quoted 1 line
Anyway could you show the controller error value?
The controller error value is still printed.
Quoted 2 lines
Since it needs to
distinguish others e.g., initial bad blocks condition.
The bbt scan has its own wait function - I guess it is possible to get a controller error while reading oob from an eraseblock that is not actually a bad block. I am not sure how it would be possible to tell the difference.
Quoted 10 lines · Kyungmin Park
Hi,
Quoted 5 lines · Adrian Hunter
Controller errors while reading can be caused by
corruption caused by a previous powerloss. Because upper level software like JFFS2 treat-EIOas fatal, it is necessary to treat the error as an ECC error.
Quoted 7 lines
Umm interesting. You mean it occurs controller error before ecc error at power loss case.
And it needs to define the terminology the Sudden Power Off Recovery or POR shortly.
I'm not sure a previous powerloss means POR.Anyway could you show the controller error value?
0x2440
Since it needs to
Quoted 4 lines
distinguish others e.g., initial bad blocks condition.
Thank you,
Kyungmin Park