mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-11 15:14:03 +08:00
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: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
fce3f24ada
commit
110ac0e543
@ -3192,13 +3192,13 @@ struct bio *btrfs_bio_alloc(unsigned int nr_iovecs)
|
||||
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 bio *new;
|
||||
|
||||
/* 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);
|
||||
btrfs_bio_init(bbio);
|
||||
bbio->iter = bio->bi_iter;
|
||||
|
@ -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);
|
||||
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);
|
||||
|
||||
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,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (dev_nr < total_devs - 1)
|
||||
bio = btrfs_bio_clone(first_bio);
|
||||
else
|
||||
if (dev_nr < total_devs - 1) {
|
||||
bio = btrfs_bio_clone(dev->bdev, first_bio);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
btrfs_bio_counter_dec(fs_info);
|
||||
|
Loading…
Reference in New Issue
Block a user