Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: Account for BBT blocks when a partition is being allocated

With the introduction of mtd_block_isreserved(), it's now possible
to fix the bad and reserved block distribution exposed by ecc_stats,
instead of accounting all the bad or reserved blocks as 'bad'.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-by: Pekon Gupta <pekon@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Ezequiel Garcia and committed by
Brian Norris
fdf43a42 8471bb73

+3 -1
+3 -1
drivers/mtd/mtdpart.c
··· 535 535 uint64_t offs = 0; 536 536 537 537 while (offs < slave->mtd.size) { 538 - if (mtd_block_isbad(master, offs + slave->offset)) 538 + if (mtd_block_isreserved(master, offs + slave->offset)) 539 + slave->mtd.ecc_stats.bbtblocks++; 540 + else if (mtd_block_isbad(master, offs + slave->offset)) 539 541 slave->mtd.ecc_stats.badblocks++; 540 542 offs += slave->mtd.erasesize; 541 543 }