nvme: rename nvme_mpath_shutdown_disk to nvme_mpath_remove_disk

In the NVMe context, the term "shutdown" has a specific technical
meaning. To avoid confusion, this commit renames the nvme_mpath_
shutdown_disk function to nvme_mpath_remove_disk to better reflect
its purpose (i.e. removing the disk from the system). However,
nvme_mpath_remove_disk was already in use, and its functionality
is related to releasing or putting the head node disk. To resolve
this naming conflict and improve clarity, the existing nvme_mpath_
remove_disk function is also renamed to nvme_mpath_put_disk.

This renaming improves code readability and better aligns function
names with their actual roles.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Nilay Shroff
2025-05-14 18:33:17 +05:30
committed by Christoph Hellwig
parent 737af5f001
commit 9e221d8cf9
3 changed files with 14 additions and 14 deletions

View File

@@ -668,7 +668,7 @@ static void nvme_free_ns_head(struct kref *ref)
struct nvme_ns_head *head = struct nvme_ns_head *head =
container_of(ref, struct nvme_ns_head, ref); container_of(ref, struct nvme_ns_head, ref);
nvme_mpath_remove_disk(head); nvme_mpath_put_disk(head);
ida_free(&head->subsys->ns_ida, head->instance); ida_free(&head->subsys->ns_ida, head->instance);
cleanup_srcu_struct(&head->srcu); cleanup_srcu_struct(&head->srcu);
nvme_put_subsystem(head->subsys); nvme_put_subsystem(head->subsys);
@@ -4214,7 +4214,7 @@ static void nvme_ns_remove(struct nvme_ns *ns)
synchronize_srcu(&ns->ctrl->srcu); synchronize_srcu(&ns->ctrl->srcu);
if (last_path) if (last_path)
nvme_mpath_shutdown_disk(ns->head); nvme_mpath_remove_disk(ns->head);
nvme_put_ns(ns); nvme_put_ns(ns);
} }

View File

@@ -698,15 +698,15 @@ static void nvme_remove_head_work(struct work_struct *work)
{ {
struct nvme_ns_head *head = container_of(to_delayed_work(work), struct nvme_ns_head *head = container_of(to_delayed_work(work),
struct nvme_ns_head, remove_work); struct nvme_ns_head, remove_work);
bool shutdown = false; bool remove = false;
mutex_lock(&head->subsys->lock); mutex_lock(&head->subsys->lock);
if (list_empty(&head->list)) { if (list_empty(&head->list)) {
list_del_init(&head->entry); list_del_init(&head->entry);
shutdown = true; remove = true;
} }
mutex_unlock(&head->subsys->lock); mutex_unlock(&head->subsys->lock);
if (shutdown) if (remove)
nvme_remove_head(head); nvme_remove_head(head);
module_put(THIS_MODULE); module_put(THIS_MODULE);
@@ -1286,9 +1286,9 @@ void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid)
#endif #endif
} }
void nvme_mpath_shutdown_disk(struct nvme_ns_head *head) void nvme_mpath_remove_disk(struct nvme_ns_head *head)
{ {
bool shutdown = false; bool remove = false;
mutex_lock(&head->subsys->lock); mutex_lock(&head->subsys->lock);
/* /*
@@ -1314,15 +1314,15 @@ void nvme_mpath_shutdown_disk(struct nvme_ns_head *head)
head->delayed_removal_secs * HZ); head->delayed_removal_secs * HZ);
} else { } else {
list_del_init(&head->entry); list_del_init(&head->entry);
shutdown = true; remove = true;
} }
out: out:
mutex_unlock(&head->subsys->lock); mutex_unlock(&head->subsys->lock);
if (shutdown) if (remove)
nvme_remove_head(head); nvme_remove_head(head);
} }
void nvme_mpath_remove_disk(struct nvme_ns_head *head) void nvme_mpath_put_disk(struct nvme_ns_head *head)
{ {
if (!head->disk) if (!head->disk)
return; return;

View File

@@ -966,7 +966,7 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,struct nvme_ns_head *head);
void nvme_mpath_add_sysfs_link(struct nvme_ns_head *ns); void nvme_mpath_add_sysfs_link(struct nvme_ns_head *ns);
void nvme_mpath_remove_sysfs_link(struct nvme_ns *ns); void nvme_mpath_remove_sysfs_link(struct nvme_ns *ns);
void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid); void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid);
void nvme_mpath_remove_disk(struct nvme_ns_head *head); void nvme_mpath_put_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);
void nvme_mpath_update(struct nvme_ctrl *ctrl); void nvme_mpath_update(struct nvme_ctrl *ctrl);
@@ -975,7 +975,7 @@ void nvme_mpath_stop(struct nvme_ctrl *ctrl);
bool nvme_mpath_clear_current_path(struct nvme_ns *ns); bool nvme_mpath_clear_current_path(struct nvme_ns *ns);
void nvme_mpath_revalidate_paths(struct nvme_ns *ns); void nvme_mpath_revalidate_paths(struct nvme_ns *ns);
void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl); void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl);
void nvme_mpath_shutdown_disk(struct nvme_ns_head *head); void nvme_mpath_remove_disk(struct nvme_ns_head *head);
void nvme_mpath_start_request(struct request *rq); void nvme_mpath_start_request(struct request *rq);
void nvme_mpath_end_request(struct request *rq); void nvme_mpath_end_request(struct request *rq);
@@ -1025,7 +1025,7 @@ static inline int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl,
static inline void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid) static inline void nvme_mpath_add_disk(struct nvme_ns *ns, __le32 anagrpid)
{ {
} }
static inline void nvme_mpath_remove_disk(struct nvme_ns_head *head) static inline void nvme_mpath_put_disk(struct nvme_ns_head *head)
{ {
} }
static inline void nvme_mpath_add_sysfs_link(struct nvme_ns *ns) static inline void nvme_mpath_add_sysfs_link(struct nvme_ns *ns)
@@ -1044,7 +1044,7 @@ static inline void nvme_mpath_revalidate_paths(struct nvme_ns *ns)
static inline void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) static inline void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl)
{ {
} }
static inline void nvme_mpath_shutdown_disk(struct nvme_ns_head *head) static inline void nvme_mpath_remove_disk(struct nvme_ns_head *head)
{ {
} }
static inline void nvme_trace_bio_complete(struct request *req) static inline void nvme_trace_bio_complete(struct request *req)