From patchwork Wed Apr 5 14:18:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9664249 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 12C8D60353 for ; Wed, 5 Apr 2017 14:19:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0701027DA4 for ; Wed, 5 Apr 2017 14:19:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFB7A2859E; Wed, 5 Apr 2017 14:19: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 6B74127DA4 for ; Wed, 5 Apr 2017 14:19:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755227AbdDEOTs (ORCPT ); Wed, 5 Apr 2017 10:19:48 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:32886 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbdDEOTX (ORCPT ); Wed, 5 Apr 2017 10:19:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender: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=a+Vm17QbYOggMr7YfjueKlCf6suQP39mWDITShhqF8c=; b=uX1woE4kMiSw/MKBy+ESi3X28 4TpuS0MTat9h2pRxuy3nUW1tBMe35xzn4J8StN8ZsL6+Q5FB+UUobGQLvzoO5dmnNxAWFqYAk851V mBxQsO+yNWhx0i+ZkLnmipxf8IA0rFdxXOPFBVklwhtyX37l2YsgdG6JOf77lRRq8KBdQt3gPjzrL LlT+xfJCOhsoRcHevkyIL8Zzw/v2aBlPWYPWTHryXGK56/cyqFKTLUblk2DzuHtrub/sHv+Q0K0Bh kMSjelqt4R6tUApYXWaOnEn0ryOe5zL+UimUKisOcDkeBNgOdLFazF+v/u+Eu1Adg/BV2D8ecBEGy sfTuQOhwQ==; Received: from 80-109-146-114.cable.dynamic.surfer.at ([80.109.146.114] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cvlmI-0008Uv-Kf; Wed, 05 Apr 2017 14:19:19 +0000 From: Christoph Hellwig To: Jens Axboe , Keith Busch , Sagi Grimberg Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH 4/5] nvme: move the retries count to struct nvme_request Date: Wed, 5 Apr 2017 16:18:55 +0200 Message-Id: <20170405141856.1862-5-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170405141856.1862-1-hch@lst.de> References: <20170405141856.1862-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The way NVMe uses this field is entirely different from the older SCSI/BLOCK_PC usage, so move it into struct nvme_request. Also reduce the size of the file to a unsigned char so that we leave space for additional smaller fields that will appear soon. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- drivers/nvme/host/core.c | 10 +++++----- drivers/nvme/host/nvme.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 933e67c60e33..dc05f41c3992 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -49,8 +49,8 @@ unsigned char shutdown_timeout = 5; module_param(shutdown_timeout, byte, 0644); MODULE_PARM_DESC(shutdown_timeout, "timeout in seconds for controller shutdown"); -static unsigned int nvme_max_retries = 5; -module_param_named(max_retries, nvme_max_retries, uint, 0644); +static u8 nvme_max_retries = 5; +module_param_named(max_retries, nvme_max_retries, byte, 0644); MODULE_PARM_DESC(max_retries, "max number of retries a command may have"); static int nvme_char_major; @@ -74,7 +74,7 @@ static inline bool nvme_req_needs_retry(struct request *req) return false; if (jiffies - req->start_time >= req->timeout) return false; - if (req->retries >= nvme_max_retries) + if (nvme_req(req)->retries >= nvme_max_retries) return false; return true; } @@ -85,7 +85,7 @@ void nvme_complete_rq(struct request *req) if (unlikely(req->errors)) { if (nvme_req_needs_retry(req)) { - req->retries++; + nvme_req(req)->retries++; blk_mq_requeue_request(req, !blk_mq_queue_stopped(req->q)); return; @@ -356,7 +356,7 @@ int nvme_setup_cmd(struct nvme_ns *ns, struct request *req, int ret = BLK_MQ_RQ_QUEUE_OK; if (!(req->rq_flags & RQF_DONTPREP)) { - req->retries = 0; + nvme_req(req)->retries = 0; req->rq_flags |= RQF_DONTPREP; } diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 82ba9a305301..b667be9546a1 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -89,6 +89,7 @@ enum nvme_quirks { */ struct nvme_request { struct nvme_command *cmd; + u8 retries; union nvme_result result; };