mtd-utils/nandwrite: what if write fails?

Ricard Wanderlof ricard.wanderlof at axis.com
Wed Oct 18 04:18:45 EDT 2006


On Tue, 17 Oct 2006, Josh Boyer wrote:

> On Tue, 2006-10-17 at 16:17 +0200, Ricard Wanderlof wrote:
>> ...
>> 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?
>> ..
>
> pwrite can fail because of a transient error.  NAND can get soft bit
> flips that can be cleared by erasing the block.  So to mark a block bad
> without at least trying to write to it a couple of times seems a bit
> drastic.

I see. Well, then in that case, a course of action would be to erase the 
block, try to rewrite, and then mark it bad should pwrite still fail 
after the second attempt?

Would another option be to erase each block immediately prior to writing 
However, this wouldn't make it possible to write only part of a block, so 
again, should not be the default behavior.

I'm curious about the 'soft bit flipping' though. I suppose both the case 
of a bit going from 1->0 as well as 0->1 are possible? That would mean 
that a previously erased block could contain random 0's, resulting in the 
potential need for re-erase before writing.

Does anyone have a reference to more info on this subject? I've scanned 
the 'net, but most of the hard-core information I've found to be in 
application notes from various chip manufacturers. While informative, they 
tend to be a bit restrictive on practical aspects of NAND flash 
management.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30


More information about the linux-mtd mailing list