From: Artem Bityutskiy <dedekind@infradead.org>
To: Du Zhongdong <axdududu@gmail.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>
Subject: Re: [NAND flash driver] What would mtd do if read returns -EBADMSG (ecc failed)
Date: Tue, 21 Oct 2008 10:09:54 +0300 [thread overview]
Message-ID: <1224572994.4466.108.camel@sauron> (raw)
In-Reply-To: <7ccead5b0810202351n5db8e66ep1fbec555707950f6@mail.gmail.com>
On Tue, 2008-10-21 at 14:51 +0800, Du Zhongdong wrote:
> I got another question: if, in my nand flash driver, there's an ECC
> error cannot be corrected during a read procedure, I think now the
> block should be marked as a bad block
Read errors do not indicate that the block became bad. For example, if
you write twice (and different data) to the same NAND page, you'll
probably end up with ECC errors. But the block will not be bad.
For example, a silly user wrote something to /dev/mtd several times. And
you have many read errors. Is whole /dev/mtd bad? No, it does not.
> , then two options:
> 1, I mark that block BAD in my nand flash driver(specifically, I would
> insert some code in the nand_read() function in nand_base.c to handle
> this error);
Current model is so that MTD driver is not intelligent. It just reads,
writes, erases, etc when it is asked to. All bad block management is
done in upper layers. So this is not your driver's pain.
> 2, I return some error msg the upper layer(ie. MTD layer), which is
> what nand_read() do at present. Then I would expect the MTD layer
> would mark that block BAD.
Not the MTD layer, but stuff like UBI or JFFS2 - the _client_ of the MTD
layer.
> I read s3c2410.c and find that it chose option 2. But I can't find the
> place in the code where the MTD layer mark that block BAD.
Right. MTD layer does not do this. It is stupid, and marks blocks as bad
only when someone calls mtd->block_markbad().
Think about MTD as the very low layer, which just provides the interface
to work with raw flash chip. Nothing else, no intelligence.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
next prev parent reply other threads:[~2008-10-21 7:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-21 6:11 [NAND flash driver] What would mtd do if read returns -EBADMSG (ecc failed) Du Zhongdong
2008-10-21 6:21 ` Artem Bityutskiy
[not found] ` <7ccead5b0810202351n5db8e66ep1fbec555707950f6@mail.gmail.com>
2008-10-21 7:09 ` Artem Bityutskiy [this message]
2008-10-21 7:36 ` Du Zhongdong
2008-10-21 6:50 ` Ricard Wanderlof
[not found] ` <7ccead5b0810202358l60368b79q2aae53bd1afc218@mail.gmail.com>
[not found] ` <Pine.LNX.4.64.0810210915260.6120@lnxricardw.se.axis.com>
2008-10-21 7:39 ` Du Zhongdong
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=1224572994.4466.108.camel@sauron \
--to=dedekind@infradead.org \
--cc=axdududu@gmail.com \
--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