Skip to contentSkip to conversation

write bad block marker even with BBT

RFC In review Matthieu CASTET 2 participants 2 messages Oct 22, 2010 – Oct 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 write bad block marker even with BBT

Hi,

do you think a patch like that make sense ?

This allow to solve problem where bootloader don't support reading BBT.

We could also add a new flag and do this only if this flag is set.

Matthieu

drivers/mtd/nand/nand_base.c +4 -1
index ddffe76..71052d0 100644
@@ -409,7 +409,10 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
 	/* Do we have a flash based bad block table ? */
 	if (chip->options & NAND_USE_FLASH_BBT)
 		ret = nand_update_bbt(mtd, ofs);
-	else {
+	/* put also the bad block marker in case we loose BBT or
+	   the bootloader doesn't support reading it
+	 */
+	{
 		nand_get_device(chip, mtd, FL_WRITING);
 
 		/* Write to first two pages and to byte 1 and 6 if necessary.
#1 lore raw

drivers/mtd/nand/nand_base.c static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) · line 414

Quoted 12 lines
drivers/mtd/nand/nand_base.c +3 -1
index ddffe76..71052d0 100644
@@ -409,7 +409,10 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
 	/* Do we have a flash based bad block table ? */
 	if (chip->options & NAND_USE_FLASH_BBT)
 		ret = nand_update_bbt(mtd, ofs);
-	else {
+	/* put also the bad block marker in case we loose BBT or
+	   the bootloader doesn't support reading it
+	 */

Nitpick: please, use kernel commenting style:
/*
* Multi-line
* comment
*/

drivers/mtd/nand/nand_base.c static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs) · line 416

Quoted 2 lines
drivers/mtd/nand/nand_base.c +1 -0
+	{
 		nand_get_device(chip, mtd, FL_WRITING);

I think this makes sense, but this may break some setups, so this should be yet another chip->option.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)