From: linan666@huaweicloud.com
To: axboe@kernel.dk, geliang.tang@suse.com, xni@redhat.com, colyli@suse.de
Cc: ira.weiny@intel.com, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, linan666@huaweicloud.com,
yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com,
yangerkun@huawei.com
Subject: [PATCH 4/4] badblocks: clean up prev_badblocks()
Date: Sat, 23 Dec 2023 14:37:28 +0800 [thread overview]
Message-ID: <20231223063728.3229446-5-linan666@huaweicloud.com> (raw)
In-Reply-To: <20231223063728.3229446-1-linan666@huaweicloud.com>
From: Li Nan <linan122@huawei.com>
The offset of 'lo' must <= ‘s' after biset. clean up redundant check.
And replace the check of badblocks->count with badblocks_empty().
Signed-off-by: Li Nan <linan122@huawei.com>
---
block/badblocks.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block/badblocks.c b/block/badblocks.c
index 71a3e43351da..88ed13897443 100644
--- a/block/badblocks.c
+++ b/block/badblocks.c
@@ -486,7 +486,7 @@ static int prev_badblocks(struct badblocks *bb, struct badblocks_context *bad,
int lo, hi;
u64 *p;
- if (!bb->count)
+ if (badblocks_empty(bb))
goto out;
if (hint >= 0) {
@@ -521,8 +521,7 @@ static int prev_badblocks(struct badblocks *bb, struct badblocks_context *bad,
hi = mid;
}
- if (BB_OFFSET(p[lo]) <= s)
- ret = lo;
+ ret = lo;
out:
return ret;
}
--
2.39.2
next prev parent reply other threads:[~2023-12-23 6:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-23 6:37 [PATCH 0/4] badblocks: bugfix and cleanup of _badblocks_check() linan666
2023-12-23 6:37 ` [PATCH 1/4] badblocks: goto out if find any unacked badblocks in _badblocks_check() linan666
2023-12-23 6:37 ` [PATCH 2/4] badblocks: optimize _badblocks_check() linan666
2023-12-23 6:37 ` [PATCH 3/4] badblocks: fix slab-out-of-bounds in _badblocks_check() linan666
2023-12-23 6:37 ` linan666 [this message]
2023-12-23 17:28 ` [PATCH 0/4] badblocks: bugfix and cleanup of _badblocks_check() Ira Weiny
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=20231223063728.3229446-5-linan666@huaweicloud.com \
--to=linan666@huaweicloud.com \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=geliang.tang@suse.com \
--cc=houtao1@huawei.com \
--cc=ira.weiny@intel.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xni@redhat.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@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