]> Gentwo Git Trees - linux/.git/commit
btrfs: raid56: introduce a new parameter to locate a sector
authorQu Wenruo <wqu@suse.com>
Thu, 13 Nov 2025 08:41:36 +0000 (19:11 +1030)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Nov 2025 00:46:58 +0000 (01:46 +0100)
commit91cd1b586578017e20103771615db75dd8df5727
tree8bec5ad7aa007253ed9586373fa0cf7b52494d25
parent9042dc00023f6d8e8e52cf3df78ef3ba3e212ece
btrfs: raid56: introduce a new parameter to locate a sector

Since we cannot ensure that all bios from the higher layer are backed by
large folios (e.g. direct IO, encoded read/write/send), we need the
ability to locate sub-block (aka, a page) inside a full stripe.

So the existing @stripe_nr + @sector_nr combination is not enough to
locate such page for bs > ps cases.

Introduce a new parameter, @step_nr, to locate the page of a larger fs
block.  The naming is following the conventions used inside btrfs
elsewhere, where one step is min(sectorsize, PAGE_SIZE).

It's still a preparation, only touching the following aspects:

- btrfs_dump_rbio()
  To show the new @sector_nsteps member.

- btrfs_raid_bio::sector_nsteps
  Recording how many steps there are inside a fs block.

- Enlarge btrfs_raid_bio::*_paddrs[] size
  To take @sector_nsteps into consideration.

- index_one_bio()
- index_stripe_sectors()
- memcpy_from_bio_to_stripe()
- cache_rbio_pages()
- need_read_stripe_sectors()
  Those functions are iterating *_paddrs[], which needs to take
  sector_nsteps into consideration.

- Rename rbio_stripe_sector_index() to rbio_sector_index()
  The "stripe" part is not that helpful.

  And an extra ASSERT() before returning the result.

- Add a new rbio_paddr_index() helper
  This will take the extra @step_nr into consideration.

- The comments of btrfs_raid_bio

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