]> 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, 12 Oct 2026 17:16:19 +0000 (19:16 +0200)
commit15ed4a938b30fcb72e96187f36e2c4ff0e6e2227
tree27a2ec2cd3c50dbd9e50f21d86b3414890fab495
parentfdf56b9d03d475881d73b75afbdbe4058db04ffc
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