All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Two small follow-up patches for nvme multipathing
@ 2017-11-10  9:58 Hannes Reinecke
  2017-11-10  9:58 ` [PATCH 1/2] nvme: add Kconfig option 'NVME_MULTIPATH_DEFAULT' Hannes Reinecke
  2017-11-10  9:58 ` [PATCH 2/2] nvme: expose subsys attribute to sysfs Hannes Reinecke
  0 siblings, 2 replies; 7+ messages in thread
From: Hannes Reinecke @ 2017-11-10  9:58 UTC (permalink / raw)


Hi all,

here are some small follow-up patches for nvme multipathing.
Patches are relative to hchs nvme-mpath branch.

Hannes Reinecke (2):
  nvme: add Kconfig option 'NVME_MULTIPATH_DEFAULT'
  nvme: expose subsys attribute to sysfs

 drivers/nvme/host/Kconfig     | 11 ++++++++++
 drivers/nvme/host/core.c      | 47 +++++++++++++++++++++++++++++++++++++++++++
 drivers/nvme/host/multipath.c |  8 +++++++-
 3 files changed, 65 insertions(+), 1 deletion(-)

-- 
1.8.5.6

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] nvme: add Kconfig option 'NVME_MULTIPATH_DEFAULT'
  2017-11-10  9:58 [PATCH 0/2] Two small follow-up patches for nvme multipathing Hannes Reinecke
@ 2017-11-10  9:58 ` Hannes Reinecke
  2017-11-10 11:13   ` Christoph Hellwig
  2017-11-10  9:58 ` [PATCH 2/2] nvme: expose subsys attribute to sysfs Hannes Reinecke
  1 sibling, 1 reply; 7+ messages in thread
From: Hannes Reinecke @ 2017-11-10  9:58 UTC (permalink / raw)


Add a configuration option to enable or disable NVMe multipath
per default.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/Kconfig     | 11 +++++++++++
 drivers/nvme/host/multipath.c |  8 +++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig
index 4588680..cc0cbab 100644
--- a/drivers/nvme/host/Kconfig
+++ b/drivers/nvme/host/Kconfig
@@ -22,6 +22,17 @@ config NVME_MULTIPATH
 	   /dev/nvneXnY device will show up for each NVMe namespaces,
 	   even if it is accessible through multiple controllers.
 
+config NVME_MULTIPATH_DEFAULT
+       bool "NVMe multipath support enabled by default"
+       depends on NVME_MULTIPATH
+	default y
+       ---help---
+          This option enables multipath access to NVMe subsystems
+	  per default. It can be overridden with the boot/module option
+	  nvme_core.multipath later on.
+
+	  If unsure say Y.
+
 config NVME_FABRICS
 	tristate
 
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 8502758..9ceef3e 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -14,7 +14,13 @@
 #include <linux/moduleparam.h>
 #include "nvme.h"
 
-static bool multipath = true;
+#ifdef CONFIG_NVME_MULTIPATH_DEFAULT
+#define NVME_MULTIPATH_DEFAULT true
+#else
+#define NVME_MULTIPATH_DEFAULT false
+#endif
+
+static bool multipath = NVME_MULTIPATH_DEFAULT;
 module_param(multipath, bool, 0644);
 MODULE_PARM_DESC(multipath,
 	"turn on native support for multiple controllers per subsystem");
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] nvme: expose subsys attribute to sysfs
  2017-11-10  9:58 [PATCH 0/2] Two small follow-up patches for nvme multipathing Hannes Reinecke
  2017-11-10  9:58 ` [PATCH 1/2] nvme: add Kconfig option 'NVME_MULTIPATH_DEFAULT' Hannes Reinecke
@ 2017-11-10  9:58 ` Hannes Reinecke
  2017-11-10 11:14   ` Christoph Hellwig
  2017-11-13 21:25   ` Sagi Grimberg
  1 sibling, 2 replies; 7+ messages in thread
From: Hannes Reinecke @ 2017-11-10  9:58 UTC (permalink / raw)


We should be exposing the subsystem attributes like 'model' and
'subsysnqn' to sysfs to allow for easier identification of the
subsystem.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/core.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 6e9effa..4e574b4 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1912,6 +1912,52 @@ static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsysnqn)
 	return NULL;
 }
 
+#define SUBSYS_ATTR_RO(_name, _mode, _show)			\
+	struct device_attribute subsys_attr_##_name = __ATTR(_name, _mode, _show, NULL)
+
+static ssize_t nvme_subsys_show_nqn(struct device *dev,
+				    struct device_attribute *attr,
+				    char *buf)
+{
+	struct nvme_subsystem *subsys =
+		container_of(dev, struct nvme_subsystem, dev);
+
+	return snprintf(buf, PAGE_SIZE, "%s\n", subsys->subnqn);
+}
+static SUBSYS_ATTR_RO(subsysnqn, S_IRUGO, nvme_subsys_show_nqn);
+
+#define nvme_subsys_show_str_function(field)				\
+static ssize_t subsys_##field##_show(struct device *dev,		\
+			    struct device_attribute *attr, char *buf)	\
+{									\
+	struct nvme_subsystem *subsys =					\
+		container_of(dev, struct nvme_subsystem, dev);		\
+	return sprintf(buf, "%.*s\n",					\
+		       (int)sizeof(subsys->field), subsys->field);	\
+}									\
+static SUBSYS_ATTR_RO(field, S_IRUGO, subsys_##field##_show);
+
+nvme_subsys_show_str_function(model);
+nvme_subsys_show_str_function(serial);
+nvme_subsys_show_str_function(firmware_rev);
+
+static struct attribute *nvme_subsys_attrs[] = {
+	&subsys_attr_model.attr,
+	&subsys_attr_serial.attr,
+	&subsys_attr_firmware_rev.attr,
+	&subsys_attr_subsysnqn.attr,
+	NULL,
+};
+
+static struct attribute_group nvme_subsys_attrs_group = {
+	.attrs = nvme_subsys_attrs,
+};
+
+static const struct attribute_group *nvme_subsys_attrs_groups[] = {
+	&nvme_subsys_attrs_group,
+	NULL,
+};
+
 static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
 {
 	struct nvme_subsystem *subsys, *found;
@@ -1939,6 +1985,7 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
 
 	subsys->dev.class = nvme_subsys_class;
 	subsys->dev.release = nvme_release_subsystem;
+	subsys->dev.groups = nvme_subsys_attrs_groups;
 	dev_set_name(&subsys->dev, "nvme-subsys%d", subsys->instance);
 	device_initialize(&subsys->dev);
 
-- 
1.8.5.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 1/2] nvme: add Kconfig option 'NVME_MULTIPATH_DEFAULT'
  2017-11-10  9:58 ` [PATCH 1/2] nvme: add Kconfig option 'NVME_MULTIPATH_DEFAULT' Hannes Reinecke
@ 2017-11-10 11:13   ` Christoph Hellwig
  2017-11-10 12:21     ` Hannes Reinecke
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2017-11-10 11:13 UTC (permalink / raw)


On Fri, Nov 10, 2017@10:58:22AM +0100, Hannes Reinecke wrote:
> Add a configuration option to enable or disable NVMe multipath
> per default.

NAK.  If you really want a local override please keep this as a local
patch.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] nvme: expose subsys attribute to sysfs
  2017-11-10  9:58 ` [PATCH 2/2] nvme: expose subsys attribute to sysfs Hannes Reinecke
@ 2017-11-10 11:14   ` Christoph Hellwig
  2017-11-13 21:25   ` Sagi Grimberg
  1 sibling, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2017-11-10 11:14 UTC (permalink / raw)


On Fri, Nov 10, 2017@10:58:23AM +0100, Hannes Reinecke wrote:
> We should be exposing the subsystem attributes like 'model' and
> 'subsysnqn' to sysfs to allow for easier identification of the
> subsystem.

This looks fine except for an overlong line that I can easily fix up.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] nvme: add Kconfig option 'NVME_MULTIPATH_DEFAULT'
  2017-11-10 11:13   ` Christoph Hellwig
@ 2017-11-10 12:21     ` Hannes Reinecke
  0 siblings, 0 replies; 7+ messages in thread
From: Hannes Reinecke @ 2017-11-10 12:21 UTC (permalink / raw)


On 11/10/2017 12:13 PM, Christoph Hellwig wrote:
> On Fri, Nov 10, 2017@10:58:22AM +0100, Hannes Reinecke wrote:
>> Add a configuration option to enable or disable NVMe multipath
>> per default.
> 
> NAK.  If you really want a local override please keep this as a local
> patch.
> 
Well, I had to try :-)
But keeping a distro-specific patch (if the need arises) is fine by me.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare at suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: F. Imend?rffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG N?rnberg)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] nvme: expose subsys attribute to sysfs
  2017-11-10  9:58 ` [PATCH 2/2] nvme: expose subsys attribute to sysfs Hannes Reinecke
  2017-11-10 11:14   ` Christoph Hellwig
@ 2017-11-13 21:25   ` Sagi Grimberg
  1 sibling, 0 replies; 7+ messages in thread
From: Sagi Grimberg @ 2017-11-13 21:25 UTC (permalink / raw)


Reviewed-by: Sagi Grimberg <sagi at grimbrg.me>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-11-13 21:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-10  9:58 [PATCH 0/2] Two small follow-up patches for nvme multipathing Hannes Reinecke
2017-11-10  9:58 ` [PATCH 1/2] nvme: add Kconfig option 'NVME_MULTIPATH_DEFAULT' Hannes Reinecke
2017-11-10 11:13   ` Christoph Hellwig
2017-11-10 12:21     ` Hannes Reinecke
2017-11-10  9:58 ` [PATCH 2/2] nvme: expose subsys attribute to sysfs Hannes Reinecke
2017-11-10 11:14   ` Christoph Hellwig
2017-11-13 21:25   ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.