summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/target
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-03-30 13:41:32 +0200
committerJens Axboe <axboe@fb.com>2017-04-04 09:48:23 -0600
commit77f02a7acd7654cd5944f2120831d1eace94b343 (patch)
treebee45db17a2a2f705c939f0769671008c3b3fda3 /drivers/nvme/target
parent4bca70d0673927a8bef4b1de5fd8ddc735698a6b (diff)
downloadop-kernel-dev-77f02a7acd7654cd5944f2120831d1eace94b343.zip
op-kernel-dev-77f02a7acd7654cd5944f2120831d1eace94b343.tar.gz
nvme: factor request completion code into a common helper
This avoids duplicating the logic four times, and it also allows to keep some helpers static in core.c or just opencode them. Note that this loses printing the aborted status on completions in the PCI driver as that uses a data structure not available any more. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/nvme/target')
-rw-r--r--drivers/nvme/target/loop.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
index 88a1927..33b431e 100644
--- a/drivers/nvme/target/loop.c
+++ b/drivers/nvme/target/loop.c
@@ -91,25 +91,10 @@ static inline int nvme_loop_queue_idx(struct nvme_loop_queue *queue)
static void nvme_loop_complete_rq(struct request *req)
{
struct nvme_loop_iod *iod = blk_mq_rq_to_pdu(req);
- int error = 0;
nvme_cleanup_cmd(req);
sg_free_table_chained(&iod->sg_table, true);
-
- if (unlikely(req->errors)) {
- if (nvme_req_needs_retry(req, req->errors)) {
- req->retries++;
- nvme_requeue_req(req);
- return;
- }
-
- if (blk_rq_is_passthrough(req))
- error = req->errors;
- else
- error = nvme_error_status(req->errors);
- }
-
- blk_mq_end_request(req, error);
+ nvme_complete_rq(req);
}
static struct blk_mq_tags *nvme_loop_tagset(struct nvme_loop_queue *queue)
OpenPOWER on IntegriCloud