[PATCH v2 00/14] folio support for sync I/O in RAID

linan666@huaweicloud.com posted 14 patches 1 week, 2 days ago
drivers/md/md.h       |   2 +
drivers/md/raid1.h    |   2 +-
drivers/md/raid10.h   |   2 +-
drivers/md/md.c       |  29 +++-
drivers/md/raid1-10.c |  81 ++++-------
drivers/md/raid1.c    | 233 ++++++++++++++-----------------
drivers/md/raid10.c   | 315 ++++++++++++++++++++----------------------
7 files changed, 308 insertions(+), 356 deletions(-)
[PATCH v2 00/14] folio support for sync I/O in RAID
Posted by linan666@huaweicloud.com 1 week, 2 days ago
From: Li Nan <linan122@huawei.com>

This patchset adds folio support to sync operations in raid1/10.
Previously, we used 16 * 4K pages for 64K sync I/O. With this change,
we'll use a single 64K folio instead. Using folios reduces
resync/recovery time by 20% on HDD.

This is the first step towards full folio support in RAID. Going forward,
I will replace the remaining page-based usage with folio.

The patchset was tested with mdadm. Additional fault injection stress tests
were run under file systems.

v2:
 - Remove patch "md: use folio for bb_folio". It will be included in
   a later patch set
 - In patch 5:
    1) fix typo
    2) rewrite the logic of copying data in process_checks()
    3) rename resync_get_all_folio() to resync_get_folio()
    4) s/resync_pages *rps/resync_folio *rfs/g in
       raid1_alloc_init_r1buf() and raid10_alloc_init_r10buf()
 - Subsequent patches: Adapting conflicts caused by patch 5

Li Nan (14):
  md/raid1,raid10: clean up of RESYNC_SECTORS
  md: introduce sync_folio_io for folio support in RAID
  md/raid1: use folio for tmppage
  md/raid10: use folio for tmppage
  md/raid1,raid10: use folio for sync path IO
  md: Clean up folio sync support related code
  md/raid1: clean up useless sync_blocks handling in raid1_sync_request
  md/raid1: fix IO error at logical block size granularity
  md/raid10: fix IO error at logical block size granularity
  md/raid1,raid10: clean up resync_fetch_folio
  md: clean up resync_free_folio
  md/raid1: clean up sync IO size calculation in raid1_sync_request
  md/raid10: clean up sync IO size calculation in raid10_sync_request
  md/raid1,raid10: fall back to smaller order if sync folio alloc fails

 drivers/md/md.h       |   2 +
 drivers/md/raid1.h    |   2 +-
 drivers/md/raid10.h   |   2 +-
 drivers/md/md.c       |  29 +++-
 drivers/md/raid1-10.c |  81 ++++-------
 drivers/md/raid1.c    | 233 ++++++++++++++-----------------
 drivers/md/raid10.c   | 315 ++++++++++++++++++++----------------------
 7 files changed, 308 insertions(+), 356 deletions(-)

-- 
2.39.2
Re: [PATCH v2 00/14] folio support for sync I/O in RAID
Posted by Yu Kuai 2 days, 12 hours ago
Hi,

在 2026/1/28 15:56, linan666@huaweicloud.com 写道:
> From: Li Nan <linan122@huawei.com>
>
> This patchset adds folio support to sync operations in raid1/10.
> Previously, we used 16 * 4K pages for 64K sync I/O. With this change,
> we'll use a single 64K folio instead. Using folios reduces
> resync/recovery time by 20% on HDD.
>
> This is the first step towards full folio support in RAID. Going forward,
> I will replace the remaining page-based usage with folio.
>
> The patchset was tested with mdadm. Additional fault injection stress tests
> were run under file systems.

For conclusion, I think you can send patch 1,8,9 first, they're not quite
related to folio and can be applied. Then, please move patch 12,13 before patch 5
in the separate patch set, and looks like the number of patches can be small.

BTW, there are still pages in other context, do you plan to convert them?

>
> v2:
>   - Remove patch "md: use folio for bb_folio". It will be included in
>     a later patch set
>   - In patch 5:
>      1) fix typo
>      2) rewrite the logic of copying data in process_checks()
>      3) rename resync_get_all_folio() to resync_get_folio()
>      4) s/resync_pages *rps/resync_folio *rfs/g in
>         raid1_alloc_init_r1buf() and raid10_alloc_init_r10buf()
>   - Subsequent patches: Adapting conflicts caused by patch 5
>
> Li Nan (14):
>    md/raid1,raid10: clean up of RESYNC_SECTORS
>    md: introduce sync_folio_io for folio support in RAID
>    md/raid1: use folio for tmppage
>    md/raid10: use folio for tmppage
>    md/raid1,raid10: use folio for sync path IO
>    md: Clean up folio sync support related code
>    md/raid1: clean up useless sync_blocks handling in raid1_sync_request
>    md/raid1: fix IO error at logical block size granularity
>    md/raid10: fix IO error at logical block size granularity
>    md/raid1,raid10: clean up resync_fetch_folio
>    md: clean up resync_free_folio
>    md/raid1: clean up sync IO size calculation in raid1_sync_request
>    md/raid10: clean up sync IO size calculation in raid10_sync_request
>    md/raid1,raid10: fall back to smaller order if sync folio alloc fails
>
>   drivers/md/md.h       |   2 +
>   drivers/md/raid1.h    |   2 +-
>   drivers/md/raid10.h   |   2 +-
>   drivers/md/md.c       |  29 +++-
>   drivers/md/raid1-10.c |  81 ++++-------
>   drivers/md/raid1.c    | 233 ++++++++++++++-----------------
>   drivers/md/raid10.c   | 315 ++++++++++++++++++++----------------------
>   7 files changed, 308 insertions(+), 356 deletions(-)
>
-- 
Thansk,
Kuai
Re: [PATCH v2 00/14] folio support for sync I/O in RAID
Posted by Li Nan 1 day, 16 hours ago

在 2026/2/5 1:02, Yu Kuai 写道:
> Hi,
> 
> 在 2026/1/28 15:56, linan666@huaweicloud.com 写道:
>> From: Li Nan <linan122@huawei.com>
>>
>> This patchset adds folio support to sync operations in raid1/10.
>> Previously, we used 16 * 4K pages for 64K sync I/O. With this change,
>> we'll use a single 64K folio instead. Using folios reduces
>> resync/recovery time by 20% on HDD.
>>
>> This is the first step towards full folio support in RAID. Going forward,
>> I will replace the remaining page-based usage with folio.
>>
>> The patchset was tested with mdadm. Additional fault injection stress tests
>> were run under file systems.
> 
> For conclusion, I think you can send patch 1,8,9 first, they're not quite

Hi, kuai

Thanks for your review.

In handle_reshape_read_error(), if fix error in lbs before folio, we need
to consider 'idx' of page and offset in page, which make logical become 
complex. I prefer making the change after folio , how do you think?

> related to folio and can be applied. Then, please move patch 12,13 before patch 5

Patches 12,13 only make sense after folio support. Cleanup before folio
offers little benefit. I will merge them directly into patch 5.

> in the separate patch set, and looks like the number of patches can be small.
> 
> BTW, there are still pages in other context, do you plan to convert them?
> 

Yes, there are still many page usages in bitmap and RAID5. I will continue
folio support work with this series as a reference after it is applied.

-- 
Thanks,
Nan