]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
nvme: add NVME_SC_CANCELLED
authorChristoph Hellwig <hch@lst.de>
Thu, 26 Nov 2015 11:58:11 +0000 (12:58 +0100)
committerJens Axboe <axboe@fb.com>
Tue, 22 Dec 2015 16:38:33 +0000 (09:38 -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>
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c

index b75d41e5c378443c6728e3f3db82e2bef6acdd8c..88950f362d9772f33a70d5b37ef55addb0c07911 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 99c5b6319d8ddcdcc23cd94443173983637f7b2a..e683bd1a05e66850d756abb335d98355053c6606 100644 (file)
@@ -621,7 +621,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)
-                               error = -EINTR;
+                               error = NVME_SC_CANCELLED;
                        else
                                error = status;
                } else {