]> git.hungrycats.org Git - linux/commit
btrfs: replace btrfs_repair_io_failure() to use bio for page iteration
authorQu Wenruo <wqu@suse.com>
Wed, 19 Aug 2026 01:06:16 +0000 (10:36 +0930)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Sep 2026 11:23:36 +0000 (13:23 +0200)
commit4b0acd1d9dcf2ff0d214500d8a2a55e4be5cc662
treead05e0337696ecb3a5673dabaefaeacc3eaef069
parenta750c00db1bedaea3c9cce510c44eec9b9efa6c6
btrfs: replace btrfs_repair_io_failure() to use bio for page iteration

Currently btrfs_repair_io_failure() uses a @paddrs[] array to iterate
pages.

Such a parameter is required for bs > ps cases, as one fs block crosses
several pages.

However there is a much simpler and existing way to iterate pages: bio
and bvec_iter.

This changes btrfs_repair_io_failure() by:

- Use a const @bvec_iter pointer to locate where the pages are
- Extract file offset/logical from the @bbio
- Require no @step parameter
  Above features allow us to shorten the parameter list.

- Rename the function to btrfs_repair_bbio_failure()

- Change the caller in btrfs_repair_eb_io_failure() to allocate a bbio
  Unlike the data read path, we do not have a handy bbio in that case.
  So we need to allocate one just for btrfs_repair_bbio_failure().

- Change the error reporting in btrfs_repair_bbio_failure() to include
  root id and use inode number directly
  Now for btree inode we will report a proper inode number (1).

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/bio.c
fs/btrfs/bio.h
fs/btrfs/disk-io.c