Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp722296ybt; Fri, 26 Jun 2020 09:58:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKqfM1oOnvucRG6KOM54QftXZIZmZu+Bu9CeL661q0SPKDaR9YVBHpW4SEdIUefsLvdHGA X-Received: by 2002:a05:6402:1b0e:: with SMTP id by14mr4174315edb.266.1593190713661; Fri, 26 Jun 2020 09:58:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593190713; cv=none; d=google.com; s=arc-20160816; b=scvqAaDXhYtOmsWNr3nveDMdFZjRdjJDbHd35IK4QDj7T4ofwcPssormx+r8GEMON0 4cL2rQHetwS64KOJQZyU4dCUN5G04doywQBtDFceiJLK8EApyf++7HWrWAU6UebTcCO2 RgSlj1fgr82ZmyBIu5V3JdLfDUz2aU8Frv6F97ahReNAiSfMtElSA86/TmrisUxA6HhL hA141Jw6EjFlWhUJY+ywdrJ/SAIopPluQegOd1kNxPhl8Hr+w/pDYh7UyC9fCQKipe/a CDgRqRUkMIfhF78JLaWAZI0DF0/HmRVViv/l5ss2/Mc8PVxXwVIx1cqcMeTQRvCixkY9 8cDg== 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 :dkim-signature; bh=L7cWSfK/Iv8UF6YZL4ZPTnIiXT+AsLVh6DlV/q1XyNs=; b=OlvUWiYXQwpzWjbWiGSr3MYDuLKm0jmpn/1BK5qXttbR6IU9ieBYAGXmr7PwFC1LGb qri8cFGPVa/+8NNuqL99MjxfM3MEIn1oSJiSaJSnuV+wRDvAWC/97N0cPpB0E40G1x/P mQizuDYmrm7kXJb8YQr+50TxbcfQdUHF/pul83camZi4PuTIOhKrd+pfuxo24N7RAUOx 6M8ajDQZYgYD0Ld7tI6OqRux+SQ1O7DKaL97ZlaHYkKD8XLUpKPmZvZIiYz53hUtORUz VaIqRJ+Z893TloPjnODtey5gufb2W1DwoY1VzXYbcf+8i57AQPyYIUeqs8vpwCu0yoC0 SiNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@deltatee.com header.s=20200525 header.b=Z2XS58E2; 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 t22si17628290edr.207.2020.06.26.09.58.11; Fri, 26 Jun 2020 09:58:33 -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; dkim=fail header.i=@deltatee.com header.s=20200525 header.b=Z2XS58E2; 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 S1729798AbgFZPjy (ORCPT + 99 others); Fri, 26 Jun 2020 11:39:54 -0400 Received: from ale.deltatee.com ([207.54.116.67]:34850 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729712AbgFZPjh (ORCPT ); Fri, 26 Jun 2020 11:39:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=deltatee.com; s=20200525; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Cc:To:From:Sender:Reply-To: Content-Type: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=L7cWSfK/Iv8UF6YZL4ZPTnIiXT+AsLVh6DlV/q1XyNs=; b=Z2XS58E2UK2OcuqEnmLfq0FyLx wkHmOmo3jllETwpdt7onXH7FzVEa+kRUl9DXS8rYZpXzWDzk6ZGSiXpRWilsCWm0Q8DLcQm0S4R9z hhOzjpp61rZsGYEOFZ7QbALr/IDJTI3v58qSj8SgQOVlYn/Yym7OYVYom8MxMMQmH+HjutKrqG58B Xj04k3zVREctgA/v0IapglJ18M+T9xkegPlKlrvSGpPiFaLsRmSYJUyX5ZqtvMWIvylR7kMPQMCuA 47fufThGqRTDVLQvdhx2Ea14FEsUkZJX6Y2jhinS1arUP0F22nBiP/2bobvm1RlylATzmZtLPjbri yrk8PrWw==; 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 1joqRu-0000oT-4A; Fri, 26 Jun 2020 09:39:34 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1joqRn-0007Hc-Cx; Fri, 26 Jun 2020 09:39:23 -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: Fri, 26 Jun 2020 09:39:15 -0600 Message-Id: <20200626153918.27929-7-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200626153918.27929-1-logang@deltatee.com> References: <20200626153918.27929-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,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Subject: [PATCH v14 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 acd5af305f4b..7c35583ef9ca 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -450,7 +450,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); } @@ -886,8 +886,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; @@ -974,7 +974,7 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) } } -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; @@ -3606,7 +3606,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; @@ -4367,6 +4367,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 e7074afadb5f..5bab4dff1516 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -716,6 +716,11 @@ static inline void nvme_hwmon_init(struct nvme_ctrl *ctrl) { } * These functions are only for use by nvmet-passthru and are only exported * if CONFIG_NVME_TARGET_PASSTHRU is set. */ +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 /* _NVME_H */ -- 2.20.1