Commit 47286945 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Tim Gardner

nvme: add NVME_SC_CANCELLED

BugLink: http://bugs.launchpad.net/bugs/1531539

To properly document how we are using a negative Linux error value to
communicate request cancellations inside the driver.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarKeith Busch <keith.busch@intel.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
(cherry picked from commit 297465c8)
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 7c7a6a5d
...@@ -19,6 +19,16 @@ ...@@ -19,6 +19,16 @@
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/blk-mq.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; extern unsigned char nvme_io_timeout;
#define NVME_IO_TIMEOUT (nvme_io_timeout * HZ) #define NVME_IO_TIMEOUT (nvme_io_timeout * HZ)
......
...@@ -621,7 +621,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx, ...@@ -621,7 +621,7 @@ static void req_completion(struct nvme_queue *nvmeq, void *ctx,
if (req->cmd_type == REQ_TYPE_DRV_PRIV) { if (req->cmd_type == REQ_TYPE_DRV_PRIV) {
if (cmd_rq->ctx == CMD_CTX_CANCELLED) if (cmd_rq->ctx == CMD_CTX_CANCELLED)
error = -EINTR; error = NVME_SC_CANCELLED;
else else
error = status; error = status;
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment