From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/4] btrfs: enable encoded read/write/send for bs > ps cases
Date: Wed, 1 Oct 2025 19:20:04 +0930 [thread overview]
Message-ID: <cover.1759311100.git.wqu@suse.com> (raw)
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.
- 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.
Another thing is, even with all those support, direct IO is still not
supported.
The problem is iomap can still split the bio between pages, breaking our
bio size requirement (still have to be block aligned).
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 | 2 +-
fs/btrfs/btrfs_inode.h | 8 ++-
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 +--
8 files changed, 200 insertions(+), 115 deletions(-)
--
2.50.1
next reply other threads:[~2025-10-01 9:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-01 9:50 Qu Wenruo [this message]
2025-10-01 9:50 ` [PATCH 1/4] btrfs: make btrfs_csum_one_bio() handle bs > ps without large folios Qu Wenruo
2025-10-01 9:50 ` [PATCH 2/4] btrfs: make btrfs_repair_io_failure() handle bs > ps cases " Qu Wenruo
2025-10-02 16:46 ` kernel test robot
2025-10-03 7:58 ` Dan Carpenter
2025-10-03 9:17 ` Qu Wenruo
2025-10-03 10:53 ` Dan Carpenter
2025-10-03 21:18 ` Qu Wenruo
2025-10-01 9:50 ` [PATCH 3/4] btrfs: make read verification " Qu Wenruo
2025-10-01 9:50 ` [PATCH 4/4] btrfs: enable encoded read/write/send for bs > ps cases Qu Wenruo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1759311100.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).