From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH RFC 0/5] btrfs: support huge data folios for 4K page size
Date: Fri, 24 Apr 2026 18:21:29 +0930 [thread overview]
Message-ID: <cover.1777019132.git.wqu@suse.com> (raw)
[REASON FOR RFC]
- Unstable baseline for-next branch
The current for-next branch has a known regression where
btrfs_async_reclaim_metadata_space() kworker can fall into a dead loop
and fail several ENOSPC test cases.
Although the regression is pinned down, I'm still waiting for a good
baseline to rebase the series.
- Extra on-stack memory usage
Currently we have two bitmaps that are using extra on-stack memory.
Each of them uses 64 bytes on-stack memory, so in total we can have
128 bytes just for the bitmaps.
Not sure if it's a concern.
- Uncertainty related to v7.2 large folio support
I'm planning to move large data folio support out of experimental.
So when that support is no longer experimental, this huge folio support
would need to start as experimental
Depends on which patch(set) is merged first, there needs to be some
modification to ensure end users won't suddenly get not only large but
also huge folios.
Currently btrfs only supports folios as large as BITS_PER_LONG * blocks.
This is an artificial limit introduced to make bitmap operations easier.
Btrfs has two extra bitmaps that are out of btrfs_folio_state structure,
btrfs_bio_ctrl->submit_bitmap and @delalloc_bitmap inside
writepage_delalloc().
Limits the bitmap size to BITS_PER_LONG makes it very easy to handle the
above two bitmaps, we can just use a local unsigned long, no need to do
any memory allocation.
On the other hand, those two external bitmaps are the only thing
limiting huge folios.
The 1st patch will update the comments related to subpage implementation
first.
The 2nd patch will handle the subpage internal operations, mostly to
handle bitmap dumping.
The 3rd patch will prepare btrfs_bio_ctrl::submit_bitmap to be a proper
pointer for the incoming huge folios support.
The 4th patch will remove the 2K block size support, as it will double
the bitmap size for no obvious benefit, as it doesn't even improve the
coverage on 4K page sized systems anymore.
The final patch will enable the huge folio support, by using on-stack
bitmap that can contain 512 bits.
That will ensure 2MiB folio size, which is order 9 on 4K page sized
systems.
Qu Wenruo (5):
btrfs: update the out-of-date comments on subpage
btrfs: prepare subpage operations to support >= BITS_PER_LONG
sub-bitmaps
btrfs: migrate btrfs_bio_ctrl::submit_bitmap to support larger bitmaps
btrfs: remove 2K block size support
btrfs: introduce support for huge folios
fs/btrfs/disk-io.c | 2 +-
fs/btrfs/extent_io.c | 73 +++++++++------
fs/btrfs/fs.h | 16 ++--
fs/btrfs/subpage.c | 209 +++++++++++++++++++++++++------------------
fs/btrfs/subpage.h | 8 +-
5 files changed, 176 insertions(+), 132 deletions(-)
--
2.53.0
next reply other threads:[~2026-04-24 8:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-24 8:51 Qu Wenruo [this message]
2026-04-24 8:51 ` [PATCH RFC 1/5] btrfs: update the out-of-date comments on subpage Qu Wenruo
2026-04-24 8:51 ` [PATCH RFC 2/5] btrfs: prepare subpage operations to support >= BITS_PER_LONG sub-bitmaps Qu Wenruo
2026-04-24 8:51 ` [PATCH RFC 3/5] btrfs: migrate btrfs_bio_ctrl::submit_bitmap to support larger bitmaps Qu Wenruo
2026-04-24 8:51 ` [PATCH RFC 4/5] btrfs: remove 2K block size support Qu Wenruo
2026-04-24 10:13 ` David Sterba
2026-04-24 8:51 ` [PATCH RFC 5/5] btrfs: introduce support for huge folios Qu Wenruo
2026-04-27 14:10 ` [PATCH RFC 0/5] btrfs: support huge data folios for 4K page size David Sterba
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.1777019132.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