Skip to content

Commit

Permalink
nvme-lightnvm: use blk_execute_rq in nvme_nvm_submit_user_cmd
Browse files Browse the repository at this point in the history
Instead of reinventing it poorly.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com>
Reviewed-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Jun 9, 2017
1 parent dc88e34 commit 4017415
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions drivers/nvme/host/lightnvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,6 @@ static struct nvm_dev_ops nvme_nvm_dev_ops = {
.max_phys_sect = 64,
};

static void nvme_nvm_end_user_vio(struct request *rq, int error)
{
struct completion *waiting = rq->end_io_data;

complete(waiting);
}

static int nvme_nvm_submit_user_cmd(struct request_queue *q,
struct nvme_ns *ns,
struct nvme_nvm_command *vcmd,
Expand Down Expand Up @@ -608,7 +601,6 @@ static int nvme_nvm_submit_user_cmd(struct request_queue *q,
rq->timeout = timeout ? timeout : ADMIN_TIMEOUT;

rq->cmd_flags &= ~REQ_FAILFAST_DRIVER;
rq->end_io_data = &wait;

if (ppa_buf && ppa_len) {
ppa_list = dma_pool_alloc(dev->dma_pool, GFP_KERNEL, &ppa_dma);
Expand Down Expand Up @@ -662,9 +654,7 @@ static int nvme_nvm_submit_user_cmd(struct request_queue *q,
}

submit:
blk_execute_rq_nowait(q, NULL, rq, 0, nvme_nvm_end_user_vio);

wait_for_completion_io(&wait);
blk_execute_rq(q, NULL, rq, 0);

if (nvme_req(rq)->flags & NVME_REQ_CANCELLED)
ret = -EINTR;
Expand Down

0 comments on commit 4017415

Please sign in to comment.