[RFC PATCH] UBIFS: remove check for all(0xff) for empty pages

Gupta, Pekon pekon at ti.com
Fri Mar 21 03:57:57 EDT 2014

>From: Matthieu CASTET [mailto:matthieu.castet at parrot.com]
>>Pekon Gupta <pekon at ti.com> a écrit :
>If the mtd layer check the number of bitflip on empty page why it
>doesn't correct it and UBIFS see all 0xff ?
Most drivers already do that. But my question is bit different.
UBI returns UBI_IO_FF_BITFLIP, when it finds bit-flips in erased-pages
Then why can't UBIFS reuse that information, instead of repeating the
check by itself (comparing each byte with 0xff)

>In the other hand if mtd layer is not able to check empty page this is
>very dangerous. What happen if an empty page already have too much
>bitflip ?
>The data we write on this page will be corrupted.
It already does so, nand_base.c returns with -EBADMSG when there are
bitflip_count > ecc.strength.

>In my opinion the change should be done on mtd/UBI layer not ubifs.
>The main problem today is that some driver don't read empty page with
>ecc (because their ecc of empty page is not 0xff).
>We can add metadata (in spare because ubifs want power of 2	
>write unit !) that can help to see it the page is empty or not.
We cannot add any extra marker to OOB/spare area because:
(1) That breaks compatibility with ECC layout expected by ROM code.
  Thus, many legacy devices might fail to boot from NAND.

(2) extra marker in ECC layout is itself subjected to bit-flips, thereby
  making an erased-page getting recognized as programmed-page,
  so this is not a fool-proof solution.

Can you please review [1], and if there is a way in which we can avoid
UBIFS giving "corrupt white-space" error during scan, then 
I'll try to get patch for that.

[1] http://lists.infradead.org/pipermail/linux-mtd/2014-March/052513.html

with regards, pekon

More information about the linux-mtd mailing list