public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Hans Zhang <zhanghonghui@innofidei.com>
To: Richard Genoud <richard.genoud@gmail.com>
Cc: linux-mtd <linux-mtd@lists.infradead.org>,
	zhanghonghui <zhanghonghui@innofidei.com>,
	David Woodhouse <dwmw2@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	zhouguangming@innofidei.com
Subject: Re: [PATCH] Make the mtdblock read/write skip the bad nand sector
Date: Fri, 22 Nov 2013 09:22:43 +0800	[thread overview]
Message-ID: <528EB1E3.7030101@innofidei.com> (raw)
In-Reply-To: <CACQ1gAiLesYEWmHkivAF=t8ekCFM=yDDyzkJTtduavNjp1g6wA@mail.gmail.com>

On 2013/11/21 18:59, Richard Genoud wrote:
> I don't think it's a good idea to skip bad blocks at mtd level.
> That will definitely break the userspace.
> The nanddump mtd-tool for instance has a bad block handling argument:
> --bb=METHOD, where METHOD can be `padbad', `dumpbad', or `skipbad':
>     padbad:  dump flash data, substituting 0xFF for any bad blocks
>     dumpbad: dump flash data, including any bad blocks
>     skipbad: dump good data, completely skipping any bad blocks (default)
>
> The bad block handling is done by the upper layer (UBI/jffs2...) not by mtd.

AFAIK the nanddump mtd-tool dump the nand through mtdchar driver. So this patch
will not break the userspace for this scenario.

>
> So, if you really need to read/write the mtd layer from userspace and
> jump bad block, you'll have to use the MEMGETBADBLOCK ioctl to check
> if the block is bad before reading/writing.
>
> But using UBI is usually a better option.

The ioctl handling is just for mtdchar device, not mtdblock. Definitely we can
get the badblock info before reading/writing. But if we just want to read/write
the mtdblock device, mtdchar device need to be checked first, that is not
convenience.

Here's my scenario, I want to write nand through mtdblock by dd command, it will
abort writing when there's a bad block, but will continually reading ingore(or
even don't know about) the bad block info. That break the consistency of the data.

To make the dd command work, I think we need this patch.

thanks.

>
> Richard.
>
>


“This E-mail and its attachments may contain legally privileged or confidential information from Innofidei Corporation. Any unauthorized copy, use, disclosure or distribution of this information is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by E-mail or telephone and delete this E-mail and all its attachments immediately.
本邮件及其附件内容可能包含创毅公司享有专有法律权利的或者需要保密的信息。严禁任何人未经发件人许可以任何形式复制、使用、披露或者散发此项信息。如果您不是该收件人,请您立即通过邮件或者电话通知发件人并立即删除本邮件及其附件内容.”

  reply	other threads:[~2013-11-22  1:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21  8:54 [PATCH] Make the mtdblock read/write skip the bad nand sector Hans Zhang
2013-11-21 10:59 ` Richard Genoud
2013-11-22  1:22   ` Hans Zhang [this message]
2013-11-22  1:52     ` Ezequiel Garcia
2013-11-22  2:10       ` Hans Zhang
2013-11-22  8:14         ` Richard Weinberger
2013-11-22 11:45         ` Ezequiel Garcia
2013-11-25  1:29           ` Hans Zhang
2013-11-25 10:11             ` Ezequiel Garcia
2013-11-25 10:23               ` Richard Genoud
2013-11-25 11:30                 ` Hans Zhang
2013-11-25 11:52                   ` Ezequiel Garcia
2013-11-25 12:16                     ` David Woodhouse
2013-11-25 12:30                       ` Ezequiel Garcia
2013-11-25 15:12                         ` Peter Korsgaard
2013-11-25 15:46                           ` David Woodhouse
2013-11-29 13:26                             ` Pavel Machek
2013-12-10  7:43                               ` Brian Norris
  -- strict thread matches above, loose matches on Subject: below --
2013-11-21  8:39 Hans Zhang

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=528EB1E3.7030101@innofidei.com \
    --to=zhanghonghui@innofidei.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard.genoud@gmail.com \
    --cc=zhouguangming@innofidei.com \
    /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