Re: [PATCH v3 8/8] md/raid10: fix IO error at logical block size granularity

Xiao Ni <[email protected]>
Newsgroups gmane.linux.raid,gmane.linux.kernel
Message-ID <CALTww2_cU_kMCROQFOri6LvaTGipe_tMgsBmkaJdahCFizDoTw@mail.gmail.com>
On Thu, Apr 16, 2026 at 11:51 AM <[email protected]> wrote:
>
> From: Li Nan <[email protected]>
>
> RAID10 currently fixes IO error at PAGE_SIZE granularity. Fix at smaller
> granularity can handle more errors, and RAID will support logical block
> sizes larger than PAGE_SIZE in the future, where PAGE_SIZE IO will fail.
>
> Switch IO error fix granularity to logical block size.
>
> Signed-off-by: Li Nan <[email protected]>
> Reviewed-by: Yu Kuai <[email protected]>
> ---
>  drivers/md/raid10.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 3638e00fe420..5b4ffd23211a 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2454,7 +2454,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio)
>  static void fix_recovery_read_error(struct r10bio *r10_bio)
>  {
>         /* We got a read error during recovery.
> -        * We repeat the read in smaller page-sized sections.
> +        * We repeat the read in smaller logical_block_sized sections.
>          * If a read succeeds, write it to the new device or record
>          * a bad block if we cannot.
>          * If a read fails, record a bad block on both old and
> @@ -2470,14 +2470,11 @@ static void fix_recovery_read_error(struct r10bio *r10_bio)
>         struct folio *folio = get_resync_folio(bio)->folio;
>
>         while (sectors) {
> -               int s = sectors;
> +               int s = min_t(int, sectors, mddev->logical_block_size >> 9);
>                 struct md_rdev *rdev;
>                 sector_t addr;
>                 int ok;
>
> -               if (s > (PAGE_SIZE>>9))
> -                       s = PAGE_SIZE >> 9;
> -
>                 rdev = conf->mirrors[dr].rdev;
>                 addr = r10_bio->devs[0].addr + sect;
>                 ok = sync_folio_io(rdev,
> @@ -2621,14 +2618,11 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
>         }
>
>         while(sectors) {
> -               int s = sectors;
> +               int s = min_t(int, sectors, mddev->logical_block_size >> 9);
>                 int sl = slot;
>                 int success = 0;
>                 int start;
>
> -               if (s > (PAGE_SIZE>>9))
> -                       s = PAGE_SIZE >> 9;
> -
>                 do {
>                         d = r10_bio->devs[sl].devnum;
>                         rdev = conf->mirrors[d].rdev;
> @@ -4926,13 +4920,10 @@ static int handle_reshape_read_error(struct mddev *mddev,
>         __raid10_find_phys(&conf->prev, r10b);
>
>         while (sectors) {
> -               int s = sectors;
> +               int s = min_t(int, sectors, mddev->logical_block_size >> 9);
>                 int success = 0;
>                 int first_slot = slot;
>
> -               if (s > (PAGE_SIZE >> 9))
> -                       s = PAGE_SIZE >> 9;
> -
>                 while (!success) {
>                         int d = r10b->devs[slot].devnum;
>                         struct md_rdev *rdev = conf->mirrors[d].rdev;
> --
> 2.39.2
>
>

This patch looks good to me.
Reviewed-by: Xiao Ni <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.