Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1072804ybv; Thu, 20 Feb 2020 12:37:52 -0800 (PST) X-Google-Smtp-Source: APXvYqwHWcDMFvIL5JM18avvZdCOoH3QcXyK7pmBme0eA1fpm0iA5uUlidKBYXIOZEQTLNIA7WV4 X-Received: by 2002:a9d:7548:: with SMTP id b8mr26163959otl.74.1582231072658; Thu, 20 Feb 2020 12:37:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582231072; cv=none; d=google.com; s=arc-20160816; b=1CoX7B2igkups7P+RWo9slBDOKaX9hJRictVFHDEeecBonaR/ChIXRJbOZ458orqSG 0rVrPdyrg46NbKDLIgAq8d6N4kPuhzFVwva5p0NU2M+JG0XMvc/mfETiwvqzVRUqWTjv F9kLKUSE98+RGRNgGR9FOkaiZv9s91eEw8z+NK1zp4GnPA16+vQ3Zw/YfGI4CSCptCdC ZUHkPHCoVGwo8tXzqstb6gdXzAJJaWh2i7ZoxdMOVhqn4M3JCcTEsdDSIS8NYZSC1q/y w0B5fRDizaWRv2BbuRlzj1KTb7i4MnsTBbVixUu/gU8UnBlqP+U8L1gmSSfxFOGa7Lek z3qw== 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=fE62DYPAnENdy7S8/vMSBy4hxq5J+gSeKl3tZC20UK4=; b=TnV3cJwzf/oHX1JNZU6bdgrZUj+uM22IWVVJMQ60bR2oTMRZRZBc3WuHkQvY494VZV MFsDzK+en3NTnUvMkZH56+RT6r/lTl8bU4RjsEcmEKD3Nq4Ugo8H79/Lam1ViRu6dyWM P3FzbRIjTwOloYE9IDGkL2bfhmkppShKPod1DhnZ6SvFREyEnzS+CCF7JGC2OP0aRC7+ NIhIhLiFEytlMeph4Fi21Qrt2j0R0zd7E+HXvN9+3sAyC6QWclVrSHPd1pnXYjEca+aA dDmuvab9YXZdJ6wBlPXXP7KNp1dsi2mpwnFtpqkLdLsDTchkvlSck79qIzqkA1splOUt 7AlA== 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 x138si197074oif.142.2020.02.20.12.37.40; Thu, 20 Feb 2020 12:37:52 -0800 (PST) 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 S1729153AbgBTUhG (ORCPT + 99 others); Thu, 20 Feb 2020 15:37:06 -0500 Received: from ale.deltatee.com ([207.54.116.67]:45148 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729130AbgBTUhD (ORCPT ); Thu, 20 Feb 2020 15:37:03 -0500 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 1j4sZ8-0005cT-DD; Thu, 20 Feb 2020 13:37:02 -0700 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.92) (envelope-from ) id 1j4sZ8-0006yM-7d; Thu, 20 Feb 2020 13:36:58 -0700 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: Thu, 20 Feb 2020 13:36:49 -0700 Message-Id: <20200220203652.26734-7-logang@deltatee.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200220203652.26734-1-logang@deltatee.com> References: <20200220203652.26734-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 v11 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 --- 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 756f8ee201d9..ea6285da7dbd 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -465,7 +465,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); } @@ -898,8 +898,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; @@ -984,7 +984,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; @@ -3449,7 +3449,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; @@ -4233,6 +4233,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 196a0d38e19c..5e96c30b8291 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -693,6 +693,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