Commit 47d95102 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

dm: simplify flush_bio initialization in __send_empty_flush

We don't really need the struct block_device to initialize a bio.  So
switch from using bio_set_dev to manually setting up bi_disk (bi_partno
will always be zero and has been cleared by bio_init already).
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Acked-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f46f2a31
...@@ -1422,18 +1422,12 @@ static int __send_empty_flush(struct clone_info *ci) ...@@ -1422,18 +1422,12 @@ static int __send_empty_flush(struct clone_info *ci)
*/ */
bio_init(&flush_bio, NULL, 0); bio_init(&flush_bio, NULL, 0);
flush_bio.bi_opf = REQ_OP_WRITE | REQ_PREFLUSH | REQ_SYNC; flush_bio.bi_opf = REQ_OP_WRITE | REQ_PREFLUSH | REQ_SYNC;
flush_bio.bi_disk = ci->io->md->disk;
bio_associate_blkg(&flush_bio);
ci->bio = &flush_bio; ci->bio = &flush_bio;
ci->sector_count = 0; ci->sector_count = 0;
/*
* Empty flush uses a statically initialized bio, as the base for
* cloning. However, blkg association requires that a bdev is
* associated with a gendisk, which doesn't happen until the bdev is
* opened. So, blkg association is done at issue time of the flush
* rather than when the device is created in alloc_dev().
*/
bio_set_dev(ci->bio, ci->io->md->bdev);
BUG_ON(bio_has_data(ci->bio)); BUG_ON(bio_has_data(ci->bio));
while ((ti = dm_table_get_target(ci->map, target_nr++))) while ((ti = dm_table_get_target(ci->map, target_nr++)))
__send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL); __send_duplicate_bios(ci, ti, ti->num_flush_bios, NULL);
......
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