]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
nvme: add NVME_SC_CANCELLED
authorChristoph Hellwig <hch@lst.de>
Tue, 20 Dec 2016 00:24:17 +0000 (16:24 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 1 Jun 2017 20:40:45 +0000 (13:40 -0700)
To properly document how we are using a negative Linux error value to
communicate request cancellations inside the driver.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 297465c873ae8c99180617ca904dc1a4a738f25d)

Orabug: 25130845
Conflicts:
drivers/nvme/host/pci.c

Signed-off-by: Ashok Vairavan <ashok.vairavan@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c

index 935b4f27b02e0bfa3a9fc7e7fa9f48a1a1160f27..8ae0d2ebf9265d02e3c113d038b9f3b4d2153a35 100644 (file)
 #include <linux/kref.h>
 #include <linux/blk-mq.h>
 
+enum {
+       /*
+        * Driver internal status code for commands that were cancelled due
+        * to timeouts or controller shutdown.  The value is negative so
+        * that it a) doesn't overlap with the unsigned hardware error codes,
+        * and b) can easily be tested for.
+        */
+       NVME_SC_CANCELLED               = -EINTR,
+};
+
 extern unsigned char nvme_io_timeout;
 #define NVME_IO_TIMEOUT        (nvme_io_timeout * HZ)
 
index c8dec5f6356b52b0ff9e73cc6c47627188bbaf7f..4be8ca9bc53ea34d59e22e50b753012b0c6bbeb9 100644 (file)
@@ -664,7 +664,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
                }
                if (req->cmd_type == REQ_TYPE_DRV_PRIV) {
                        if (cmd_rq->ctx == CMD_CTX_CANCELLED)
-                               req->errors = -EINTR;
+                               req->errors = NVME_SC_CANCELLED;
                        else
                                req->errors = status;
                } else {
@@ -2354,12 +2354,9 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if (!dev->queues)
                goto free;
 
-<<<<<<< HEAD
        INIT_LIST_HEAD(&dev->ctrl.namespaces);
        mutex_init(&dev->namespaces_mutex);
        INIT_WORK(&dev->reset_work, nvme_reset_work);
-=======
->>>>>>> f3ca80f... nvme: move chardev and sysfs interface to common code
        dev->dev = get_device(&pdev->dev);
        pci_set_drvdata(pdev, dev);