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>
Este cometimento está contido em:

cometido por
Jens Axboe

ascendente
c2ee070fb0
cometimento
74d46992e0
@@ -422,7 +422,7 @@ static void submit_flushes(struct work_struct *ws)
|
||||
bi = bio_alloc_mddev(GFP_NOIO, 0, mddev);
|
||||
bi->bi_end_io = md_end_flush;
|
||||
bi->bi_private = rdev;
|
||||
bi->bi_bdev = rdev->bdev;
|
||||
bio_set_dev(bi, rdev->bdev);
|
||||
bi->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH;
|
||||
atomic_inc(&mddev->flush_pending);
|
||||
submit_bio(bi);
|
||||
@@ -772,7 +772,7 @@ void md_super_write(struct mddev *mddev, struct md_rdev *rdev,
|
||||
|
||||
atomic_inc(&rdev->nr_pending);
|
||||
|
||||
bio->bi_bdev = rdev->meta_bdev ? rdev->meta_bdev : rdev->bdev;
|
||||
bio_set_dev(bio, rdev->meta_bdev ? rdev->meta_bdev : rdev->bdev);
|
||||
bio->bi_iter.bi_sector = sector;
|
||||
bio_add_page(bio, page, size, 0);
|
||||
bio->bi_private = rdev;
|
||||
@@ -803,8 +803,10 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
|
||||
struct bio *bio = md_bio_alloc_sync(rdev->mddev);
|
||||
int ret;
|
||||
|
||||
bio->bi_bdev = (metadata_op && rdev->meta_bdev) ?
|
||||
rdev->meta_bdev : rdev->bdev;
|
||||
if (metadata_op && rdev->meta_bdev)
|
||||
bio_set_dev(bio, rdev->meta_bdev);
|
||||
else
|
||||
bio_set_dev(bio, rdev->bdev);
|
||||
bio_set_op_attrs(bio, op, op_flags);
|
||||
if (metadata_op)
|
||||
bio->bi_iter.bi_sector = sector + rdev->sb_start;
|
||||
|
Criar uma nova questão referindo esta
Bloquear um utilizador