All of lore.kernel.org
 help / color / mirror / Atom feed
From: guanjunxiong@huawei.com (Guan Junxiong)
Subject: [PATCH V2] nvme: make use of nvme error status codes in block layer
Date: Mon, 17 Apr 2017 21:15:39 +0800	[thread overview]
Message-ID: <1492434939-12308-1-git-send-email-guanjunxiong@huawei.com> (raw)

From: Junxiong Guan <guanjunxiong@huawei.com>

For more detailed information about nvme error status when ending
blk_mq request,some of nvme error status codes can be categorized into
different errnos explicitly.This patch makes conversion from those nvme
error status to errno detail so that block layer can make use of the
detailed error information.
---
 drivers/nvme/host/core.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 9bf758e3c911..95180ac0c710 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -73,6 +73,35 @@ static int nvme_error_status(struct request *req)
 		return 0;
 	case NVME_SC_CAP_EXCEEDED:
 		return -ENOSPC;
+	case NVME_SC_READ_ONLY:
+	case NVME_SC_ACCESS_DENIED:
+		return -EACCES;
+	case NVME_SC_LBA_RANGE:
+		return -EFAULT;
+	case NVME_SC_CONNECT_CTRL_BUSY:
+		return -EBUSY;
+	case NVME_SC_INVALID_OPCODE:
+	case NVME_SC_INVALID_FIELD:
+	case NVME_SC_INVALID_NS:
+	case NVME_SC_SGL_INVALID_LAST:
+	case NVME_SC_SGL_INVALID_COUNT:
+	case NVME_SC_SGL_INVALID_DATA:
+	case NVME_SC_SGL_INVALID_METADATA:
+	case NVME_SC_SGL_INVALID_TYPE:
+	case NVME_SC_SGL_INVALID_OFFSET:
+	case NVME_SC_SGL_INVALID_SUBTYPE:
+	case NVME_SC_CQ_INVALID:
+	case NVME_SC_QID_INVALID:
+	case NVME_SC_QUEUE_SIZE:
+	case NVME_SC_FIRMWARE_SLOT:
+	case NVME_SC_FIRMWARE_IMAGE:
+	case NVME_SC_INVALID_VECTOR:
+	case NVME_SC_INVALID_LOG_PAGE:
+	case NVME_SC_INVALID_FORMAT:
+	case NVME_SC_CTRL_LIST_INVALID:
+		return -EINVAL;
+	case NVME_SC_CMD_SEQ_ERROR:
+		return -EPROTO;
 	default:
 		return -EIO;
 	}
-- 
2.11.1


change from V1:
  rebase on the request-errors 

             reply	other threads:[~2017-04-17 13:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-17 13:15 Guan Junxiong [this message]
2017-04-17 16:45 ` [PATCH V2] nvme: make use of nvme error status codes in block layer J Freyensee
2017-04-18  0:32   ` Guan Junxiong
2017-04-18  8:08 ` Christoph Hellwig
2017-04-18 11:35   ` Guan Junxiong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492434939-12308-1-git-send-email-guanjunxiong@huawei.com \
    --to=guanjunxiong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.