]> Gentwo Git Trees - linux/.git/commit
btrfs: raid56: prepare steal_rbio() to support bs > ps cases
authorQu Wenruo <wqu@suse.com>
Mon, 17 Nov 2025 04:09:51 +0000 (14:39 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Nov 2025 00:47:41 +0000 (01:47 +0100)
commit53474a2ae17401821ce83c3b11f3d159f6b3583a
tree104b509b4e6e288d95b550a44a21bb04e29b3019
parent05ddf35a5d3d8d58323d6353f2bad026e9838af8
btrfs: raid56: prepare steal_rbio() to support bs > ps cases

The function steal_rbio() assume each fs block can be mapped by
one page, blocking bs > ps support for raid56.

Prepare it for bs > ps cases by:

- Introduce two helpers to calculate the sector number
  Previously we assume one page will contain at least one fs block, thus
  can use something like "sectors_per_page = PAGE_SIZE / sectorsize;",
  but with bs > ps support that above number will be 0.

  Instead introduce two helpers:

  * page_nr_to_sector_nr()
    Returns the sector number of the first sector covered by the page.

  * page_nr_to_num_sectors()
    Return how many sectors are covered by the page.

  And use the returned values for bitmap operations other than
  open-coded "PAGE_SIZE / sectorsize".
  Those helpers also have extra ASSERT()s to catch weird numbers.

- Use above helpers
  The involved functions are:
  * steal_rbio_page()
  * is_data_stripe_page()
  * full_page_sectors_uptodate()

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c