Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3809806ybz; Mon, 20 Apr 2020 09:50:47 -0700 (PDT) X-Google-Smtp-Source: APiQypKEj/HC/C7U/E9DzHoZ9V3tUvW7YzEhO9nVwPuIG4cFeVKNqQQGiPDtufTnrApmEFulx/s7 X-Received: by 2002:a50:e40d:: with SMTP id d13mr14410784edm.122.1587401447117; Mon, 20 Apr 2020 09:50:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587401447; cv=none; d=google.com; s=arc-20160816; b=Vu4VmYjV52Q66UJZPhZNX6z8mGiF0pQ/H9CxMa2fDGD+POEWKstzvt3vBTMnkn/Ey5 MDq45Zapt7IfX+NPLvoWl0hZ9+MTjiWHCLJaTVh07pMlEofBN+pbHjODbX3EOImZXTIO jzctwQBHZjH/JW1U9MXYaOlhc8GU9twdvo0VpCUx5p9/D9TVvvBVXHy5QVOQkl8REFEA 57rpAmXFq9lwKE6vuqguRR3hDFxWPXIZSz0vktmX5fm00Ks4Jms3Zkn95fFkCrS1enWq Je0bftDj0AIrpHMU3Bccda9q5TPtI6GhSPULPxN08X6PHNKLQTW7E6R7zqaf99GRhTbk HiCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:cc:to:from; bh=TvjwVjhdrKkPamcLvoqaI+yolDja5N/YKbmk0Rqu/n4=; b=boIjjk3Pvkkv/2xLoA1/TeRsa7xM/xkkJc55aZLpKTJoinvZowVcLkowUX/i4wjlLG FALpIYUdCeCDiMWULue1Fa8GllkKs9KoaXeZVKrxhgNVmvqjt7Jukj9HQfwU2R48hJSs 0BoNoORsKP6CbD5xALin5XZ4CATtFTtLqfwncX9ArklukQRsCZHKtByz1ajldrVO4w0W P7yx1DGI40zFe4yPbVGcnpdls2Hh2aRXQ21K6DY2PMqUWb8QXC80BKxUwkouhlQLqUm3 /zfOW9Ep2Ty6D/fiJeyahyYgfOKw1+enVGF2BEXLUKJeK6TpIxppjMFj9/2I3ykBJKxZ 38oQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t22si816966edy.347.2020.04.20.09.50.24; Mon, 20 Apr 2020 09:50:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726435AbgDTQrP (ORCPT + 99 others); Mon, 20 Apr 2020 12:47:15 -0400 Received: from ale.deltatee.com ([207.54.116.67]:43060 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbgDTQrN (ORCPT ); Mon, 20 Apr 2020 12:47:13 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQZZb-0008F6-BS; Mon, 20 Apr 2020 10:47:12 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1jQZZa-0005dr-C1; Mon, 20 Apr 2020 10:47:06 -0600 From: Logan Gunthorpe To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Christoph Hellwig , Sagi Grimberg , Keith Busch , Jens Axboe , Chaitanya Kulkarni , Max Gurtovoy , Stephen Bates , Logan Gunthorpe , Chaitanya Kulkarni Date: Mon, 20 Apr 2020 10:46:57 -0600 Message-Id: <20200420164700.21620-7-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200420164700.21620-1-logang@deltatee.com> References: <20200420164700.21620-1-logang@deltatee.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, hch@lst.de, sagi@grimberg.me, kbusch@kernel.org, axboe@fb.com, maxg@mellanox.com, sbates@raithlin.com, logang@deltatee.com, Chaitanya.Kulkarni@wdc.com, chaitanya.kulkarni@wdc.com X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.5 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_FREE,MYRULES_NO_TEXT autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH v12 6/9] nvme: Export existing nvme core functions X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Export nvme_put_ns(), nvme_command_effects(), nvme_execute_passthru_rq() and nvme_find_get_ns() for use in the nvmet passthru code. The exports are conditional on CONFIG_NVME_TARGET_PASSTHRU. Based-on-a-patch-by: Chaitanya Kulkarni Signed-off-by: Logan Gunthorpe Reviewed-by: Max Gurtovoy Reviewed-by: Sagi Grimberg --- drivers/nvme/host/core.c | 14 +++++++++----- drivers/nvme/host/nvme.h | 5 +++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 1f3ef53bb8b4..6dfc7d90ce87 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -457,7 +457,7 @@ static void nvme_free_ns(struct kref *kref) kfree(ns); } -static void nvme_put_ns(struct nvme_ns *ns) +void nvme_put_ns(struct nvme_ns *ns) { kref_put(&ns->kref, nvme_free_ns); } @@ -890,8 +890,8 @@ static void *nvme_add_user_metadata(struct bio *bio, void __user *ubuf, return ERR_PTR(ret); } -static u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, - u8 opcode) +u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, + u8 opcode) { u32 effects = 0; @@ -976,7 +976,7 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) nvme_queue_scan(ctrl); } -static void nvme_execute_passthru_rq(struct request *rq) +void nvme_execute_passthru_rq(struct request *rq) { struct nvme_command *cmd = nvme_req(rq)->cmd; struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl; @@ -3530,7 +3530,7 @@ static int ns_cmp(void *priv, struct list_head *a, struct list_head *b) return nsa->head->ns_id - nsb->head->ns_id; } -static struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) +struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) { struct nvme_ns *ns, *ret = NULL; @@ -4309,6 +4309,10 @@ EXPORT_SYMBOL_GPL(nvme_sync_queues); * use by the nvmet-passthru and should not be used for * other things. */ +EXPORT_SYMBOL_GPL(nvme_put_ns); +EXPORT_SYMBOL_GPL(nvme_command_effects); +EXPORT_SYMBOL_GPL(nvme_execute_passthru_rq); +EXPORT_SYMBOL_GPL(nvme_find_get_ns); struct nvme_ctrl *nvme_ctrl_get_by_path(const char *path) { diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 9195dd97b61b..76b4aa8f35e1 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -695,6 +695,11 @@ static inline void nvme_hwmon_init(struct nvme_ctrl *ctrl) { } * use by the nvmet-passthru and should not be used for * other things. */ +void nvme_put_ns(struct nvme_ns *ns); +u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, + u8 opcode); +void nvme_execute_passthru_rq(struct request *rq); +struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned int nsid); struct nvme_ctrl *nvme_ctrl_get_by_path(const char *path); #endif /* CONFIG_NVME_TARGET_PASSTHRU */ -- 2.20.1