Commit 110ac0e5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David Sterba

btrfs: pass a block_device to btrfs_bio_clone

Pass the block_device to bio_alloc_clone instead of setting it later.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent fce3f24a
...@@ -3192,13 +3192,13 @@ struct bio *btrfs_bio_alloc(unsigned int nr_iovecs) ...@@ -3192,13 +3192,13 @@ struct bio *btrfs_bio_alloc(unsigned int nr_iovecs)
return bio; return bio;
} }
struct bio *btrfs_bio_clone(struct bio *bio) struct bio *btrfs_bio_clone(struct block_device *bdev, struct bio *bio)
{ {
struct btrfs_bio *bbio; struct btrfs_bio *bbio;
struct bio *new; struct bio *new;
/* Bio allocation backed by a bioset does not fail */ /* Bio allocation backed by a bioset does not fail */
new = bio_alloc_clone(bio->bi_bdev, bio, GFP_NOFS, &btrfs_bioset); new = bio_alloc_clone(bdev, bio, GFP_NOFS, &btrfs_bioset);
bbio = btrfs_bio(new); bbio = btrfs_bio(new);
btrfs_bio_init(bbio); btrfs_bio_init(bbio);
bbio->iter = bio->bi_iter; bbio->iter = bio->bi_iter;
......
...@@ -280,7 +280,7 @@ void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end, ...@@ -280,7 +280,7 @@ void extent_clear_unlock_delalloc(struct btrfs_inode *inode, u64 start, u64 end,
int btrfs_alloc_page_array(unsigned int nr_pages, struct page **page_array); int btrfs_alloc_page_array(unsigned int nr_pages, struct page **page_array);
struct bio *btrfs_bio_alloc(unsigned int nr_iovecs); struct bio *btrfs_bio_alloc(unsigned int nr_iovecs);
struct bio *btrfs_bio_clone(struct bio *bio); struct bio *btrfs_bio_clone(struct block_device *bdev, struct bio *bio);
struct bio *btrfs_bio_clone_partial(struct bio *orig, u64 offset, u64 size); struct bio *btrfs_bio_clone_partial(struct bio *orig, u64 offset, u64 size);
void end_extent_writepage(struct page *page, int err, u64 start, u64 end); void end_extent_writepage(struct page *page, int err, u64 start, u64 end);
......
...@@ -6824,12 +6824,13 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio, ...@@ -6824,12 +6824,13 @@ blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
continue; continue;
} }
if (dev_nr < total_devs - 1) if (dev_nr < total_devs - 1) {
bio = btrfs_bio_clone(first_bio); bio = btrfs_bio_clone(dev->bdev, first_bio);
else } else {
bio = first_bio; bio = first_bio;
bio_set_dev(bio, dev->bdev); bio_set_dev(bio, dev->bdev);
}
submit_stripe_bio(bioc, bio, bioc->stripes[dev_nr].physical, dev); submit_stripe_bio(bioc, bio, bioc->stripes[dev_nr].physical, dev);
} }
btrfs_bio_counter_dec(fs_info); btrfs_bio_counter_dec(fs_info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment