Skip to content

Commit

Permalink
lightnvm: create cmd before allocating request
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Javier González authored and axboe committed May 4, 2017
1 parent 2719aa2 commit 2e13f33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/nvme/host/lightnvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
if (!cmd)
return -ENOMEM;

nvme_nvm_rqtocmd(rq, rqd, ns, cmd);

rq = nvme_alloc_request(q, (struct nvme_command *)cmd, 0, NVME_QID_ANY);
if (IS_ERR(rq)) {
kfree(cmd);
Expand All @@ -517,8 +519,6 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
rq->__data_len = 0;
}

nvme_nvm_rqtocmd(rq, rqd, ns, cmd);

rq->end_io_data = rqd;

blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_io);
Expand Down

0 comments on commit 2e13f33

Please sign in to comment.