From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Zheng Qixing <zhengqixing@huaweicloud.com>,
axboe@kernel.dk, song@kernel.org, colyli@kernel.org,
yukuai3@huawei.com, dan.j.williams@intel.com,
vishal.l.verma@intel.com, dave.jiang@intel.com,
ira.weiny@intel.com, dlemoal@kernel.org, kch@nvidia.com,
hare@suse.de, zhengqixing@huawei.com, john.g.garry@oracle.com,
geliang@kernel.org, xni@redhat.com, colyli@suse.de
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-raid@vger.kernel.org, nvdimm@lists.linux.dev,
yi.zhang@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH 06/12] badblocks: fix the using of MAX_BADBLOCKS
Date: Fri, 21 Feb 2025 11:09:35 +0100 [thread overview]
Message-ID: <f8ad5677-5fc9-468e-a888-8cd55c3a37d7@linux.dev> (raw)
In-Reply-To: <20250221081109.734170-7-zhengqixing@huaweicloud.com>
On 21.02.25 09:11, Zheng Qixing wrote:
> From: Li Nan <linan122@huawei.com>
>
> The number of badblocks cannot exceed MAX_BADBLOCKS, but it should be
> allowed to equal MAX_BADBLOCKS.
>
> Fixes: aa511ff8218b ("badblocks: switch to the improved badblock handling code")
> Signed-off-by: Li Nan <linan122@huawei.com>
> ---
> block/badblocks.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/badblocks.c b/block/badblocks.c
> index a953d2e9417f..87267bae6836 100644
> --- a/block/badblocks.c
> +++ b/block/badblocks.c
> @@ -700,7 +700,7 @@ static bool can_front_overwrite(struct badblocks *bb, int prev,
> *extra = 2;
> }
>
> - if ((bb->count + (*extra)) >= MAX_BADBLOCKS)
> + if ((bb->count + (*extra)) > MAX_BADBLOCKS)
> return false;
In this commit,
commit c3c6a86e9efc5da5964260c322fe07feca6df782
Author: Coly Li <colyli@suse.de>
Date: Sat Aug 12 01:05:08 2023 +0800
badblocks: add helper routines for badblock ranges handling
This patch adds several helper routines to improve badblock ranges
handling. These helper routines will be used later in the improved
version of badblocks_set()/badblocks_clear()/badblocks_check().
- Helpers prev_by_hint() and prev_badblocks() are used to find the bad
range from bad table which the searching range starts at or after.
The above is changed to MAX_BADBLOCKS. Thus, perhaps, the Fixes tag
should include the above commit?
Except that, I am fine with this commit.
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Zhu Yanjun
>
> return true;
> @@ -1135,7 +1135,7 @@ static int _badblocks_clear(struct badblocks *bb, sector_t s, int sectors)
> if ((BB_OFFSET(p[prev]) < bad.start) &&
> (BB_END(p[prev]) > (bad.start + bad.len))) {
> /* Splitting */
> - if ((bb->count + 1) < MAX_BADBLOCKS) {
> + if ((bb->count + 1) <= MAX_BADBLOCKS) {
> len = front_splitting_clear(bb, prev, &bad);
> bb->count += 1;
> cleared++;
--
Best Regards,
Yanjun.Zhu
next prev parent reply other threads:[~2025-02-21 10:09 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-21 8:10 [PATCH 00/12] badblocks: bugfix and cleanup for badblocks Zheng Qixing
2025-02-21 8:10 ` [PATCH 01/12] badblocks: Fix error shitf ops Zheng Qixing
2025-02-21 9:05 ` Yu Kuai
2025-02-21 9:58 ` Coly Li
2025-02-21 8:10 ` [PATCH 02/12] badblocks: factor out a helper try_adjacent_combine Zheng Qixing
2025-02-21 9:07 ` Yu Kuai
2025-02-21 10:04 ` Coly Li
2025-02-21 10:06 ` Coly Li
2025-02-21 8:11 ` [PATCH 03/12] badblocks: attempt to merge adjacent badblocks during ack_all_badblocks Zheng Qixing
2025-02-21 9:12 ` Yu Kuai
2025-02-21 10:08 ` Coly Li
2025-02-21 8:11 ` [PATCH 04/12] badblocks: return error directly when setting badblocks exceeds 512 Zheng Qixing
2025-02-21 9:55 ` Yu Kuai
2025-02-25 9:13 ` Li Nan
2025-02-21 8:11 ` [PATCH 05/12] badblocks: return error if any badblock set fails Zheng Qixing
2025-02-21 9:52 ` Coly Li
2025-02-21 10:09 ` Yu Kuai
2025-02-21 10:12 ` Coly Li
2025-02-22 1:12 ` Yu Kuai
2025-02-22 6:16 ` Coly Li
2025-02-25 9:12 ` Li Nan
2025-02-22 6:18 ` Coly Li
2025-02-21 8:11 ` [PATCH 06/12] badblocks: fix the using of MAX_BADBLOCKS Zheng Qixing
2025-02-21 10:09 ` Zhu Yanjun [this message]
2025-02-25 9:14 ` Li Nan
2025-02-21 10:22 ` Coly Li
2025-02-22 1:15 ` Yu Kuai
2025-02-21 8:11 ` [PATCH 07/12] badblocks: try can_merge_front before overlap_front Zheng Qixing
2025-02-22 1:14 ` Yu Kuai
2025-02-21 8:11 ` [PATCH 08/12] badblocks: fix merge issue when new badblocks align with pre+1 Zheng Qixing
2025-02-22 1:21 ` Yu Kuai
2025-02-21 8:11 ` [PATCH 09/12] badblocks: fix missing bad blocks on retry in _badblocks_check() Zheng Qixing
2025-02-21 10:27 ` Coly Li
2025-02-22 1:28 ` Yu Kuai
2025-02-21 8:11 ` [PATCH 10/12] badblocks: return boolen from badblocks_set() and badblocks_clear() Zheng Qixing
2025-02-22 1:26 ` Yu Kuai
2025-02-22 4:32 ` Paul Menzel
2025-02-22 4:36 ` Paul Menzel
2025-02-22 6:20 ` Coly Li
2025-02-21 8:11 ` [PATCH 11/12] md: improve return types of badblocks handling functions Zheng Qixing
2025-02-22 1:27 ` Yu Kuai
2025-02-21 8:11 ` [PATCH 12/12] badblocks: use sector_t instead of int to avoid truncation of badblocks length Zheng Qixing
2025-02-21 10:37 ` Coly Li
2025-02-22 1:43 ` Yu Kuai
2025-02-21 9:00 ` [PATCH 00/12] badblocks: bugfix and cleanup for badblocks Yu Kuai
2025-02-21 11:52 ` Coly Li
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=f8ad5677-5fc9-468e-a888-8cd55c3a37d7@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=axboe@kernel.dk \
--cc=colyli@kernel.org \
--cc=colyli@suse.de \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dlemoal@kernel.org \
--cc=geliang@kernel.org \
--cc=hare@suse.de \
--cc=ira.weiny@intel.com \
--cc=john.g.garry@oracle.com \
--cc=kch@nvidia.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=song@kernel.org \
--cc=vishal.l.verma@intel.com \
--cc=xni@redhat.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
--cc=zhengqixing@huawei.com \
--cc=zhengqixing@huaweicloud.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