Skip to content

RFC btrfs: defrag: further preparation for multi-page sector size

Qu Wenruo linux-btrfs linux-mm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2btrfs: introduce cached folio sizefs/btrfs/disk-io.c fs/btrfs/fs.h+21 -00 replies
2/2btrfs: defrag: prepare defrag for larger data folio sizefs/btrfs/defrag.c+37 -324 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH RFC 0/2] btrfs: defrag: further preparation for multi-page sector size

With the folio interface, it's much easier to support multi-page sector size (aka, sector/block size > PAGE_SIZE, which is rare between major upstream filesystems).

The basic idea is, if we firstly convert to full folio interface, and allow an address space to only allocate folio which is exactly block/sector size, the support for multi-page would be mostly done.

But before that support, there are still quite some conversion left for btrfs.

Furthermore, with both subpage and multipage sector size, we need to handle folio different:

- For subpage
The folio would always be page sized.

- For multipage (and regular sectorsize == PAGE_SIZE) The folio would be sector sized.

Furthermore, the filemap interface would make various shifts more complex.
As filemap_*() interfaces use index which is PAGE_SHIFT based, meanwhile with potential larger folio, the folio shift can be larger than PAGE_SHIFT.

Thus in the future, we may want to change filemap interface to accept bytenr to avoid confusion between page and folio shifts.

The first patch would introduce a cached folio size and shift.

The second patch would make defrag to utilize the new cached folio size and shift.
(And still use PAGE_SHIFT only for filemap*() interfaces)

Qu Wenruo (2):
btrfs: introduce cached folio size
btrfs: defrag: prepare defrag for larger data folio size

 fs/btrfs/defrag.c  | 69 +++++++++++++++++++++++++---------------------
 fs/btrfs/disk-io.c | 11 ++++++++
 fs/btrfs/fs.h      | 10 +++++++
 3 files changed, 58 insertions(+), 32 deletions(-)
Signature · 1 line
2.43.0