diff mbox series

raid5: fix duplicate checks for rdev->saved_raid_disk

Message ID 20220707090834.1881470-1-liu.yun@linux.dev (mailing list archive)
State New, archived
Headers show
Series raid5: fix duplicate checks for rdev->saved_raid_disk | expand

Commit Message

Jackie Liu July 7, 2022, 9:08 a.m. UTC
From: Jackie Liu <liuyun01@kylinos.cn>

'first' will always be greater than or equal to 0, it is unnecessary to
repeat the 0 check, clean it up.

Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
 drivers/md/raid5.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Song Liu July 15, 2022, 9:37 p.m. UTC | #1
On Thu, Jul 7, 2022 at 2:09 AM Jackie Liu <liu.yun@linux.dev> wrote:
>
> From: Jackie Liu <liuyun01@kylinos.cn>
>
> 'first' will always be greater than or equal to 0, it is unnecessary to
> repeat the 0 check, clean it up.
>
> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>

For some reason, the patch won't apply. Could you please resend?

Thanks,
Song

> ---
>  drivers/md/raid5.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 20e53b167f81..a0b38a0ea9c3 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -8063,8 +8063,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev)
>          * find the disk ... but prefer rdev->saved_raid_disk
>          * if possible.
>          */
> -       if (rdev->saved_raid_disk >= 0 &&
> -           rdev->saved_raid_disk >= first &&
> +       if (rdev->saved_raid_disk >= first &&
>             rdev->saved_raid_disk <= last &&
>             conf->disks[rdev->saved_raid_disk].rdev == NULL)
>                 first = rdev->saved_raid_disk;
> --
> 2.25.1
>
Jackie Liu July 16, 2022, 3:09 a.m. UTC | #2
在 2022/7/16 05:37, Song Liu 写道:
> On Thu, Jul 7, 2022 at 2:09 AM Jackie Liu <liu.yun@linux.dev> wrote:
>>
>> From: Jackie Liu <liuyun01@kylinos.cn>
>>
>> 'first' will always be greater than or equal to 0, it is unnecessary to
>> repeat the 0 check, clean it up.
>>
>> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
> 
> For some reason, the patch won't apply. Could you please resend?

OK.

--
Jackie Liu

> 
> Thanks,
> Song
> 
>> ---
>>   drivers/md/raid5.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
>> index 20e53b167f81..a0b38a0ea9c3 100644
>> --- a/drivers/md/raid5.c
>> +++ b/drivers/md/raid5.c
>> @@ -8063,8 +8063,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev)
>>           * find the disk ... but prefer rdev->saved_raid_disk
>>           * if possible.
>>           */
>> -       if (rdev->saved_raid_disk >= 0 &&
>> -           rdev->saved_raid_disk >= first &&
>> +       if (rdev->saved_raid_disk >= first &&
>>              rdev->saved_raid_disk <= last &&
>>              conf->disks[rdev->saved_raid_disk].rdev == NULL)
>>                  first = rdev->saved_raid_disk;
>> --
>> 2.25.1
>>
diff mbox series

Patch

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 20e53b167f81..a0b38a0ea9c3 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8063,8 +8063,7 @@  static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev)
 	 * find the disk ... but prefer rdev->saved_raid_disk
 	 * if possible.
 	 */
-	if (rdev->saved_raid_disk >= 0 &&
-	    rdev->saved_raid_disk >= first &&
+	if (rdev->saved_raid_disk >= first &&
 	    rdev->saved_raid_disk <= last &&
 	    conf->disks[rdev->saved_raid_disk].rdev == NULL)
 		first = rdev->saved_raid_disk;