diff options
author | Christoph Hellwig <hch@lst.de> | 2017-03-30 13:41:32 +0200 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-04-04 09:48:23 -0600 |
commit | 77f02a7acd7654cd5944f2120831d1eace94b343 (patch) | |
tree | bee45db17a2a2f705c939f0769671008c3b3fda3 /drivers/nvme/host/fc.c | |
parent | 4bca70d0673927a8bef4b1de5fd8ddc735698a6b (diff) | |
download | blackbird-op-linux-77f02a7acd7654cd5944f2120831d1eace94b343.tar.gz blackbird-op-linux-77f02a7acd7654cd5944f2120831d1eace94b343.zip |
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/host/fc.c')
-rw-r--r-- | drivers/nvme/host/fc.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index c7e6da2a6108..fc42172c796a 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -1925,29 +1925,13 @@ nvme_fc_complete_rq(struct request *rq) { struct nvme_fc_fcp_op *op = blk_mq_rq_to_pdu(rq); struct nvme_fc_ctrl *ctrl = op->ctrl; - int error = 0, state; + int state; state = atomic_xchg(&op->state, FCPOP_STATE_IDLE); nvme_cleanup_cmd(rq); - nvme_fc_unmap_data(ctrl, rq, op); - - if (unlikely(rq->errors)) { - if (nvme_req_needs_retry(rq, rq->errors)) { - rq->retries++; - nvme_requeue_req(rq); - goto put_ctrl; - } - - if (blk_rq_is_passthrough(rq)) - error = rq->errors; - else - error = nvme_error_status(rq->errors); - } - - blk_mq_end_request(rq, error); -put_ctrl: + nvme_complete_rq(rq); nvme_fc_ctrl_put(ctrl); } |