From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: "ext Jörn Engel" <joern@logfs.org>
Cc: linux-mtd@lists.infradead.org, kmpark@infradead.org
Subject: Re: [PATCH] [MTD] [OneNAND] Do not stop reading for ECC errors
Date: Mon, 05 Nov 2007 16:46:13 +0200 [thread overview]
Message-ID: <472F2CB5.6090409@nokia.com> (raw)
In-Reply-To: <20071105132512.GA19232@lazybastard.org>
ext Jörn Engel wrote:
> On Fri, 2 November 2007 13:30:04 +0200, Adrian Hunter wrote:
>> diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
>> index dd28355..616747c 100644
>> --- a/drivers/mtd/onenand/onenand_base.c
>> +++ b/drivers/mtd/onenand/onenand_base.c
>> @@ -855,6 +855,8 @@ static int onenand_read_ops_nolock(struct mtd_info *mtd, loff_t from,
>> this->command(mtd, ONENAND_CMD_READ, from, writesize);
>> ret = this->wait(mtd, FL_READING);
>> onenand_update_bufferram(mtd, from, !ret);
>> + if (ret == -EBADMSG)
>> + ret = 0;
>
> Why is -EBADMSG dropped here?
-EBADMSG is an ECC error.
ret must be non-zero to indicate that the bufferram is invalid. Otherwise
if we read from the same location again, the data would be taken from bufferram
and no ECC error would be reported. However we need to keep reading (see nand_base.c)
so ret is set to zero as though no error occured. Finally mtd->ecc_stats.failed
is examined to determine ECC errors. i.e.
static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf)
{
...
stats = mtd->ecc_stats;
...
while (!ret) {
...
ret = this->wait(mtd, FL_READING);
onenand_update_bufferram(mtd, from, !ret);
if (ret == -EBADMSG)
ret = 0;
}
*retlen = read;
if (mtd->ecc_stats.failed - stats.failed)
return -EBADMSG;
if (ret)
return ret;
return mtd->ecc_stats.corrected - stats.corrected ? -EUCLEAN : 0;
}
>
>> @@ -988,18 +995,16 @@ static int onenand_read_oob_nolock(struct mtd_info *mtd, loff_t from,
>> onenand_update_bufferram(mtd, from, 0);
>>
>> ret = this->wait(mtd, FL_READING);
>> - /* First copy data and check return value for ECC handling */
>> + if (ret && ret != -EBADMSG) {
>> + printk(KERN_ERR "onenand_read_oob_nolock: read failed = 0x%x\n", ret);
>> + break;
>> + }
>
> What about -EUCLEAN?
The wait function doesn't return -EUCLEAN. It increments mtd->ecc_stats.corrected and returns
zero for correctable ECC errors.
File systems (like say JFFS2 for example) don't expect -EUCLEAN from mtd->read_oob and would treat
it as a fatal error, so it must not be returned in this case.
>
> Jörn
>
next prev parent reply other threads:[~2007-11-05 14:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-02 11:30 [PATCH] [MTD] [OneNAND] Do not stop reading for ECC errors Adrian Hunter
2007-11-05 13:25 ` Jörn Engel
2007-11-05 14:46 ` Adrian Hunter [this message]
2007-11-05 16:23 ` Jörn Engel
2007-11-06 7:14 ` Adrian Hunter
2007-11-06 7:14 ` Adrian Hunter
-- strict thread matches above, loose matches on Subject: below --
2007-11-06 7:17 Adrian Hunter
2007-11-06 8:26 ` Kyungmin Park
2007-11-09 14:21 ` Adrian Hunter
2007-11-15 8:00 ` Adrian Hunter
2007-11-26 11:45 ` Adrian Hunter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=472F2CB5.6090409@nokia.com \
--to=ext-adrian.hunter@nokia.com \
--cc=joern@logfs.org \
--cc=kmpark@infradead.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).