From: Yu Kuai <yukuai1@huaweicloud.com>
To: Song Liu <song@kernel.org>, Yu Kuai <yukuai1@huaweicloud.com>
Cc: xni@redhat.com, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
yangerkun@huawei.com, "yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH -next v2 3/7] md: delay choosing sync direction to md_start_sync()
Date: Wed, 16 Aug 2023 09:07:25 +0800 [thread overview]
Message-ID: <bd0a6f0f-2766-deb9-bbfd-5310d3f18e12@huaweicloud.com> (raw)
In-Reply-To: <CAPhsuW65Hxq=+D6M6zV8n+k4FarTHui=pSs2YPNKs9MYBD4MHA@mail.gmail.com>
Hi,
在 2023/08/15 23:54, Song Liu 写道:
> On Tue, Aug 15, 2023 at 2:00 PM Yu Kuai <yukuai1@huaweicloud.com> wrote:
> [...]
>>> +
>>> +not_running:
>>> + clear_bit(MD_RECOVERY_SYNC, &mddev->recovery);
>>> + clear_bit(MD_RECOVERY_RESHAPE, &mddev->recovery);
>>> + clear_bit(MD_RECOVERY_REQUESTED, &mddev->recovery);
>>> + clear_bit(MD_RECOVERY_CHECK, &mddev->recovery);
>>> + clear_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
>>> + mddev_unlock(mddev);
>>> +
>>> + wake_up(&resync_wait);
>>> + if (test_and_clear_bit(MD_RECOVERY_RECOVER, &mddev->recovery) &&
>>> + mddev->sysfs_action)
>>> + sysfs_notify_dirent_safe(mddev->sysfs_action);
>>> }
>>>
>>> /*
>>> @@ -9379,7 +9402,6 @@ void md_check_recovery(struct mddev *mddev)
>>> return;
>>>
>>> if (mddev_trylock(mddev)) {
>>> - int spares = 0;
>>> bool try_set_sync = mddev->safemode != 0;
>>>
>>> if (!mddev->external && mddev->safemode == 1)
>>> @@ -9467,29 +9489,11 @@ void md_check_recovery(struct mddev *mddev)
>>> clear_bit(MD_RECOVERY_DONE, &mddev->recovery);
>>>
>>> if (!test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) ||
>>> - test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
>>> - goto not_running;
>>> - if (!md_choose_sync_direction(mddev, &spares))
>>> - goto not_running;
>>> - if (mddev->pers->sync_request) {
>>> - if (spares) {
>>> - /* We are adding a device or devices to an array
>>> - * which has the bitmap stored on all devices.
>>> - * So make sure all bitmap pages get written
>>> - */
>>> - md_bitmap_write_all(mddev->bitmap);
>>> - }
>>> + test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) {
>>
>> Sorry that I made a mistake here while rebasing v2, here should be
>>
>> !test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)
>>
>> With this fixed, there are no new regression for mdadm tests using loop
>> devicein my VM.
>
> if (!test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) ||
> !test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) {
> queue_work(md_misc_wq, &mddev->sync_work);
> } else {
>
> This doesn't look right. Should we do
>
> if (test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) &&
> !test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) {
> queue_work(md_misc_wq, &mddev->sync_work);
> } else {
>
> instead?
>
Yes you're right, this is exactly what I did in v1, sorry that I keep
making mistake while rebasing.
Thanks,
Kuai
> Thanks,
> Song
> .
>
next prev parent reply other threads:[~2023-08-16 1:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 3:09 [PATCH -next v2 0/7] md: make rdev addition and removal independent from daemon thread Yu Kuai
2023-08-15 3:09 ` [PATCH -next v2 1/7] md: use separate work_struct for md_start_sync() Yu Kuai
2023-08-15 3:09 ` [PATCH -next v2 2/7] md: factor out a helper to choose sync direction from md_check_recovery() Yu Kuai
2023-08-17 7:58 ` Mariusz Tkaczyk
2023-08-17 21:49 ` Song Liu
2023-08-20 1:44 ` Yu Kuai
2023-08-15 3:09 ` [PATCH -next v2 3/7] md: delay choosing sync direction to md_start_sync() Yu Kuai
2023-08-15 6:00 ` Yu Kuai
2023-08-15 15:54 ` Song Liu
2023-08-16 1:07 ` Yu Kuai [this message]
2023-08-17 21:53 ` Song Liu
2023-08-20 1:45 ` Yu Kuai
2023-08-16 6:38 ` Xiao Ni
2023-08-20 2:04 ` Yu Kuai
2023-08-15 3:09 ` [PATCH -next v2 4/7] md: factor out a helper rdev_removeable() from remove_and_add_spares() Yu Kuai
2023-08-15 3:09 ` [PATCH -next v2 5/7] md: factor out a helper rdev_is_spare() " Yu Kuai
2023-08-15 3:09 ` [PATCH -next v2 6/7] md: factor out a helper rdev_addable() " Yu Kuai
2023-08-15 3:09 ` [PATCH -next v2 7/7] md: delay remove_and_add_spares() for read only array to md_start_sync() Yu Kuai
2023-08-16 7:18 ` Xiao Ni
2023-08-20 2:19 ` Yu Kuai
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=bd0a6f0f-2766-deb9-bbfd-5310d3f18e12@huaweicloud.com \
--to=yukuai1@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@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;
as well as URLs for NNTP newsgroup(s).