aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJavier González <jg@lightnvm.io>2017-05-03 05:19:04 -0400
committerJens Axboe <axboe@fb.com>2017-05-04 09:53:04 -0400
commit2e13f33a2464fc3aa7783022a90309cabeca8935 (patch)
treedb025603a0572b86538f0e15a1d131cfb5d8e268
parent2719aa217e0d025dbfce74ac777815776ccec072 (diff)
lightnvm: create cmd before allocating request
Create nvme command before allocating a request using nvme_alloc_request, which uses the command direction. Up until now, the command has been zeroized, so all commands have been allocated as a read operation. Signed-off-by: Javier González <javier@cnexlabs.com> Reviewed-by: Matias Bjørling <matias@cnexlabs.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/nvme/host/lightnvm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
index e4e4e60b1224..8c4adac6fafc 100644
--- a/drivers/nvme/host/lightnvm.c
+++ b/drivers/nvme/host/lightnvm.c
@@ -503,6 +503,8 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
503 if (!cmd) 503 if (!cmd)
504 return -ENOMEM; 504 return -ENOMEM;
505 505
506 nvme_nvm_rqtocmd(rq, rqd, ns, cmd);
507
506 rq = nvme_alloc_request(q, (struct nvme_command *)cmd, 0, NVME_QID_ANY); 508 rq = nvme_alloc_request(q, (struct nvme_command *)cmd, 0, NVME_QID_ANY);
507 if (IS_ERR(rq)) { 509 if (IS_ERR(rq)) {
508 kfree(cmd); 510 kfree(cmd);
@@ -517,8 +519,6 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
517 rq->__data_len = 0; 519 rq->__data_len = 0;
518 } 520 }
519 521
520 nvme_nvm_rqtocmd(rq, rqd, ns, cmd);
521
522 rq->end_io_data = rqd; 522 rq->end_io_data = rqd;
523 523
524 blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_io); 524 blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_io);