OSDN Git Service

btrfs: drop bio_set_dev where not needed
authorDavid Sterba <dsterba@suse.com>
Fri, 30 Aug 2019 17:39:19 +0000 (19:39 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 18 Nov 2019 22:39:30 +0000 (23:39 +0100)
commit1a41802701ec78ca3272073e60463c13b17d121f
tree7ca183a6711cf98643d22e5778cd9415dd16dc9d
parent429aebc0a9a063667dba21244386f96e5b4d7330
btrfs: drop bio_set_dev where not needed

bio_set_dev sets a bdev to a bio and is not only setting a pointer bug
also changing some state bits if there was a different bdev set before.
This is one thing that's not needed.

Another thing is that setting a bdev at bio allocation time is too early
and actually does not work with plain redundancy profiles, where each
time we submit a bio to a device, the bdev is set correctly.

In many places the bio bdev is set to latest_bdev that seems to serve as
a stub pointer "just to put something to bio". But we don't have to do
that.

Where do we know which bdev to set:

* for regular IO: submit_stripe_bio that's called by btrfs_map_bio

* repair IO: repair_io_failure, read or write from specific device

* super block write (using buffer_heads but uses raw bdev) and barriers

* scrub: this does not use all regular IO paths as it needs to reach all
  copies, verify and fixup eventually, and for that all bdev management
  is independent

* raid56: rbio_add_io_page, for the RMW write

* integrity-checker: does it's own low-level block tracking

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/extent_io.c