btrfs: migrate get_eb_page_index() and get_eb_offset_in_page() to folios
authorQu Wenruo <wqu@suse.com>
Tue, 12 Dec 2023 02:28:36 +0000 (12:58 +1030)
committerDavid Sterba <dsterba@suse.com>
Fri, 15 Dec 2023 22:03:58 +0000 (23:03 +0100)
commit8d993618350c86da11cb408ba529c13e83d09527
tree84a989e89170245800023b400f9b5cd1bc8e87db
parent4a565c8069b7578a79d193d277e9c760aacf3e75
btrfs: migrate get_eb_page_index() and get_eb_offset_in_page() to folios

These two functions are still using the old page based code, which is
not going to handle larger folios at all.

The migration itself is going to involve the following changes:

- PAGE_SIZE -> folio_size()
- PAGE_SHIFT -> folio_shift()
- get_eb_page_index() -> get_eb_folio_index()
- get_eb_offset_in_page() -> get_eb_offset_in_folio()

And since we're going to support larger folios, although above straight
conversion is good enough, this patch would add extra comments in the
involved functions to explain why the same single line code can now
cover 3 cases:

- folio_size == PAGE_SIZE, sectorsize == PAGE_SIZE, nodesize >= PAGE_SIZE
  The common, non-subpage case with per-page folio.

- folio_size > PAGE_SIZE, sectorsize == PAGE_SIZE, nodesize >= PAGE_SIZE
  The incoming larger folio, non-subpage case.

- folio_size == PAGE_SIZE, sectorsize < PAGE_SIZE, nodesize < PAGE_SIZE
  The existing subpage case, we won't larger folio anyway.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/accessors.c
fs/btrfs/ctree.c
fs/btrfs/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h