UBI: calculation for max number of bad-blocks

Richard Genoud richard.genoud at gmail.com
Mon Jan 13 11:26:02 EST 2014


2014/1/13 Richard Genoud <richard.genoud at gmail.com>:
> 2014/1/13 Gupta, Pekon <pekon at ti.com>:
>> Hi Richard,
> Hi !
>>
>> With reference to commit message:
>>         commit ba4087e956d336488c6df9dfca65d1e70cf480f1
>>         Author:     Richard Genoud <richard.genoud at gmail.com>
>>         UBI: use the whole MTD device size to get bad_peb_limit
>> -----------------
>> " NAND flash manufacturers give a
>>     minimum number of valid block (NVB) during the endurance life of the
>>     device, e.g.:
>>
>>     Parameter             Symbol    Min    Max    Unit      Notes
>>     --------------------------------------------------------------
>>     Valid block number     NVB     1004    1024   Blocks     1
>>
>>     From this number we can deduce the maximum number of bad PEB that a device will
>>     contain during its endurance life: a 128MiB NAND flash (1024 PEB) will not have
>>     less than 20 bad blocks during the flash endurance life.
>>
>>     But the manufacturer doesn't tell where those bad block will appear. He doesn't
>>     say either if they will be equally disposed on the whole device (and I'm pretty
>>     sure they won't). So, according to the datasheets, we should reserve the
>>     maximum number of bad PEB for each UBI device (worst case scenario: 20 bad
>>     blocks appears on the smallest MTD partition).
>>
>>     So this patch make UBI use the whole MTD device size to calculate the maximum
>>     bad expected eraseblocks.
>>
>>     The Kconfig option is in per1024 blocks, thus it can have a default value of 20
>>     which is *very* common for NAND devices."
>> -----------------
>>
>> I was not able to understand the need to do the convert
>> Min.NVB (Minimum number of valid blocks) into a ratio of  'max_beb_per1024'.
>> Can't we just use " Max(bad-blocks) = Max(NVB) - Min(NVB)" ?
>> And make reserve_PEB > Max(bad-blocks) in UBI partitions, as all bad-blocks
>> can appear together in same partition itself.
>>
>> with regards, pekon
>
> Well, It's just to have a number independent from the flash size.
> On the flash I'm currently working with, I've got:
> Min(NVB) = 1008 and Max(NVB)=2048
> Still, the kernel default config value of 20max_beb_per1024 is still correct.

As I was re-reading the datasheet, I realized that the ONFI parameters
bb_per_lun and blocks_per_lun could be used instead of the kernel
default value of 20 max_beb_per1024.



More information about the linux-mtd mailing list