public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] btrfs: enable encoded read/write/send for bs > ps cases
@ 2025-11-10 22:41 Qu Wenruo
  2025-11-10 22:41 ` [PATCH v4 1/4] btrfs: make btrfs_csum_one_bio() handle bs > ps without large folios Qu Wenruo
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Qu Wenruo @ 2025-11-10 22:41 UTC (permalink / raw)
  To: linux-btrfs

[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/cover.1759984060.git.wqu@suse.com/

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(-)

-- 
2.51.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-12 16:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-10 22:41 [PATCH v4 0/4] btrfs: enable encoded read/write/send for bs > ps cases Qu Wenruo
2025-11-10 22:41 ` [PATCH v4 1/4] btrfs: make btrfs_csum_one_bio() handle bs > ps without large folios Qu Wenruo
2025-11-10 22:41 ` [PATCH v4 2/4] btrfs: make btrfs_repair_io_failure() handle bs > ps cases " Qu Wenruo
2025-11-10 22:42 ` [PATCH v4 3/4] btrfs: make read verification " Qu Wenruo
2025-11-10 22:42 ` [PATCH v4 4/4] btrfs: enable encoded read/write/send for bs > ps cases Qu Wenruo
2025-11-12 16:24 ` [PATCH v4 0/4] " David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox