[PATCH] nvme: remove multipath module parameter
From: Bryan Gurney
Date: Tue Feb 04 2025 - 16:13:46 EST
Since device-mapper multipath will no longer be operating on NVMe
devices, there is no longer a need for the "multipath" parameter.
Note that, when compiled with CONFIG_NVME_MULTIPATH off multi-path
capable controllers and namespaces will continue to present multiple
device entries - one for each controller/namespace discovered. This
could be confusing, as device-mapper multipath relies upon code in
nvme/host/multipath.c, and running device-mapper multipath with a
kernel compiled with CONFIG_NVME_MULTIPATH disabled is not supported.
Closes: https://lore.kernel.org/linux-nvme/20241121220321.40616-1-bgurney@xxxxxxxxxx/
Tested-by: John Meneghini <jmeneghi@xxxxxxxxxx>
Reviewed-by: John Meneghini <jmeneghi@xxxxxxxxxx>
Signed-off-by: Bryan Gurney <bgurney@xxxxxxxxxx>
---
drivers/nvme/host/core.c | 14 ++++----------
drivers/nvme/host/multipath.c | 14 ++++++--------
drivers/nvme/host/nvme.h | 2 --
3 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 2bcd9f710cb6..b07cd482fbc1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3809,14 +3809,6 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
info->nsid);
goto out_put_ns_head;
}
-
- if (!multipath) {
- dev_warn(ctrl->device,
- "Found shared namespace %d, but multipathing not supported.\n",
- info->nsid);
- dev_warn_once(ctrl->device,
- "Support for shared namespaces without CONFIG_NVME_MULTIPATH is deprecated and will be removed in Linux 6.0.\n");
- }
}
list_add_tail_rcu(&ns->siblings, &head->list);
@@ -3915,12 +3907,14 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
sprintf(disk->disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
ctrl->instance, ns->head->instance);
disk->flags |= GENHD_FL_HIDDEN;
- } else if (multipath) {
+ } else {
+#ifdef CONFIG_NVME_MULTIPATH
sprintf(disk->disk_name, "nvme%dn%d", ctrl->subsys->instance,
ns->head->instance);
- } else {
+#else
sprintf(disk->disk_name, "nvme%dn%d", ctrl->instance,
ns->head->instance);
+#endif
}
if (nvme_update_ns_info(ns, info))
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index a85d190942bd..28ab868182b2 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -9,11 +9,6 @@
#include <trace/events/block.h>
#include "nvme.h"
-bool multipath = true;
-module_param(multipath, bool, 0444);
-MODULE_PARM_DESC(multipath,
- "turn on native support for multiple controllers per subsystem");
-
static const char *nvme_iopolicy_names[] = {
[NVME_IOPOLICY_NUMA] = "numa",
[NVME_IOPOLICY_RR] = "round-robin",
@@ -632,9 +627,11 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
* We also do this for private namespaces as the namespace sharing flag
* could change after a rescan.
*/
+#ifdef CONFIG_NVME_MULTIPATH
if (!(ctrl->subsys->cmic & NVME_CTRL_CMIC_MULTI_CTRL) ||
- !nvme_is_unique_nsid(ctrl, head) || !multipath)
+ !nvme_is_unique_nsid(ctrl, head))
return 0;
+#endif
blk_set_stacking_limits(&lim);
lim.dma_alignment = 3;
@@ -1038,10 +1035,11 @@ int nvme_mpath_init_identify(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
size_t ana_log_size;
int error = 0;
+#ifdef CONFIG_NVME_MULTIPATH
/* check if multipath is enabled and we have the capability */
- if (!multipath || !ctrl->subsys ||
- !(ctrl->subsys->cmic & NVME_CTRL_CMIC_ANA))
+ if (!ctrl->subsys || !(ctrl->subsys->cmic & NVME_CTRL_CMIC_ANA))
return 0;
+#endif
/* initialize this in the identify path to cover controller resets */
atomic_set(&ctrl->nr_active, 0);
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 2c76afd00390..6dea04f05b59 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -972,7 +972,6 @@ static inline void nvme_trace_bio_complete(struct request *req)
trace_block_bio_complete(ns->head->disk->queue, req->bio);
}
-extern bool multipath;
extern struct device_attribute dev_attr_ana_grpid;
extern struct device_attribute dev_attr_ana_state;
extern struct device_attribute subsys_attr_iopolicy;
@@ -982,7 +981,6 @@ static inline bool nvme_disk_is_ns_head(struct gendisk *disk)
return disk->fops == &nvme_ns_head_ops;
}
#else
-#define multipath false
static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl)
{
return false;
--
2.47.0