Commit 24493b8b authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Christoph Hellwig

nvme: export nvme_find_get_ns() and nvme_put_ns()

nvme_find_get_ns() and nvme_put_ns() are required by the target passthru
code and are exported under the NVME_TARGET_PASSTHRU namespace.
Based-on-a-patch-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent f783f444
...@@ -465,10 +465,11 @@ static void nvme_free_ns(struct kref *kref) ...@@ -465,10 +465,11 @@ static void nvme_free_ns(struct kref *kref)
kfree(ns); 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); kref_put(&ns->kref, nvme_free_ns);
} }
EXPORT_SYMBOL_NS_GPL(nvme_put_ns, NVME_TARGET_PASSTHRU);
static inline void nvme_clear_nvme_request(struct request *req) static inline void nvme_clear_nvme_request(struct request *req)
{ {
...@@ -3827,7 +3828,7 @@ static int ns_cmp(void *priv, struct list_head *a, struct list_head *b) ...@@ -3827,7 +3828,7 @@ static int ns_cmp(void *priv, struct list_head *a, struct list_head *b)
return nsa->head->ns_id - nsb->head->ns_id; 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; struct nvme_ns *ns, *ret = NULL;
...@@ -3845,6 +3846,7 @@ static struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) ...@@ -3845,6 +3846,7 @@ static struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid)
up_read(&ctrl->namespaces_rwsem); up_read(&ctrl->namespaces_rwsem);
return ret; return ret;
} }
EXPORT_SYMBOL_NS_GPL(nvme_find_get_ns, NVME_TARGET_PASSTHRU);
static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
{ {
......
...@@ -794,5 +794,7 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, ...@@ -794,5 +794,7 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
u8 opcode); u8 opcode);
void nvme_execute_passthru_rq(struct request *rq); void nvme_execute_passthru_rq(struct request *rq);
struct nvme_ctrl *nvme_ctrl_get_by_path(const char *path); struct nvme_ctrl *nvme_ctrl_get_by_path(const char *path);
struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid);
void nvme_put_ns(struct nvme_ns *ns);
#endif /* _NVME_H */ #endif /* _NVME_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment