[PATCH] mtd: nand: write bad block marker even with BBT

Brian Norris computersforpeace at gmail.com
Mon Dec 12 16:53:08 EST 2011


On Mon, Dec 12, 2011 at 12:49 PM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> On Wed, 2011-12-07 at 13:08 -0800, Brian Norris wrote:
>> Add and option (NAND_BBT_WRITE_BBM) for writing bad block markers to
>> proper OOB area on each block in addition to flash-based BBT. This is
>> useful when:
>>
>>  * bootloader cannot read the flash-based BBT format
>>  * BBT is corrupted and the flash must be rescanned for bad
>>    blocks; we want to remember bad blocks that were marked from Linux
>>
>> Adapted from code by Matthieu CASTET.
>>
>> Cc: Matthieu CASTET <matthieu.castet at parrot.com>
>> Signed-off-by: Brian Norris <computersforpeace at gmail.com>
>
> 2 questions, perhaps silly, but still:
>
> 1. Why wouldn't you make this the only and the default behavior? Why
> adding more options instead?

Personally, I'd like it to be default behavior. I guessed that it may
cause incompatibility with some other system which depended on the
current behavior, but if that's not a realistic concern, then I don't
mind dropping the option. It's also possible to add a flag to restore
the old behavior if needed in the future.

> 2. Would the case of inconsistency between BBT and OOB markers be
> possible to fix-up after the power cut?

Not trivially :) I suppose we could assume that any bad block markers
in the OOB are in the BBT (when it exists) but not vice versa, then
when we rebuild the BBT at boot time, we rescan the OOB only on the
bad blocks, rewriting to OOB if necessary. Eventually, this kind of
degrades to usefulness of the BBT though, if you're always checking
back with the OOB markers.

Brian



More information about the linux-mtd mailing list