Skip to content

btrfs: experimental support for huge data folios

Qu Wenruo linux-btrfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Changes in v1 from the cover letter

- Rebase to the latest for-next branch
Which provides a stable baseline that can pass usual fstests runs, and no more 2K fs block size support.

- Mark the new huge folio support as experimental
Since the large folio support itself is moved out of experimental features, the huge folio support will need to be hidden behind experimental.

- Rework the blocks per folio limit
Previously blocks per folio limit is always calculated by BTRFS_MAX_FOLIO_SIZE / BTRFS_MIN_BLOCK_SIZE, but the real blocks per folio is also depending on the fs block size.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4btrfs: update the out-of-date comments on subpagefs/btrfs/subpage.c+5 -340 replies
2/4btrfs: prepare subpage operations to support >= BITS_PER_LONG sub-bitmapsfs/btrfs/extent_io.c fs/btrfs/subpage.c fs/btrfs/subpage.h+98 -500 replies
3/4btrfs: migrate btrfs_bio_ctrl::submit_bitmap to support larger bitmapsfs/btrfs/extent_io.c fs/btrfs/subpage.c fs/btrfs/subpage.h+83 -350 replies
4/4btrfs: introduce support for huge foliosfs/btrfs/disk-io.c fs/btrfs/extent_io.c fs/btrfs/fs.h +1 more+42 -340 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/4] btrfs: experimental support for huge data folios

[CHANGELOG]
RFC->v1:
- Rebase to the latest for-next branch
Which provides a stable baseline that can pass usual fstests runs, and no more 2K fs block size support.

- Mark the new huge folio support as experimental
Since the large folio support itself is moved out of experimental features, the huge folio support will need to be hidden behind experimental.

- Rework the blocks per folio limit
Previously blocks per folio limit is always calculated by BTRFS_MAX_FOLIO_SIZE / BTRFS_MIN_BLOCK_SIZE, but the real blocks per folio is also depending on the fs block size.

Now introduce a new BTRFS_MAX_BLOCKS_PER_FOLIO macro, which is either BITS_PER_LONG (the old one), or 512 (the new experimental one).

This will allow non-experimental builds to get rid of the enlarged bitmap, thus lower the on-stack memory usage for non-experimental builds.

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 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 (4):
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: introduce support for huge folios

 fs/btrfs/disk-io.c   |  11 ++-
 fs/btrfs/extent_io.c |  71 +++++++++-------
 fs/btrfs/fs.h        |  16 ++++
 fs/btrfs/subpage.c   | 191 ++++++++++++++++++++++++++-----------------
 fs/btrfs/subpage.h   |   8 +-
 5 files changed, 186 insertions(+), 111 deletions(-)
Signature · 1 line
2.53.0