From patchwork Tue Apr 18 15:52:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9685627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F4DC6037E for ; Tue, 18 Apr 2017 15:52:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 716B12835B for ; Tue, 18 Apr 2017 15:52:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65F86283F4; Tue, 18 Apr 2017 15:52:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D106283A6 for ; Tue, 18 Apr 2017 15:52:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757443AbdDRPwr (ORCPT ); Tue, 18 Apr 2017 11:52:47 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:49475 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753138AbdDRPwp (ORCPT ); Tue, 18 Apr 2017 11:52:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HGWluEIh6AuCTtdkkBrOoyIcM+paOnCtyyTZRSPSfkI=; b=C2sTrTAVWNs1fRuVh8AHVepJ6 ppvuFxyMBNAEM5sqeoFgge/pzeLKEewoFMUxHD4vmbmc/WEJ+MFFC5YPfkTOnB15Oqo7HR5T5DfjK F69BZh54Ptp6LLv8vZBIcngMQ+03X16BlB3kKRKpTWstmMtmDT+Vf8PFPDWiU9zkwaUiPJN0roSpi K4hFujnEcauu6djAIl5VJ/az1c7I7VGBg/Th+KSPa7E21Lmy4ST8Ykrwt2Oc/D0uEkclP+Sn70db+ U7369f3thLw4gxq21X1vz+3JeaOsGCDlK/l/qBd6DM1nLGrJQzXjolU2Ipiw3KZyWMFtUXa/A5INc 2Tbr9vy4A==; Received: from hch by bombadil.infradead.org with local (Exim 4.87 #1 (Red Hat Linux)) id 1d0VQe-0001ZQ-O2; Tue, 18 Apr 2017 15:52:32 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Josef Bacik , James Smart , Konrad Rzeszutek Wilk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, dm-devel@redhat.com, Christoph Hellwig Subject: nvme: make nvme_error_status private Date: Tue, 18 Apr 2017 08:52:10 -0700 Message-Id: <20170418155229.5977-5-hch@bombadil.infradead.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170418155229.5977-1-hch@bombadil.infradead.org> References: <20170418155229.5977-1-hch@bombadil.infradead.org> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christoph Hellwig Currently it's used by the lighnvm passthrough ioctl, but we'd like to make it private in preparation of block layer specific error code. Lighnvm already returns the real NVMe status anyway, so I think we can just limit it to returning -EIO for any status set. This will need a careful audit from the lightnvm folks, though. Signed-off-by: Christoph Hellwig --- drivers/nvme/host/core.c | 3 +-- drivers/nvme/host/lightnvm.c | 6 +++--- drivers/nvme/host/nvme.h | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index c6f256d74b6b..805f250315ec 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -66,7 +66,7 @@ static DEFINE_SPINLOCK(dev_list_lock); static struct class *nvme_class; -int nvme_error_status(struct request *req) +static int nvme_error_status(struct request *req) { switch (nvme_req(req)->status & 0x7ff) { case NVME_SC_SUCCESS: @@ -77,7 +77,6 @@ int nvme_error_status(struct request *req) return -EIO; } } -EXPORT_SYMBOL_GPL(nvme_error_status); static inline bool nvme_req_needs_retry(struct request *req) { diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c index f85e6e57d641..7f407d5f0095 100644 --- a/drivers/nvme/host/lightnvm.c +++ b/drivers/nvme/host/lightnvm.c @@ -599,7 +599,7 @@ static int nvme_nvm_submit_user_cmd(struct request_queue *q, __le64 *metadata = NULL; dma_addr_t metadata_dma; DECLARE_COMPLETION_ONSTACK(wait); - int ret; + int ret = 0; rq = nvme_alloc_request(q, (struct nvme_command *)vcmd, 0, NVME_QID_ANY); @@ -671,8 +671,8 @@ static int nvme_nvm_submit_user_cmd(struct request_queue *q, if (nvme_req(rq)->flags & NVME_REQ_CANCELLED) ret = -EINTR; - else - ret = nvme_error_status(rq); + else if (nvme_req(rq)->status & 0x7ff) + ret = -EIO; if (result) *result = nvme_req(rq)->status & 0x7ff; if (status) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index d7330f75632d..550037f5efea 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -254,7 +254,6 @@ static inline void nvme_end_request(struct request *req, __le16 status, blk_mq_complete_request(req, 0); } -int nvme_error_status(struct request *req); void nvme_complete_rq(struct request *req); void nvme_cancel_request(struct request *req, void *data, bool reserved); bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,