Skip to content

btrfs: separate/simplify/unify subpage handling

Qu Wenruo linux-btrfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 1 replyIn review
  2. v18 patches 1 replySuperseded

Changes in v2 from the cover letter

- Fix a crash in 4K page sized system caused by btrfs_clear_buffer_dirty()
It looks like using btrfs_meta_folio_set_writeback() and btrfs_meta_folio_clear_writeback() is screwing up the btree inode map.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8btrfs: remove btrfs_fs_info::sectors_per_pagefs/btrfs/disk-io.c fs/btrfs/extent_io.c fs/btrfs/fs.h +1 more+85 -540 replies
2/8btrfs: extract metadata subpage detection into a dedicated helperfs/btrfs/extent_io.c fs/btrfs/subpage.c fs/btrfs/subpage.h+34 -170 replies
3/8btrfs: make subpage attach and detach to handle metadata properlyfs/btrfs/extent_io.c fs/btrfs/subpage.c fs/btrfs/subpage.h+17 -70 replies
4/8btrfs: use metadata specific helpers to simplify extent buffer helpersfs/btrfs/extent_io.c fs/btrfs/subpage.c fs/btrfs/subpage.h+43 -210 replies
5/8btrfs: simplify btrfs_clear_buffer_dirty()fs/btrfs/extent_io.c fs/btrfs/subpage.c fs/btrfs/subpage.h+35 -260 replies
6/8btrfs: simplify write_one_eb()fs/btrfs/extent_io.c+13 -290 replies
7/8btrfs: simplify read_extent_buffer_pages_nowait()fs/btrfs/extent_io.c+8 -130 replies
8/8btrfs: require strict data/metadata split for subpage checkfs/btrfs/disk-io.c fs/btrfs/extent_io.c fs/btrfs/subpage.c +1 more+16 -340 replies

Reviews trailers per patch

None of the 8 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDavid Sterba
SeriesR-b
1/8
2/8
3/8
4/8
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/8] btrfs: separate/simplify/unify subpage handling

[CHANGELOG]
v2:
- Fix a crash in 4K page sized system caused by btrfs_clear_buffer_dirty()
It looks like using btrfs_meta_folio_set_writeback() and btrfs_meta_folio_clear_writeback() is screwing up the btree inode map.

Fix it by reverting to the old manually clearing of PAGECACHE_DIRTY_TAG.

[METADATA SUBPAGE CHECKS]
Currently we only have one btrfs_is_subpage() check, utilized by data and metadata.

But the truth is, btrfs_is_subpage() can return incorrect result if the target folio belongs to a dummy extent buffer.

This means we have quite some metadata call sites doing their own metadata specific subpage check.

[SUBPAGE SPECIFIC HANDLINGS]
There are several functions that split the metadata subpage handling into a dedicated path.

But the truth is, a lot of such paths only have minor differences compared to the regular routine.

[THIS SERIES]
This series address the above problems and prepare for the incoming data larger folio support by:

- Remove btrfs_fs_info::sectors_per_page
This is mostly a preparation for the future data larger folio support.

- Introduce a dedicated metadata specific subpage check

- Unify/simplify metadata subpage handling So that we have a single unified path for metadata

Qu Wenruo (8):
btrfs: remove btrfs_fs_info::sectors_per_page
btrfs: extract metadata subpage detection into a dedicated helper
btrfs: make subpage attach and detach to handle metadata properly
btrfs: use metadata specific helpers to simplify extent buffer helpers
btrfs: simplify btrfs_clear_buffer_dirty()
btrfs: simplify write_one_eb()
btrfs: simplify read_extent_buffer_pages_nowait()
btrfs: require strict data/metadata split for subpage check

 fs/btrfs/disk-io.c   |   5 +-
 fs/btrfs/extent_io.c | 184 +++++++++++++++-------------------------
 fs/btrfs/fs.h        |   7 +-
 fs/btrfs/subpage.c   | 196 +++++++++++++++++++++++++++----------------
 fs/btrfs/subpage.h   |  52 ++++++++++--
 5 files changed, 247 insertions(+), 197 deletions(-)
Signature · 1 line
2.48.1