public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: Ricard Wanderlof <ricard.wanderlof@axis.com>
Cc: Linux mtd <linux-mtd@lists.infradead.org>
Subject: Re: mtd-utils/nandwrite: what if write fails?
Date: Tue, 17 Oct 2006 17:36:59 +0300	[thread overview]
Message-ID: <1161095820.3260.84.camel@sauron> (raw)
In-Reply-To: <Pine.LNX.4.64.0610171609400.25906@lnxricardw.se.axis.com>

Hi Richard,

On Tue, 2006-10-17 at 16:17 +0200, Ricard Wanderlof wrote:
> I have a question regarding writes to NAND flash; for instance, in 
> mtd-utils/nandwrite.c, prior to writing to a block, it is checked so that 
> it isn't bad (using the MEMGETBADBLOCK ioctl). However, what happens if 
> the block goes bad during write? If the pwrite() call which writes out the 
> page data fails, the application says perror() and exits. Shouldn't it 
> mark the block as bad, and re-write the data so far written to the block 
> to the next good block? 

If we are talking about nandwrite - I would prefer it not to do this. Or
do this if an this was specified via an explicit option ...

> As I understand it, mtd doesn't mark a block bad,

Yes, MTD provides you mechanisms to do this, but it is up to you (MTD
user) to do this or not.

> it is up to the application or overlying file system (e.g. JFFS2).

Yes, not only JFFS2, just any software which works on top of MTD and
knows what it does. For example, UBI can do this. Or some user-space
tools.

>  So it 
> won't even help to run nandwrite again as the block has not been marked 
> bad.

Not sure, put probably yes. You may explore fix this adding a
corresponding option to nandwrite. Or you may write an utility which
does flash torturing and identifies bad eraseblocks, e.g., flash_check.

> (Or is it simply that normally nandwrite is only used during testing, or 
> writing an initial filesystem, and the likelyhood of a block failing at 
> precisely this time is rather small, compared to the rest of the lifetime 
> of the memory (i.e. repeated JFFS2 accesses)?)
Not sure, but I personally used it only for debugging purposes.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

  reply	other threads:[~2006-10-17 14:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-17 14:17 mtd-utils/nandwrite: what if write fails? Ricard Wanderlof
2006-10-17 14:36 ` Artem Bityutskiy [this message]
2006-10-27 13:07   ` Ricard Wanderlof
2006-10-27 14:13     ` Artem Bityutskiy
2006-10-17 15:33 ` Josh Boyer
2006-10-18  8:18   ` Ricard Wanderlof
2006-10-27 13:09   ` Ricard Wanderlof

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=1161095820.3260.84.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=ricard.wanderlof@axis.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