]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nvme: use bio_set_dev to assign ->bi_bdev
authorChristoph Hellwig <hch@lst.de>
Tue, 26 Jan 2021 14:33:06 +0000 (15:33 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 26 Jan 2021 15:50:01 +0000 (08:50 -0700)
Always use the bio_set_dev helper to assign ->bi_bdev to make sure
other state related to the device is uptodate.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c
drivers/nvme/host/lightnvm.c
drivers/nvme/host/multipath.c

index eb7963fb167b56a181fadfe915868cec0e8ee4fd..ba5df80881ea98a1b85e6acd62a83fe2304195ae 100644 (file)
@@ -1133,7 +1133,7 @@ static int nvme_submit_user_cmd(struct request_queue *q,
                if (ret)
                        goto out;
                bio = req->bio;
-               bio->bi_bdev = bdev;
+               bio_set_dev(bio, bdev);
                if (bdev && meta_buffer && meta_len) {
                        meta = nvme_add_user_metadata(bio, meta_buffer, meta_len,
                                        meta_seed, write);
index ec38128f51e994cf566e82735c2c6d5c360d014c..b705988629f224d0f4ead3f9a0f8ffd52a1952bd 100644 (file)
@@ -816,7 +816,7 @@ static int nvme_nvm_submit_user_cmd(struct request_queue *q,
                        vcmd->ph_rw.metadata = cpu_to_le64(metadata_dma);
                }
 
-               bio->bi_bdev = ns->disk->part0;
+               bio_set_dev(bio, ns->disk->part0);
        }
 
        blk_execute_rq(NULL, rq, 0);
index a6d44e7a775f545dfe6e6632afcbd380e3c79f6b..65bd6efa5e1c6997cd8a41ee67fe580b44b21878 100644 (file)
@@ -312,7 +312,7 @@ blk_qc_t nvme_ns_head_submit_bio(struct bio *bio)
        srcu_idx = srcu_read_lock(&head->srcu);
        ns = nvme_find_path(head);
        if (likely(ns)) {
-               bio->bi_bdev = ns->disk->part0;
+               bio_set_dev(bio, ns->disk->part0);
                bio->bi_opf |= REQ_NVME_MPATH;
                trace_block_bio_remap(bio, disk_devt(ns->head->disk),
                                      bio->bi_iter.bi_sector);
@@ -352,7 +352,7 @@ static void nvme_requeue_work(struct work_struct *work)
                 * Reset disk to the mpath node and resubmit to select a new
                 * path.
                 */
-               bio->bi_bdev = head->disk->part0;
+               bio_set_dev(bio, head->disk->part0);
                submit_bio_noacct(bio);
        }
 }