Commit c13cf14f authored by Joel Granados's avatar Joel Granados Committed by Jens Axboe

nvme-multipath: refactor nvme_mpath_add_disk

Pass anagrpid as second argument. This is prep patch that allows reusing
this function for supporting unknown command sets.
Signed-off-by: default avatarJoel Granados <j.granados@samsung.com>
Signed-off-by: default avatarKanchan Joshi <joshi.k@samsung.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 0f89f0ec
...@@ -4167,7 +4167,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, ...@@ -4167,7 +4167,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
if (!nvme_ns_head_multipath(ns->head)) if (!nvme_ns_head_multipath(ns->head))
nvme_add_ns_cdev(ns); nvme_add_ns_cdev(ns);
nvme_mpath_add_disk(ns, id); nvme_mpath_add_disk(ns, id->anagrpid);
nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name); nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name);
kfree(id); kfree(id);
......
...@@ -800,16 +800,16 @@ static int nvme_lookup_ana_group_desc(struct nvme_ctrl *ctrl, ...@@ -800,16 +800,16 @@ static int nvme_lookup_ana_group_desc(struct nvme_ctrl *ctrl,
return -ENXIO; /* just break out of the loop */ return -ENXIO; /* just break out of the loop */
} }
void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id) void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid)
{ {
if (nvme_ctrl_use_ana(ns->ctrl)) { if (nvme_ctrl_use_ana(ns->ctrl)) {
struct nvme_ana_group_desc desc = { struct nvme_ana_group_desc desc = {
.grpid = id->anagrpid, .grpid = anagrpid,
.state = 0, .state = 0,
}; };
mutex_lock(&ns->ctrl->ana_lock); mutex_lock(&ns->ctrl->ana_lock);
ns->ana_grpid = le32_to_cpu(id->anagrpid); ns->ana_grpid = le32_to_cpu(anagrpid);
nvme_parse_ana_log(ns->ctrl, &desc, nvme_lookup_ana_group_desc); nvme_parse_ana_log(ns->ctrl, &desc, nvme_lookup_ana_group_desc);
mutex_unlock(&ns->ctrl->ana_lock); mutex_unlock(&ns->ctrl->ana_lock);
if (desc.state) { if (desc.state) {
......
...@@ -846,7 +846,7 @@ void nvme_mpath_default_iopolicy(struct nvme_subsystem *subsys); ...@@ -846,7 +846,7 @@ void nvme_mpath_default_iopolicy(struct nvme_subsystem *subsys);
void nvme_failover_req(struct request *req); void nvme_failover_req(struct request *req);
void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl); void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl);
int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head); int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head);
void nvme_mpath_add_disk(struct nvme_ns *ns, struct nvme_id_ns *id); void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid);
void nvme_mpath_remove_disk(struct nvme_ns_head *head); void nvme_mpath_remove_disk(struct nvme_ns_head *head);
int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id); int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id);
void nvme_mpath_init_ctrl(struct nvme_ctrl *ctrl); void nvme_mpath_init_ctrl(struct nvme_ctrl *ctrl);
...@@ -888,8 +888,7 @@ static inline int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, ...@@ -888,8 +888,7 @@ static inline int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,
{ {
return 0; return 0;
} }
static inline void nvme_mpath_add_disk(struct nvme_ns *ns, static inline void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid)
struct nvme_id_ns *id)
{ {
} }
static inline void nvme_mpath_remove_disk(struct nvme_ns_head *head) static inline void nvme_mpath_remove_disk(struct nvme_ns_head *head)
......
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