@@ -3637,10 +3637,8 @@ static int write_dev_supers(struct btrfs_device *device,
* checking.
*/
bio = bio_alloc(GFP_NOFS, 1);
- bio_set_dev(bio, device->bdev);
- bio->bi_iter.bi_sector = bytenr >> SECTOR_SHIFT;
- bio->bi_private = device;
- bio->bi_end_io = btrfs_end_super_write;
+ bio_init_fields(bio, device->bdev, bytenr >> SECTOR_SHIFT,
+ device, btrfs_end_super_write, 0, 0);
__bio_add_page(bio, page, BTRFS_SUPER_INFO_SIZE,
offset_in_page(bytenr));
@@ -3748,11 +3746,10 @@ static void write_dev_flush(struct btrfs_device *device)
return;
bio_reset(bio);
- bio->bi_end_io = btrfs_end_empty_barrier;
- bio_set_dev(bio, device->bdev);
bio->bi_opf = REQ_OP_WRITE | REQ_SYNC | REQ_PREFLUSH;
init_completion(&device->flush_wait);
- bio->bi_private = &device->flush_wait;
+ bio_init_fields(bio, device->bdev, 0, &device->flush_wait,
+ btrfs_end_empty_barrier, 0, 0);
btrfsic_submit_bio(bio);
set_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state);
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> --- fs/btrfs/disk-io.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)