[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW5eMz4s+x4zWx75wUkkzztEYVnmBYUv7rza0bJQRWC+6g@mail.gmail.com>
Date: Thu, 9 Jan 2025 10:36:49 -0800
From: Song Liu <song@...nel.org>
To: Yu Kuai <yukuai1@...weicloud.com>
Cc: xni@...hat.com, yukuai3@...wei.com, linux-raid@...r.kernel.org,
linux-kernel@...r.kernel.org, yi.zhang@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH v2 md-6.14 4/5] md/raid5: implement pers->bitmap_sector()
On Wed, Jan 8, 2025 at 5:56 PM Yu Kuai <yukuai1@...weicloud.com> 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>
> ---
> drivers/md/raid5.c | 145 ++++++++++++++++++++++++++++++---------------
> 1 file changed, 98 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index a5a619400d8f..5377f4c3fffc 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -63,6 +63,13 @@
>
> #define RAID5_MAX_REQ_STRIPES 256
>
> +enum reshape_loc {
> + LOC_NO_RESHAPE,
> + LOC_AHEAD_OF_RESHAPE,
> + LOC_INSIDE_RESHAPE,
> + LOC_BEHIND_RESHAPE,
> +};
> +
It is unnecessary to move this enum definition and some functions.
I moved them back.
Thanks,
Song
> static bool devices_handle_discard_safely = false;
> module_param(devices_handle_discard_safely, bool, 0644);
> MODULE_PARM_DESC(devices_handle_discard_safely,
> @@ -2947,6 +2954,94 @@ static void raid5_error(struct mddev *mddev, struct md_rdev *rdev)
> r5c_update_on_rdev_error(mddev, rdev);
> }
>
> +static bool ahead_of_reshape(struct mddev *mddev, sector_t sector,
> + sector_t reshape_sector)
> +{
> + return mddev->reshape_backwards ? sector < reshape_sector :
> + sector >= reshape_sector;
> +}
> +
> +static bool range_ahead_of_reshape(struct mddev *mddev, sector_t min,
> + sector_t max, sector_t reshape_sector)
> +{
> + return mddev->reshape_backwards ? max < reshape_sector :
> + min >= reshape_sector;
> +}
> +
[...]
> +static enum reshape_loc get_reshape_loc(struct mddev *mddev,
> + struct r5conf *conf, sector_t logical_sector)
> +{
> + sector_t reshape_progress, reshape_safe;
> + /*
Powered by blists - more mailing lists