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 <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
此提交包含在:
Christoph Hellwig
2017-08-23 19:10:32 +02:00
提交者 Jens Axboe
父節點 c2ee070fb0
當前提交 74d46992e0
共有 99 個檔案被更改,包括 358 行新增357 行删除

查看文件

@@ -18,21 +18,24 @@
*/
struct dm_bio_details {
struct block_device *bi_bdev;
struct gendisk *bi_disk;
u8 bi_partno;
unsigned long bi_flags;
struct bvec_iter bi_iter;
};
static inline void dm_bio_record(struct dm_bio_details *bd, struct bio *bio)
{
bd->bi_bdev = bio->bi_bdev;
bd->bi_disk = bio->bi_disk;
bd->bi_partno = bio->bi_partno;
bd->bi_flags = bio->bi_flags;
bd->bi_iter = bio->bi_iter;
}
static inline void dm_bio_restore(struct dm_bio_details *bd, struct bio *bio)
{
bio->bi_bdev = bd->bi_bdev;
bio->bi_disk = bd->bi_disk;
bio->bi_partno = bd->bi_partno;
bio->bi_flags = bd->bi_flags;
bio->bi_iter = bd->bi_iter;
}