lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2d4c2350-f74d-4f4f-2bea-58dab8af2418@huaweicloud.com>
Date:   Wed, 23 Aug 2023 10:47:56 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     Xiao Ni <xni@...hat.com>, Yu Kuai <yukuai1@...weicloud.com>
Cc:     song@...nel.org, mariusz.tkaczyk@...ux.intel.com,
        linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        yi.zhang@...wei.com, yangerkun@...wei.com,
        "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH -next v3 5/7] md: factor out a helper rdev_is_spare() from
 remove_and_add_spares()

Hi,

在 2023/08/23 10:28, Xiao Ni 写道:
> On Wed, Aug 23, 2023 at 10:20 AM Xiao Ni <xni@...hat.com> wrote:
>>
>> On Sun, Aug 20, 2023 at 5:13 PM Yu Kuai <yukuai1@...weicloud.com> wrote:
>>>
>>> From: Yu Kuai <yukuai3@...wei.com>
>>>
>>> There are no functional changes, just to make the code simpler and
>>> prepare to delay remove_and_add_spares() to md_start_sync().
>>>
>>> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
>>> ---
>>>   drivers/md/md.c | 15 ++++++++++-----
>>>   1 file changed, 10 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>>> index ceace5ffadd6..11d27c934fdd 100644
>>> --- a/drivers/md/md.c
>>> +++ b/drivers/md/md.c
>>> @@ -9169,6 +9169,14 @@ static bool rdev_removeable(struct md_rdev *rdev)
>>>          return true;
>>>   }
>>>
>>> +static bool rdev_is_spare(struct md_rdev *rdev)
>>> +{
>>> +       return !test_bit(Candidate, &rdev->flags) && rdev->raid_disk >= 0 &&
>>> +              !test_bit(In_sync, &rdev->flags) &&
>>> +              !test_bit(Journal, &rdev->flags) &&
>>> +              !test_bit(Faulty, &rdev->flags);
>>> +}
>>> +
>>>   static int remove_and_add_spares(struct mddev *mddev,
>>>                                   struct md_rdev *this)
>>>   {
>>> @@ -9217,13 +9225,10 @@ static int remove_and_add_spares(struct mddev *mddev,
>>>          rdev_for_each(rdev, mddev) {
>>>                  if (this && this != rdev)
>>>                          continue;
>>> +               if (rdev_is_spare(rdev))
>>> +                       spares++;
>>>                  if (test_bit(Candidate, &rdev->flags))
>>>                          continue;
>>
>> Hi Kuai
>>
>> Why not put rdev_is_spare after testing Candidate?
>>
>> Best Regards
>> Xiao
> 
> I know the answer now, Because the next patch wants to put codes into
> the function rdev_addable

Yes, and thanks for the review!

Kuai
>>
>>> -               if (rdev->raid_disk >= 0 &&
>>> -                   !test_bit(In_sync, &rdev->flags) &&
>>> -                   !test_bit(Journal, &rdev->flags) &&
>>> -                   !test_bit(Faulty, &rdev->flags))
>>> -                       spares++;
>>>                  if (rdev->raid_disk >= 0)
>>>                          continue;
>>>                  if (test_bit(Faulty, &rdev->flags))
>>> --
>>> 2.39.2
>>>
> 
> Reviewed-by: Xiao Ni <xni@...hat.com>
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ