path: root/block/blk-flush.c
diff options
authorChristoph Hellwig <>2017-08-23 19:10:32 +0200
committerJens Axboe <>2017-08-23 12:49:55 -0600
commit74d46992e0d9dee7f1f376de0d56d31614c8a17a (patch)
tree399c316bb960541135e557bc1765caeec6d00084 /block/blk-flush.c
parentc2ee070fb00365d7841f6661dcdc7fbe6620bdf8 (diff)
block: replace bi_bdev with a gendisk pointer and partitions index
This way we don't need a block_device structure to submit I/O. The block_device has different life time rules from the gendisk and request_queue and is usually only available when the block device node is open. Other callers need to explicitly create one (e.g. the lightnvm passthrough code, or the new nvme multipathing code). For the actual I/O path all that we need is the gendisk, which exists once per block device. But given that the block layer also does partition remapping we additionally need a partition index, which is used for said remapping in generic_make_request. Note that all the block drivers generally want request_queue or sometimes the gendisk, so this removes a layer of indirection all over the stack. Signed-off-by: Christoph Hellwig <> Signed-off-by: Jens Axboe <>
Diffstat (limited to 'block/blk-flush.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-flush.c b/block/blk-flush.c
index ed5fe322abba..83b7d5b41c79 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -525,7 +525,7 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
return -ENXIO;
bio = bio_alloc(gfp_mask, 0);
- bio->bi_bdev = bdev;
+ bio_set_dev(bio, bdev);
bio->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
ret = submit_bio_wait(bio);