nvme: move nvme_cancel_request() to common code
[deliverable/linux.git] / drivers / nvme / host / core.c
index abdfdcfb66f4a1ffdcf8bf7d88de79d909c75209..24f91fbd253c85a661a642c7f0f3550c307a6897 100644 (file)
@@ -58,6 +58,23 @@ static DEFINE_SPINLOCK(dev_list_lock);
 
 static struct class *nvme_class;
 
+void nvme_cancel_request(struct request *req, void *data, bool reserved)
+{
+       int status;
+
+       if (!blk_mq_request_started(req))
+               return;
+
+       dev_dbg_ratelimited(((struct nvme_ctrl *) data)->device,
+                               "Cancelling I/O %d", req->tag);
+
+       status = NVME_SC_ABORT_REQ;
+       if (blk_queue_dying(req->q))
+               status |= NVME_SC_DNR;
+       blk_mq_complete_request(req, status);
+}
+EXPORT_SYMBOL_GPL(nvme_cancel_request);
+
 bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
                enum nvme_ctrl_state new_state)
 {
This page took 0.024312 seconds and 5 git commands to generate.