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: <eca236bc-27de-887a-4339-5a73ed045aca@huaweicloud.com>
Date: Thu, 2 Jan 2025 09:21:05 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Xiao Ni <xni@...hat.com>, yukuai@...nel.org
Cc: song@...nel.org, 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 v2 md-6.14 4/5] md/raid5: implement pers->bitmap_sector()

Hi,

在 2025/01/01 13:36, Xiao Ni 写道:
> On Wed, Dec 18, 2024 at 8:22 PM <yukuai@...nel.org> wrote:
>>
>> From: Yu Kuai <yukuai3@...wei.com>
>>
>> Bitmap is used for the whole array for raid1/raid10, hence IO for the
>> array can be used directly for bitmap. However, bitmap is used for
>> underlying disks for raid5, hence IO for the array can't be used
>> directly for bitmap.
>>
>> Implement pers->bitmap_sector() for raid5 to convert IO ranges from the
>> array to the underlying disks.
>>
>> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
>> Signed-off-by: Yu Kuai <yukuai@...nel.org>
>> ---
>>   drivers/md/raid5.c | 20 ++++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
>> index 6eb2841ce28c..b2fe201b599d 100644
>> --- a/drivers/md/raid5.c
>> +++ b/drivers/md/raid5.c
>> @@ -2950,6 +2950,23 @@ static void raid5_error(struct mddev *mddev, struct md_rdev *rdev)
>>          r5c_update_on_rdev_error(mddev, rdev);
>>   }
>>
>> +static void raid5_bitmap_sector(struct mddev *mddev, sector_t *offset,
>> +                               unsigned long *sectors)
>> +{
>> +       struct r5conf *conf = mddev->private;
>> +       int sectors_per_chunk = conf->chunk_sectors * (conf->raid_disks -
>> +                                                      conf->max_degraded);
>> +       sector_t start = *offset;
>> +       sector_t end = start + *sectors;
>> +       int dd_idx;
>> +
>> +       start = round_down(start, sectors_per_chunk);
>> +       end = round_up(end, sectors_per_chunk);
>> +
>> +       *offset = raid5_compute_sector(conf, start, 0, &dd_idx, NULL);
>> +       *sectors = raid5_compute_sector(conf, end, 0, &dd_idx, NULL) - *offset;
>> +}
> 
> Hi Kuai
> 
> This function needs to think about reshape like make_stripe_request does.
> 

Yes, we need to handle reshape. However, we can't retry like
make_stripe_request(). I guess I'll compute sector for both before
reshape and after reshape, and set the bits together.

Thanks,
Kuai

> Regards
> Xiao
>> +
>>   /*
>>    * Input: a 'big' sector number,
>>    * Output: index of the data and parity disk, and the sector # in them.
>> @@ -8972,6 +8989,7 @@ static struct md_personality raid6_personality =
>>          .takeover       = raid6_takeover,
>>          .change_consistency_policy = raid5_change_consistency_policy,
>>          .prepare_suspend = raid5_prepare_suspend,
>> +       .bitmap_sector  = raid5_bitmap_sector,
>>   };
>>   static struct md_personality raid5_personality =
>>   {
>> @@ -8997,6 +9015,7 @@ static struct md_personality raid5_personality =
>>          .takeover       = raid5_takeover,
>>          .change_consistency_policy = raid5_change_consistency_policy,
>>          .prepare_suspend = raid5_prepare_suspend,
>> +       .bitmap_sector  = raid5_bitmap_sector,
>>   };
>>
>>   static struct md_personality raid4_personality =
>> @@ -9023,6 +9042,7 @@ static struct md_personality raid4_personality =
>>          .takeover       = raid4_takeover,
>>          .change_consistency_policy = raid5_change_consistency_policy,
>>          .prepare_suspend = raid5_prepare_suspend,
>> +       .bitmap_sector  = raid5_bitmap_sector,
>>   };
>>
>>   static int __init raid5_init(void)
>> --
>> 2.43.0
>>
>>
> 
> .
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ