]> 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)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Mon, 2 Nov 2026 02:04:06 +0000 (21:04 -0500)
commit7984b9666bd2f091fc293aeae6af3caa3db47116
treec2b12299ab50811cd8d320e5404a0b5a4531ee25
parentc3f63d70f236bb7685e6d11d1d9b5b351552e600
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>
(cherry picked from btrfs for-next commit "btrfs: replace btrfs_repair_io_failure() to use bio for page iteration")
[bio.c: 6.18's btrfs_end_repair_bio() filled paddrs[] only to pass it to btrfs_repair_io_failure(); remove that now-unused loop]
fs/btrfs/bio.c
fs/btrfs/bio.h
fs/btrfs/disk-io.c