[PATCH V2] mtd: core: skip badblocks increment for blocks already known bad
Miquel Raynal
miquel.raynal at bootlin.com
Fri Sep 5 07:56:01 PDT 2025
On Tue, 02 Sep 2025 17:27:32 +0800, Wang Zhaolong wrote:
> Repeatedly marking the same eraseblock bad inflates
> mtd->ecc_stats.badblocks because mtd_block_markbad() unconditionally
> increments the counter on success, while some implementations (e.g.
> NAND) return 0 both when the block was already bad and when it has just
> been marked[1].
>
> Fix by checking if the block is already bad before calling
> ->_block_markbad() when _block_isbad is available. Only skip the counter
> increment when we can confirm the block was already bad. In all other
> cases continue incrementing the counter.
>
> [...]
Applied to mtd/next, thanks!
[1/1] mtd: core: skip badblocks increment for blocks already known bad
commit: 1b2dd17dd514b699818afeac1b513651b003ec10
Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl
More information about the linux-mtd
mailing list