From: Zheng Qixing <zhengqixing@huaweicloud.com>
To: Yu Kuai <yukuai1@huaweicloud.com>, song@kernel.org, linan122@huawei.com
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, yangerkun@huawei.com, houtao1@huawei.com,
zhengqixing@huawei.com, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v2 1/2] md: add helper rdev_needs_recovery()
Date: Thu, 14 Aug 2025 09:24:50 +0800 [thread overview]
Message-ID: <a0026dc7-03a2-4281-881f-abb2421a9ede@huaweicloud.com> (raw)
In-Reply-To: <258db10c-f80f-5975-d879-ec0d16f1db6e@huaweicloud.com>
Hi,
在 2025/8/14 8:52, Yu Kuai 写道:
> Hi,
>
> 在 2025/08/12 10:17, 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;
> return directly:
>
> return !test_bit(Journal, &rdev->flags) &&
> !test_bit(Faulty, &rdev->flags) &&
> !test_bit(In_sync, &rdev->flags) &&
> rdev->recovery_offset < sectors);
>
Okay.
Thanks,
Qixing
> Otherwise, feel free to add
> Reviewed-by: Yu Kuai <yukuai3@huawei.com>
>
> Kuai
>
>> +}
>> +
>> 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();
>> }
>>
next prev parent reply other threads:[~2025-08-14 1:24 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
2025-08-14 0:52 ` Yu Kuai
2025-08-14 1:24 ` Zheng Qixing [this message]
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=a0026dc7-03a2-4281-881f-abb2421a9ede@huaweicloud.com \
--to=zhengqixing@huaweicloud.com \
--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=yukuai1@huaweicloud.com \
--cc=yukuai3@huawei.com \
--cc=zhengqixing@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;
as well as URLs for NNTP newsgroup(s).