Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6314167imm; Wed, 27 Jun 2018 05:54:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe8LkKzwRh72NaGcYYPz5ak5DJAmBfpzee9otP0ygYHrFiBscY95oG6NZPDZ+v5ERa4OZh/ X-Received: by 2002:a62:1e81:: with SMTP id e123-v6mr5702734pfe.188.1530104099582; Wed, 27 Jun 2018 05:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530104099; cv=none; d=google.com; s=arc-20160816; b=XcwcQtRfD8+7CfGsJDuUFX7ekK/5o7ru/TGVNI6+nRh461IWUWSh0XnIAu/WrV9R6J olpF1NpQ2ExN3yLt2NmKbh8BmOdQemIGrXzaQLX0X1ChVmfHaxe4CdbbJx1fU7KumuO6 XSK3dEtc2akJJ8qUfoyV+9aDwmrJGy6S47fs2oY5Ae82JW3fm9v7N9roKOeyKSGUqqix 2U5VzwoH0YIPcVMswgG8DBYtMjROQnMrduycmPzf03l5LJInxI4Osr4eG9TN3YwY5CpI oHzDSWzH74Y4uvlG3OJKj8fIxqZILgpqYpEd3W14AYoSIKTOEaca1Tt1rtqcfkQc9FbN sn3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=hYKEI26b7sQMqp+bFW+1MjQtXXcUhxdsYQON+/t22x8=; b=aJ2v/x7e58U1jyzWIyzpVvPEQGmkuQnhLwE3gud3T6QcW4KmoUYXrlWGGKyvM85YuA e0Jwu79lIJDXme6Y3SsyCq43nbgMzgxkKe4Yqabi12na0Sd/vaZapbGBTZHJso2gXiEk 19NNZ9sx2AKoUkd8tj2pCTNvjdpIRVjY4DnYtmHBwbqQ4mKnoW6BHTA/m0Enl8Kstd/U 1N+6KJ0YAO+huaBUCGv/Yi7ER+rtc1sxnFaudgvtIcKHWZEy6Wk/hCS3GKa578GFY3pp 6szuA5IYwJYt4BJYOYNbRDNk28czlqKZlxGOocqkZjwarVSXYajYYB8/10tRGfjFV9Xw hmRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v21-v6si3623401pgn.371.2018.06.27.05.54.45; Wed, 27 Jun 2018 05:54:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965233AbeF0Mxe (ORCPT + 99 others); Wed, 27 Jun 2018 08:53:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:54453 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934187AbeF0Mx3 (ORCPT ); Wed, 27 Jun 2018 08:53:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B3C4EAF9E; Wed, 27 Jun 2018 12:53:27 +0000 (UTC) From: Johannes Thumshirn To: Christoph Hellwig , Sagi Grimberg , Keith Busch , James Smart Cc: Linux Kernel Mailinglist , Linux NVMe Mailinglist Subject: [PATCH v5 1/2] nvme: cache struct nvme_ctrl reference to struct nvme_request Date: Wed, 27 Jun 2018 14:53:23 +0200 Message-Id: <20180627125324.22064-2-jthumshirn@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180627125324.22064-1-jthumshirn@suse.de> References: <20180627125324.22064-1-jthumshirn@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sagi Grimberg We will need to reference the controller in the setup and completion time for tracing and future traffic based keep alive support. Signed-off-by: Sagi Grimberg --- Changes to v4: - Move caching from nvme_setup_cmd to .init_request (Keith) --- drivers/nvme/host/core.c | 1 + drivers/nvme/host/fc.c | 1 + drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/pci.c | 2 ++ drivers/nvme/host/rdma.c | 1 + drivers/nvme/target/loop.c | 1 + 6 files changed, 7 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index e541fe268bcf..99dd62c1076c 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -652,6 +652,7 @@ blk_status_t nvme_setup_cmd(struct nvme_ns *ns, struct request *req, } cmd->common.command_id = req->tag; + if (ns) trace_nvme_setup_nvm_cmd(req->q->id, cmd); else diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 41d45a1b5c62..9cc33752539a 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -1737,6 +1737,7 @@ nvme_fc_init_request(struct blk_mq_tag_set *set, struct request *rq, int queue_idx = (set == &ctrl->tag_set) ? hctx_idx + 1 : 0; struct nvme_fc_queue *queue = &ctrl->queues[queue_idx]; + nvme_req(rq)->ctrl = &ctrl->ctrl; return __nvme_fc_init_request(ctrl, queue, op, rq, queue->rqcnt++); } diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 0c4a33df3b2f..f2249387b60d 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -102,6 +102,7 @@ struct nvme_request { u8 retries; u8 flags; u16 status; + struct nvme_ctrl *ctrl; }; /* diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index ba943f211687..8dcae11bbf3a 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -418,6 +418,8 @@ static int nvme_init_request(struct blk_mq_tag_set *set, struct request *req, BUG_ON(!nvmeq); iod->nvmeq = nvmeq; + + nvme_req(req)->ctrl = &dev->ctrl; return 0; } diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 9f5fc7b7fd7f..36344710050b 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -286,6 +286,7 @@ static int nvme_rdma_init_request(struct blk_mq_tag_set *set, struct ib_device *ibdev = dev->dev; int ret; + nvme_req(rq)->ctrl = &ctrl->ctrl; ret = nvme_rdma_alloc_qe(ibdev, &req->sqe, sizeof(struct nvme_command), DMA_TO_DEVICE); if (ret) diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index d8d91f04bd7e..af7fbf4132b0 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -227,6 +227,7 @@ static int nvme_loop_init_request(struct blk_mq_tag_set *set, { struct nvme_loop_ctrl *ctrl = set->driver_data; + nvme_req(req)->ctrl = &ctrl->ctrl; return nvme_loop_init_iod(ctrl, blk_mq_rq_to_pdu(req), (set == &ctrl->tag_set) ? hctx_idx + 1 : 0); } -- 2.16.4