From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Zheng Qixing <zhengqixing@huaweicloud.com>
Cc: song@kernel.org, yukuai3@huawei.com, linan122@huawei.com,
linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, yangerkun@huawei.com, houtao1@huawei.com,
zhengqixing@huawei.com
Subject: Re: [PATCH v2 1/2] md: add helper rdev_needs_recovery()
Date: Tue, 12 Aug 2025 09:38:40 +0200 [thread overview]
Message-ID: <613fed75-efb7-46b8-8598-3b32f4f0b012@molgen.mpg.de> (raw)
In-Reply-To: <20250812021738.3722569-2-zhengqixing@huaweicloud.com>
Dear Zheng,
Thank you for your patch.
Am 12.08.25 um 04:17 schrieb Zheng Qixing:
> From: Zheng Qixing <zhengqixing@huawei.com>
>
> Add a helper for checking if an rdev needs recovery.
>
> Signed-off-by: Zheng Qixing <zhengqixing@huawei.com>
> ---
> drivers/md/md.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index ac85ec73a409..4ea956a80343 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -4835,6 +4835,16 @@ metadata_store(struct mddev *mddev, const char *buf, size_t len)
> static struct md_sysfs_entry md_metadata =
> __ATTR_PREALLOC(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store);
>
> +static bool rdev_needs_recovery(struct md_rdev *rdev, sector_t sectors)
> +{
> + if (!test_bit(Journal, &rdev->flags) &&
> + !test_bit(Faulty, &rdev->flags) &&
> + !test_bit(In_sync, &rdev->flags) &&
> + rdev->recovery_offset < sectors)
> + return true;
> + return false;
> +}
> +
> enum sync_action md_sync_action(struct mddev *mddev)
> {
> unsigned long recovery = mddev->recovery;
> @@ -8969,10 +8979,7 @@ static sector_t md_sync_position(struct mddev *mddev, enum sync_action action)
> rcu_read_lock();
> rdev_for_each_rcu(rdev, mddev)
> if (rdev->raid_disk >= 0 &&
> - !test_bit(Journal, &rdev->flags) &&
> - !test_bit(Faulty, &rdev->flags) &&
> - !test_bit(In_sync, &rdev->flags) &&
> - rdev->recovery_offset < start)
> + rdev_needs_recovery(rdev, start))
> start = rdev->recovery_offset;
> rcu_read_unlock();
>
> @@ -9333,10 +9340,7 @@ void md_do_sync(struct md_thread *thread)
> rdev_for_each_rcu(rdev, mddev)
> if (rdev->raid_disk >= 0 &&
> mddev->delta_disks >= 0 &&
> - !test_bit(Journal, &rdev->flags) &&
> - !test_bit(Faulty, &rdev->flags) &&
> - !test_bit(In_sync, &rdev->flags) &&
> - rdev->recovery_offset < mddev->curr_resync)
> + rdev_needs_recovery(rdev, mddev->curr_resync))
> rdev->recovery_offset = mddev->curr_resync;
> rcu_read_unlock();
> }
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Kind regards,
Paul
next prev parent reply other threads:[~2025-08-12 7:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 2:17 [PATCH v2 0/2] md: fix sync_action show Zheng Qixing
2025-08-12 2:17 ` [PATCH v2 1/2] md: add helper rdev_needs_recovery() Zheng Qixing
2025-08-12 7:38 ` Paul Menzel [this message]
2025-08-14 0:52 ` Yu Kuai
2025-08-14 1:24 ` Zheng Qixing
2025-08-12 2:17 ` [PATCH v2 2/2] md: fix sync_action incorrect display during resync Zheng Qixing
2025-08-12 9:22 ` Paul Menzel
2025-08-12 11:03 ` Zheng Qixing
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=613fed75-efb7-46b8-8598-3b32f4f0b012@molgen.mpg.de \
--to=pmenzel@molgen.mpg.de \
--cc=houtao1@huawei.com \
--cc=linan122@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--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
all inboxes | Powered by JetHome®