aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/host/core.c17
-rw-r--r--drivers/nvme/host/nvme.h1
-rw-r--r--drivers/nvme/host/pci.c16
3 files changed, 18 insertions, 16 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index abdfdcfb66f4..24f91fbd253c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -58,6 +58,23 @@ static DEFINE_SPINLOCK(dev_list_lock);
58 58
59static struct class *nvme_class; 59static struct class *nvme_class;
60 60
61void nvme_cancel_request(struct request *req, void *data, bool reserved)
62{
63 int status;
64
65 if (!blk_mq_request_started(req))
66 return;
67
68 dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
69 "Cancelling I/O %d", req->tag);
70
71 status = NVME_SC_ABORT_REQ;
72 if (blk_queue_dying(req->q))
73 status |= NVME_SC_DNR;
74 blk_mq_complete_request(req, status);
75}
76EXPORT_SYMBOL_GPL(nvme_cancel_request);
77
61bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, 78bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
62 enum nvme_ctrl_state new_state) 79 enum nvme_ctrl_state new_state)
63{ 80{
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 4d196d2d57da..282421fec27c 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -207,6 +207,7 @@ static inline bool nvme_req_needs_retry(struct request *req, u16 status)
207 (jiffies - req->start_time) < req->timeout; 207 (jiffies - req->start_time) < req->timeout;
208} 208}
209 209
210void nvme_cancel_request(struct request *req, void *data, bool reserved);
210bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, 211bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
211 enum nvme_ctrl_state new_state); 212 enum nvme_ctrl_state new_state);
212int nvme_disable_ctrl(struct nvme_ctrl *ctrl, u64 cap); 213int nvme_disable_ctrl(struct nvme_ctrl *ctrl, u64 cap);
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 4af61c909353..37aa25046eb8 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -919,22 +919,6 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
919 return BLK_EH_RESET_TIMER; 919 return BLK_EH_RESET_TIMER;
920} 920}
921 921
922static void nvme_cancel_request(struct request *req, void *data, bool reserved)
923{
924 int status;
925
926 if (!blk_mq_request_started(req))
927 return;
928
929 dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
930 "Cancelling I/O %d", req->tag);
931
932 status = NVME_SC_ABORT_REQ;
933 if (blk_queue_dying(req->q))
934 status |= NVME_SC_DNR;
935 blk_mq_complete_request(req, status);
936}
937
938static void nvme_free_queue(struct nvme_queue *nvmeq) 922static void nvme_free_queue(struct nvme_queue *nvmeq)
939{ 923{
940 dma_free_coherent(nvmeq->q_dmadev, CQ_SIZE(nvmeq->q_depth), 924 dma_free_coherent(nvmeq->q_dmadev, CQ_SIZE(nvmeq->q_depth),