Skip to content

btrfs: add raid56 support for bs > ps cases

Qu Wenruo linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12btrfs: add an overview for the btrfs_raid_bio structurefs/btrfs/raid56.h+71 -00 replies
2/12btrfs: introduce a new parameter to locate a sectorfs/btrfs/raid56.c fs/btrfs/raid56.h+80 -340 replies
3/12btrfs: prepare generate_pq_vertical() for bs > ps casesfs/btrfs/raid56.c+70 -220 replies
4/12btrfs: prepare recover_vertical() to support bs > ps casesfs/btrfs/raid56.c+68 -730 replies
5/12btrfs: prepare verify_one_sector() to support bs > ps casesfs/btrfs/raid56.c+49 -60 replies
6/12btrfs: prepare verify_bio_data_sectors() to support bs > ps casesfs/btrfs/raid56.c+18 -80 replies
7/12btrfs: prepare set_bio_pages_uptodate() to support bs > ps casesfs/btrfs/raid56.c+13 -70 replies
8/12btrfs: prepare steal_rbio() to support bs > ps casesfs/btrfs/raid56.c+44 -130 replies
9/12btrfs: prepare rbio_bio_add_io_paddr() to support bs > ps casesfs/btrfs/raid56.c+65 -410 replies
10/12btrfs: prepare finish_parity_scrub() to support bs > ps casesfs/btrfs/raid56.c+86 -890 replies
11/12btrfs: enable bs > ps support for raid56fs/btrfs/disk-io.c fs/btrfs/raid56.c+6 -110 replies
12/12btrfs: remove the "_step" infixfs/btrfs/raid56.c+15 -150 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/12] btrfs: add raid56 support for bs > ps cases

[OVERVIEW]
This series add the missing raid56 support for the experimental bs > ps support.

The main challenge here is the conflicts between RAID56 RMW/recovery and data checksum.

For RAID56 RMW/recovery, the vertical stripe can only be mapped one page one time, as the upper layer can pass bios that are not backed by large folios (direct IO, encoded read/write/send).

On the other hand, data checksum requires multiple pages at the same time, e.g. btrfs_calculate_block_csum_pages().

To meet both requirements, introduce a new unit, step, which is min(PAGE_SIZE, sectorsize), and make the paddrs[] arrays in RAID56 to be in step sizes.

So for vertical stripe related works, reduce the map size from one sector to one step. For data checksum verification grab the pointer from involved paddrs[] array and pass the sub-array into btrfs_calculate_block_csum_pages().

So before the patchset, the btrfs_raid_bio paddr pointers looks like this:

16K page size, 4K fs block size (aka, subpage case)

                       0                   16K  ...
  stripe_pages[]:      |                   |    ...
  stripe_paddrs[]:     0    1    2    3    4    ...
  fs blocks            |<-->|<-->|<-->|<-->|    ...

There are at least one fs block (sector) inside a page, and each paddrs[] entry represents an fs block 1:1.

To the new structure for bs > ps support:

4K page size, 8K fs block size

                       0    4k   8K   12K   16K  ...
  stripe_pages[]:      |    |    |    |    |     ...
  stripe_paddrs[]:     0    1    2    3    4     ...
  fs blocks            |<------->|<------->|     ...

Now paddrs[] entry is no longer 1:1 mapped to an fs block, but multiple paddrs mapped to one fs block.

The glue unit between paddrs[] and fs blocks is a step.

One fs blocks can one or more steps, and one step maps to a paddr[] entry 1:1.

For bs <= ps cases, one step is the same as an fs block. For bs > ps case, one step is just a page.

For RAID56, now we need one extra step iteration loop when handling an fs block.

[TESTING]
I have tested the following combinations:

- bs=4k ps=4k x86_64
- bs=4k ps=64k arm64
The base line to ensure no regression caused by this patchset for bs == ps and bs < ps cases.

- bs=8k ps=4k x86_64
The new run for this series.

The only new failure is related to direct IO read verification, which is a known one caused by no direct IO support for bs > ps cases.

I'm afraid in the long run, the combination matrix will be larger than larger, and I'm not sure if my environment can handle all the extra bs/ps combinations.

The long term plan is to test bs=4k ps=4k, bs=4k ps=64k, bs=8k ps=4k cases only.

[PATCHSET LAYOUT]
Patch 1 introduces an overview of how btrfs_raid_bio structure works.
Patch 2~10 starts converting t he existing infrastructures to use the new step based paddr pointers.
Patch 11 enables RAID56 for bs > ps cases, which is still an experimental feature.
The last patch removes the "_step" infix which is used as a temporary naming during the work.

[ROADMAP FOR BS > PS SUPPORT]
The remaining feature not yet implemented for bs > ps cases is direct IO. The needed patch in iomap is submitted through VFS/iomap tree, and the btrfs part is a very tiny patch, will be submitted during v6.19 cycle.

Qu Wenruo (12):
btrfs: add an overview for the btrfs_raid_bio structure
btrfs: introduce a new parameter to locate a sector
btrfs: prepare generate_pq_vertical() for bs > ps cases
btrfs: prepare recover_vertical() to support bs > ps cases
btrfs: prepare verify_one_sector() to support bs > ps cases
btrfs: prepare verify_bio_data_sectors() to support bs > ps cases
btrfs: prepare set_bio_pages_uptodate() to support bs > ps cases
btrfs: prepare steal_rbio() to support bs > ps cases
btrfs: prepare rbio_bio_add_io_paddr() to support bs > ps cases
btrfs: prepare finish_parity_scrub() to support bs > ps cases
btrfs: enable bs > ps support for raid56
btrfs: remove the "_step" infix

 fs/btrfs/disk-io.c |   6 -
 fs/btrfs/raid56.c  | 711 ++++++++++++++++++++++++++++-----------------
 fs/btrfs/raid56.h  |  87 ++++++
 3 files changed, 535 insertions(+), 269 deletions(-)
Signature · 1 line
2.51.2