* [PATCH] nvme: also provide a UUID in the WWID sysfs attribute
@ 2017-07-12 13:38 Johannes Thumshirn
2017-07-13 7:28 ` Christoph Hellwig
2017-07-25 16:00 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2017-07-12 13:38 UTC (permalink / raw)
To: Christoph Hellwig, Keith Busch, Sagi Grimberg
Cc: Linux NVMe Mailinglist, Linux Kernel Mailinglist, mwilck,
Hannes Reinecke, Johannes Thumshirn
The WWID sysfs attribute can provide multiple means of a World Wide ID
for a NVMe device. It can either be a NGUID, a EUI-64 or a concatenation
of VID, Serial Number, Model and the Namespace ID in this order of
preference.
If the target also sends us a UUID use the UUID for identification and
give it the highest priority.
This eases generation of /dev/disk/by-* symlinks.
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
drivers/nvme/host/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index d70df1d0072d..c100e7db9b54 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1995,6 +1995,9 @@ static ssize_t wwid_show(struct device *dev, struct device_attribute *attr,
int serial_len = sizeof(ctrl->serial);
int model_len = sizeof(ctrl->model);
+ if (!uuid_is_null(&ns->uuid))
+ return sprintf(buf, "uuid.%pU\n", &ns->uuid);
+
if (memchr_inv(ns->nguid, 0, sizeof(ns->nguid)))
return sprintf(buf, "eui.%16phN\n", ns->nguid);
--
2.12.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: also provide a UUID in the WWID sysfs attribute
2017-07-12 13:38 [PATCH] nvme: also provide a UUID in the WWID sysfs attribute Johannes Thumshirn
@ 2017-07-13 7:28 ` Christoph Hellwig
2017-07-25 16:00 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2017-07-13 7:28 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Christoph Hellwig, Keith Busch, Sagi Grimberg,
Linux NVMe Mailinglist, Linux Kernel Mailinglist, mwilck,
Hannes Reinecke
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme: also provide a UUID in the WWID sysfs attribute
2017-07-12 13:38 [PATCH] nvme: also provide a UUID in the WWID sysfs attribute Johannes Thumshirn
2017-07-13 7:28 ` Christoph Hellwig
@ 2017-07-25 16:00 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2017-07-25 16:00 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: Christoph Hellwig, Keith Busch, Sagi Grimberg, mwilck,
Linux Kernel Mailinglist, Linux NVMe Mailinglist,
Hannes Reinecke
Thanks, applied to nvme-4.13.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-25 16:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-12 13:38 [PATCH] nvme: also provide a UUID in the WWID sysfs attribute Johannes Thumshirn
2017-07-13 7:28 ` Christoph Hellwig
2017-07-25 16:00 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®