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>
This commit is contained in:

committad av
Jens Axboe

förälder
c2ee070fb0
incheckning
74d46992e0
@@ -238,7 +238,7 @@ static void dmz_submit_write_bio(struct dmz_target *dmz, struct dm_zone *zone,
|
||||
struct dmz_bioctx *bioctx = dm_per_bio_data(bio, sizeof(struct dmz_bioctx));
|
||||
|
||||
/* Setup and submit the BIO */
|
||||
bio->bi_bdev = dmz->dev->bdev;
|
||||
bio_set_dev(bio, dmz->dev->bdev);
|
||||
bio->bi_iter.bi_sector = dmz_start_sect(dmz->metadata, zone) + dmz_blk2sect(chunk_block);
|
||||
atomic_inc(&bioctx->ref);
|
||||
generic_make_request(bio);
|
||||
@@ -586,7 +586,7 @@ static int dmz_map(struct dm_target *ti, struct bio *bio)
|
||||
(unsigned long long)dmz_chunk_block(dmz->dev, dmz_bio_block(bio)),
|
||||
(unsigned int)dmz_bio_blocks(bio));
|
||||
|
||||
bio->bi_bdev = dev->bdev;
|
||||
bio_set_dev(bio, dev->bdev);
|
||||
|
||||
if (!nr_sectors && bio_op(bio) != REQ_OP_WRITE)
|
||||
return DM_MAPIO_REMAPPED;
|
||||
|
Referens i nytt ärende
Block a user