diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-04-19 23:01:26 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-04-20 01:38:33 +0200 |
commit | 9460e28022ed8e81c2eea2d3e5531eb199cb1475 (patch) | |
tree | 8119b306fbec8da610d9e7c60228b8bdbf29ec59 | |
parent | null_blk: Use blk_init_request_from_bio() instead of open-coding it (diff) | |
download | linux-9460e28022ed8e81c2eea2d3e5531eb199cb1475.tar.xz linux-9460e28022ed8e81c2eea2d3e5531eb199cb1475.zip |
lightnvm: Use blk_init_request_from_bio() instead of open-coding it
This patch changes the behavior of the lightnvm driver as follows:
* REQ_FAILFAST_MASK is set for read-ahead requests.
* If no I/O priority has been set in the bio, the I/O priority is
copied from the I/O context.
* The rq_disk member is initialized if bio->bi_bdev != NULL.
* The bio sector offset is copied into req->__sector instead of
retaining the value -1 set by blk_mq_alloc_request().
* req->errors is initialized to zero.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Matias Bjørling <m@bjorling.me>
Cc: Adam Manzanares <adam.manzanares@wdc.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/nvme/host/lightnvm.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index 4b78090518e1..b76e2e36fef4 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -511,11 +511,7 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd) rq->cmd_flags &= ~REQ_FAILFAST_DRIVER; if (bio) { - rq->ioprio = bio_prio(bio); - rq->__data_len = bio->bi_iter.bi_size; - rq->bio = rq->biotail = bio; - if (bio_has_data(bio)) - rq->nr_phys_segments = bio_phys_segments(q, bio); + blk_init_request_from_bio(rq, bio); } else { rq->ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM); rq->__data_len = 0; |