Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: Wang Zhaolong <wangzhaolong@huaweicloud.com>,  <richard@nod.at>,
	<vigneshr@ti.com>,  <linux-mtd@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,  <yi.zhang@huawei.com>,
	<yangerkun@huawei.com>
Subject: Re: [PATCH V2] mtd: core: skip badblocks increment for blocks already known bad
Date: Tue, 02 Sep 2025 15:16:45 +0200	[thread overview]
Message-ID: <87ldmxm1tu.fsf@bootlin.com> (raw)
In-Reply-To: <95bf5e07-7f03-efb0-da9b-cb50999c2524@huawei.com> (Zhihao Cheng's message of "Tue, 2 Sep 2025 19:41:06 +0800")


>> @@ -2349,11 +2350,19 @@ int mtd_block_markbad(struct mtd_info *mtd, loff_t ofs)
>>   		return -EROFS;
>>     	if (mtd->flags & MTD_SLC_ON_MLC_EMULATION)
>>   		ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize;
>>   -	ret = master->_block_markbad(master, mtd_get_master_ofs(mtd,
>> ofs));
>> +	moffs = mtd_get_master_ofs(mtd, ofs);
>> +
>> +	if (master->_block_isbad) {
>> +		ret = master->_block_isbad(master, moffs);
>> +		if (ret > 0)
>> +			return 0;
>
> Hi, Miquèl.
> Here, should we keep the same logic with the lower
> level(eg. nand_block_markbad, onenand_block_markbad) when 'ret < 0' is
> returned by master->_block_isbad. Many specific nand drivers(markbad)
> return the negative code when 'isbad' fails.

Good question, I guess in case of error in isbad() we shall probably
still try to mark the block bad because actually marking a block bad is
probably more important than returning correct statistics.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2025-09-02 19:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02  9:27 [PATCH V2] mtd: core: skip badblocks increment for blocks already known bad Wang Zhaolong
2025-09-02 11:41 ` Zhihao Cheng
2025-09-02 13:16   ` Miquel Raynal [this message]
2025-09-03  2:11 ` Zhihao Cheng
2025-09-05 14:56 ` Miquel Raynal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ldmxm1tu.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=chengzhihao1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    --cc=wangzhaolong@huaweicloud.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox