Skip to content

btrfs: enable encoded read/write/send for bs > ps cases

Qu Wenruo linux-btrfs 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 1 replyIn review
  2. v34 patches 0 repliesSuperseded
  3. v24 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches3 repliesSuperseded

Changes in v4 from the cover letter

- Rebased to the latest for-next branch
The new async-csum is causing conflicts related to btrfs_csum_one_bio() and how to grab fs_info from compressed_bio.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4btrfs: make btrfs_csum_one_bio() handle bs > ps without large foliosfs/btrfs/btrfs_inode.h fs/btrfs/file-item.c fs/btrfs/inode.c+68 -260 replies
2/4btrfs: make btrfs_repair_io_failure() handle bs > ps cases without large foliosfs/btrfs/bio.c fs/btrfs/bio.h fs/btrfs/disk-io.c+75 -270 replies
3/4btrfs: make read verification handle bs > ps cases without large foliosfs/btrfs/bio.c fs/btrfs/btrfs_inode.h fs/btrfs/inode.c+52 -300 replies
4/4btrfs: enable encoded read/write/send for bs > ps casesfs/btrfs/bio.c fs/btrfs/compression.c fs/btrfs/ioctl.c +1 more+18 -440 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH v4 0/4] btrfs: enable encoded read/write/send for bs > ps cases

[CHANGELOG]
v4:
- Rebased to the latest for-next branch
The new async-csum is causing conflicts related to btrfs_csum_one_bio() and how to grab fs_info from compressed_bio.

v3:
- Fix a bug in btrfs_repair_eb_io_failure() for nodesize < ps cases In that case, we only need a single paddr slot, but a larger step (nodesize instead of sectorsize).
Add a new @step parameter to btrfs_repair_io_failure() to handle this special situation.

v2:
- Fix smatch warnings
Mostly remove any ASSERT()s checking returned value of bio_alloc().

- Fix a bug in the btrfs_add_compressed_bio_folios() Where the function still assumes large folios, but now we can have regular folios.

Previously encoded read/write/send is disabled for bs > ps cases, because they are either using regular pages or kvmallocated memories as buffer.

This means their buffers do not meet the folio size requirement (each folio much contain at least one fs block, no block can cross large folio boundries).

This series address the limits by allowing the following functionalities to support regular pages, without relying on large folios:

- Checksum calculation
Now instead of passing a single @paddr which is ensured to be inside a large folio, an array, paddrs[], is passed in.

For bs <= ps cases, it's still a single paddr.

For bs > ps cases, we can accept an array of multiple paddrs, that represents a single fs block.

- Read repair
Allow btrfs_repair_io_failure() to submit a bio with multiple incontiguous pages.

The same paddrs[] array building scheme.

But this time since we need to submit a bio with multiple bvecs, we can no longer use the current on-stack bio.

This also brings a small improvement for metadata read-repair, we can submit the whole metadata block in one go.

- Comprssed bio folios submission
Now the function btrfs_add_compressed_bio_folios() can handle both large and regular folios, even handling different sized folios in the array.

- Read verification
Just build the paddrs[] array for bs > ps cases and pass the array into btrfs_calculate_block_csum_folio().

Unfortunately since there is no reliable on-stack VLA support, we have to pay the extra on-stack memory (128 bytes for x86_64, or 8 bytes for 64K page sized systems) everywhere, even if 99% of the cases our block size is no larger than page size.

The remaining part of full bs > ps support is:

- Direct IO support for bs > ps
This depends on a patch that is going through iomap/vfs tree instead. Thus that part will only go through the v6.19 cycle

- RAID56 support
Which depends on the follow series which reduces btrfs_raid_bio size:
https://lore.kernel.org/linux-btrfs/[email protected]/

Qu Wenruo (4):
btrfs: make btrfs_csum_one_bio() handle bs > ps without large folios
btrfs: make btrfs_repair_io_failure() handle bs > ps cases without
large folios
btrfs: make read verification handle bs > ps cases without large
folios
btrfs: enable encoded read/write/send for bs > ps cases

 fs/btrfs/bio.c         | 140 +++++++++++++++++++++++++++++------------
 fs/btrfs/bio.h         |   5 +-
 fs/btrfs/btrfs_inode.h |   8 ++-
 fs/btrfs/compression.c |  10 +--
 fs/btrfs/disk-io.c     |  29 +++++----
 fs/btrfs/file-item.c   |  15 ++++-
 fs/btrfs/inode.c       |  91 ++++++++++++++++++---------
 fs/btrfs/ioctl.c       |  21 -------
 fs/btrfs/send.c        |   9 +--
 9 files changed, 207 insertions(+), 121 deletions(-)
Signature · 1 line
2.51.2