Skip to contentSkip to conversation

libnvdimm: change disk name of virtio pmem disk

PATCH In review Pankaj Gupta 2 participants 4 messages Jul 31, 2019 – Aug 16, 2019 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libnvdimm: change disk name of virtio pmem disk

This patch adds prefix 'v' in disk name for virtio pmem. This differentiates virtio-pmem disks from the pmem disks.

---
 drivers/nvdimm/namespace_devs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvdimm/namespace_devs.c +5 -1
index a16e52251a30..8e5d29266fb0 100644
@@ -182,8 +182,12 @@ const char *nvdimm_namespace_disk_name(struct nd_namespace_common *ndns,
 		char *name)
 {
 	struct nd_region *nd_region = to_nd_region(ndns->dev.parent);
+	const char *prefix = "";
 	const char *suffix = NULL;
 
+	if (!is_nvdimm_sync(nd_region))
+		prefix = "v";
+
 	if (ndns->claim && is_nd_btt(ndns->claim))
 		suffix = "s";
 
@@ -201,7 +205,7 @@ const char *nvdimm_namespace_disk_name(struct nd_namespace_common *ndns,
 			sprintf(name, "pmem%d.%d%s", nd_region->id, nsidx,
 					suffix ? suffix : "");
 		else
-			sprintf(name, "pmem%d%s", nd_region->id,
+			sprintf(name, "%spmem%d%s", prefix, nd_region->id,
 					suffix ? suffix : "");
 	} else if (is_namespace_blk(&ndns->dev)) {
 		struct nd_namespace_blk *nsblk;
Signature · 1 line
2.20.1
#1 lore raw

Ping.

Quoted 42 lines

This patch adds prefix 'v' in disk name for virtio pmem. This differentiates virtio-pmem disks from the pmem disks.

---
 drivers/nvdimm/namespace_devs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvdimm/namespace_devs.c +5 -1
index a16e52251a30..8e5d29266fb0 100644
@@ -182,8 +182,12 @@ const char *nvdimm_namespace_disk_name(struct
 nd_namespace_common *ndns,
 		char *name)
 {
 	struct nd_region *nd_region = to_nd_region(ndns->dev.parent);
+	const char *prefix = "";
 	const char *suffix = NULL;
 
+	if (!is_nvdimm_sync(nd_region))
+		prefix = "v";
+
 	if (ndns->claim && is_nd_btt(ndns->claim))
 		suffix = "s";
@@ -201,7 +205,7 @@ const char *nvdimm_namespace_disk_name(struct
 nd_namespace_common *ndns,
 			sprintf(name, "pmem%d.%d%s", nd_region->id, nsidx,
 					suffix ? suffix : "");
 		else
-			sprintf(name, "pmem%d%s", nd_region->id,
+			sprintf(name, "%spmem%d%s", prefix, nd_region->id,
 					suffix ? suffix : "");
 	} else if (is_namespace_blk(&ndns->dev)) {

struct nd_namespace_blk *nsblk;
--
2.20.1

#2 lore raw
In reply to Pankaj Gupta
Quoted 3 lines · Pankaj Gupta

This patch adds prefix 'v' in disk name for virtio pmem. This differentiates virtio-pmem disks from the pmem disks.

I don't think the small matter that this device does not support MAP_SYNC warrants a separate naming scheme. That said I do think we need to export this attribute in sysfs, likely at the region level, and then display that information in ndctl. This is distinct from the btt case where it is operating a different data consistency contract than baseline pmem.

Quoted 35 lines
---
 drivers/nvdimm/namespace_devs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvdimm/namespace_devs.c +5 -2
index a16e52251a30..8e5d29266fb0 100644
@@ -182,8 +182,12 @@ const char *nvdimm_namespace_disk_name(struct nd_namespace_common *ndns,
                char *name)
 {
        struct nd_region *nd_region = to_nd_region(ndns->dev.parent);
+       const char *prefix = "";
        const char *suffix = NULL;
 
+       if (!is_nvdimm_sync(nd_region))
+               prefix = "v";
+
        if (ndns->claim && is_nd_btt(ndns->claim))
                suffix = "s";
 
@@ -201,7 +205,7 @@ const char *nvdimm_namespace_disk_name(struct nd_namespace_common *ndns,
                        sprintf(name, "pmem%d.%d%s", nd_region->id, nsidx,
                                        suffix ? suffix : "");
                else
-                       sprintf(name, "pmem%d%s", nd_region->id,
+                       sprintf(name, "%spmem%d%s", prefix, nd_region->id,
                                        suffix ? suffix : "");
        } else if (is_namespace_blk(&ndns->dev)) {
                struct nd_namespace_blk *nsblk;
--

2.20.1

#3 lore raw
Quoted 11 lines
Quoted 4 lines

This patch adds prefix 'v' in disk name for virtio pmem. This differentiates virtio-pmem disks from the pmem disks.

I don't think the small matter that this device does not support MAP_SYNC warrants a separate naming scheme. That said I do think we need to export this attribute in sysfs, likely at the region level, and then display that information in ndctl. This is distinct from the btt case where it is operating a different data consistency contract than baseline pmem.

o.k. I will look to add the information in sysfs and display using ndctl.

Thanks,
Pankaj

Quoted 39 lines
Quoted 38 lines
---
 drivers/nvdimm/namespace_devs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/nvdimm/namespace_devs.c +5 -1
index a16e52251a30..8e5d29266fb0 100644
@@ -182,8 +182,12 @@ const char *nvdimm_namespace_disk_name(struct
 nd_namespace_common *ndns,
                char *name)
 {
        struct nd_region *nd_region = to_nd_region(ndns->dev.parent);
+       const char *prefix = "";
        const char *suffix = NULL;
 
+       if (!is_nvdimm_sync(nd_region))
+               prefix = "v";
+
        if (ndns->claim && is_nd_btt(ndns->claim))
                suffix = "s";
@@ -201,7 +205,7 @@ const char *nvdimm_namespace_disk_name(struct
 nd_namespace_common *ndns,
                        sprintf(name, "pmem%d.%d%s", nd_region->id, nsidx,
                                        suffix ? suffix : "");
                else
-                       sprintf(name, "pmem%d%s", nd_region->id,
+                       sprintf(name, "%spmem%d%s", prefix, nd_region->id,
                                        suffix ? suffix : "");
        } else if (is_namespace_blk(&ndns->dev)) {
                struct nd_namespace_blk *nsblk;

--
2.20.1