[PATCH v4 2/2] mtd: nand: write BBM to OOB even with flash-based BBT

Bityutskiy, Artem artem.bityutskiy at intel.com
Thu Feb 2 03:12:04 EST 2012


On Fri, 2012-01-20 at 20:38 -0800, Brian Norris wrote:
> Currently, the flash-based BBT implementation writes bad block data only
> to its flash-based table and not to the OOB marker area. Then, as new bad
> blocks are marked over time, the OOB markers become out of date and the
> flash-based table becomes the only source of current bad block
> information.

I think the comment could be corrected: OOB markers become incomplete,
not out-of-date?


>   * This is the default implementation, which can be overridden by a hardware
> - * specific driver.
> + * specific driver. We try operations in the following order, according to our
> + * bbt_options (NAND_BBT_NO_OOB_BBM and NAND_BBT_USE_FLASH):
> + *  (1) erase the affected block, to allow OOB marker to be written cleanly
> + *  (2) update in-memory BBT
> + *  (3) write bad block marker to OOB area of affected block
> + *  (4) update flash-based BBT
> + * Note that we retain the first error encountered in (3) or (4), finish the
> + * procedures, and dump the error in the end.
>  */
>  static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
>  {
>  	struct nand_chip *chip = mtd->priv;
>  	uint8_t buf[2] = { 0, 0 };
> -	int block, ret, i = 0;
> +	int block, res, ret = 0, i = 0;
> +	int write_oob = !(chip->bbt_options & NAND_BBT_NO_OOB_BBM);
>  
> -	if (!(chip->bbt_options & NAND_BBT_USE_FLASH)) {
> +	BUG_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) &&
> +			!(chip->bbt_options & NAND_BBT_USE_FLASH));

If get the chip options wrong then this will be noticed only in the
field when a block gets bad? Probably we better put all the validation
of chip options to the NAND scan function so that incorrect combinations
are noticed immediately. Probably with a comment why.

Otherwise looks OK and I guess we could merge it.

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120202/2efb36e1/attachment-0001.sig>
-------------- next part --------------
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


More information about the linux-mtd mailing list