Re: [PATCH v3 3/5] nvme: add the NVME_ENABLE_MULTIPATH_PARAM config option
From: Caleb Sander Mateos
Date: Fri Mar 28 2025 - 15:49:55 EST
On Fri, Mar 28, 2025 at 12:42 PM John Meneghini <jmeneghi@xxxxxxxxxx> wrote:
>
> The CONFIG_NVME_ENABLE_MULTIPATH_PARAM option controls the
> core_nvme.multipath parameter. When CONFIG_NVME_ENABLE_MULTIPATH_PARAM=n
> the multipath parameter is removed from the kernel and nvme multipathing
> is permanently enabled. When CONFIG_NVME_ENABLE_MULTIPATH_PARAM=y the
> nvme multipath parameter is added to the kernel and nvme multipath
> support is controlled by the core_nvme.multipath parameter.
>
> By default CONFIG_NVME_ENABLE_MULTIPATH_PARAM=y
>
> Signed-off-by: John Meneghini <jmeneghi@xxxxxxxxxx>
> Tested-by: John Meneghini <jmeneghi@xxxxxxxxxx>
> Reviewed-by: Bryan Gurney <bgurney@xxxxxxxxxx>
> ---
> drivers/nvme/host/Kconfig | 11 +++++++++++
> drivers/nvme/host/multipath.c | 2 ++
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig
> index d47dfa80fb95..8c04b6b93982 100644
> --- a/drivers/nvme/host/Kconfig
> +++ b/drivers/nvme/host/Kconfig
> @@ -28,6 +28,17 @@ config NVME_MULTIPATH
>
> If unsure, say Y.
>
> +config NVME_ENABLE_MULTIPATH_PARAM
> + bool "NVMe enable multipath param"
> + depends on NVME_CORE && NVME_MULTIPATH
> + default y
> + help
> + This option enables the core_nvme.multipath parameter.
> + If this option is disabled the core_nvme.multipath parameter
> + is excluded from the kernel.
> +
> + If unsure, say Y.
> +
> config NVME_VERBOSE_ERRORS
> bool "NVMe verbose error reporting"
> depends on NVME_CORE
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 6b12ca80aa27..83084093e8db 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -10,9 +10,11 @@
> #include "nvme.h"
>
> bool multipath = true;
> +#ifdef CONFIG_NVME_ENABLE_MULTIPATH_PARAM
> module_param(multipath, bool, 0444);
> MODULE_PARM_DESC(multipath,
> "turn on native support for multiple controllers per subsystem");
> +#endif
If CONFIG_NVME_ENABLE_MULTIPATH_PARAM is disabled, could you #define
multipath false in place of the global variable? That would allow the
compiler to optimize out the multipath checks and the resulting dead
code.
Best,
Caleb