diff mbox series

[RFC,04/37] btrfs: use bio_init_fields in volumes

Message ID 20210119050631.57073-5-chaitanya.kulkarni@wdc.com (mailing list archive)
State New, archived
Headers show
Series block: introduce bio_init_fields() | expand

Commit Message

Chaitanya Kulkarni Jan. 19, 2021, 5:05 a.m. UTC
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 fs/btrfs/volumes.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Nikolay Borisov Jan. 19, 2021, 1:52 p.m. UTC | #1
On 19.01.21 г. 7:05 ч., Chaitanya Kulkarni wrote:
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
> ---
>  fs/btrfs/volumes.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index ee086fc56c30..836167212252 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -6371,14 +6371,12 @@ static void submit_stripe_bio(struct btrfs_bio *bbio, struct bio *bio,
>  
>  	bio->bi_private = bbio;
This line can be removed as ->private is initialized by bio_init_fields.

>  	btrfs_io_bio(bio)->device = dev;
> -	bio->bi_end_io = btrfs_end_bio;
> -	bio->bi_iter.bi_sector = physical >> 9;
> +	bio_init_fields(bio, dev->bdev, physical >> 9, bbio, btrfs_end_bio, 0, 0);
>  	btrfs_debug_in_rcu(fs_info,
>  	"btrfs_map_bio: rw %d 0x%x, sector=%llu, dev=%lu (%s id %llu), size=%u",
>  		bio_op(bio), bio->bi_opf, bio->bi_iter.bi_sector,
>  		(unsigned long)dev->bdev->bd_dev, rcu_str_deref(dev->name),
>  		dev->devid, bio->bi_iter.bi_size);
> -	bio_set_dev(bio, dev->bdev);
>  
>  	btrfs_bio_counter_inc_noblocked(fs_info);
>  
>
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ee086fc56c30..836167212252 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6371,14 +6371,12 @@  static void submit_stripe_bio(struct btrfs_bio *bbio, struct bio *bio,
 
 	bio->bi_private = bbio;
 	btrfs_io_bio(bio)->device = dev;
-	bio->bi_end_io = btrfs_end_bio;
-	bio->bi_iter.bi_sector = physical >> 9;
+	bio_init_fields(bio, dev->bdev, physical >> 9, bbio, btrfs_end_bio, 0, 0);
 	btrfs_debug_in_rcu(fs_info,
 	"btrfs_map_bio: rw %d 0x%x, sector=%llu, dev=%lu (%s id %llu), size=%u",
 		bio_op(bio), bio->bi_opf, bio->bi_iter.bi_sector,
 		(unsigned long)dev->bdev->bd_dev, rcu_str_deref(dev->name),
 		dev->devid, bio->bi_iter.bi_size);
-	bio_set_dev(bio, dev->bdev);
 
 	btrfs_bio_counter_inc_noblocked(fs_info);