@@ -225,6 +225,7 @@ static int nvmet_bdev_alloc_bip(struct nvmet_req *req, struct bio *bio,
static void nvmet_bdev_execute_rw(struct nvmet_req *req)
{
+ struct block_device *bdev = req->ns->bdev;
int sg_cnt = req->sg_cnt;
struct bio *bio;
struct scatterlist *sg;
@@ -265,7 +266,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
} else {
bio = bio_alloc(GFP_KERNEL, min(sg_cnt, BIO_MAX_PAGES));
}
- bio_set_dev(bio, req->ns->bdev);
+ bio_set_dev(bio, bdev);
bio->bi_iter.bi_sector = sector;
bio->bi_private = req;
bio->bi_end_io = nvmet_bio_done;
@@ -290,11 +291,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
}
}
- bio = bio_alloc(GFP_KERNEL, min(sg_cnt, BIO_MAX_PAGES));
- bio_set_dev(bio, req->ns->bdev);
- bio->bi_iter.bi_sector = sector;
- bio->bi_opf = op;
-
+ bio = bio_new(bdev, sector, op, 0, sg_cnt, GFP_KERNEL);
bio_chain(bio, prev);
submit_bio(prev);
}
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> --- drivers/nvme/target/io-cmd-bdev.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)