Skip to contentSkip to conversation

ndctl: update .gitignore

PATCH In review Ross Zwisler 3 participants 9 messages Jan 25, 2018 – Jan 29, 2018 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ndctl: update .gitignore

I noticed that my 'git status' output was quite noisy. Here's what I get with a full build using the suggested
./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 command and with some cscope files built:

  $ git status
  On branch pending
  Your branch is up-to-date with 'github/pending'.

Untracked files:
(use "git add <file>..." to include in what will be committed)

Documentation/daxctl/asciidoc.conf Documentation/daxctl/daxctl-io.1 Documentation/daxctl/daxctl-list.1 Documentation/daxctl/daxctl.1 Documentation/ndctl/asciidoc.conf Documentation/ndctl/ndctl-check-labels.1 Documentation/ndctl/ndctl-check-namespace.1 Documentation/ndctl/ndctl-create-namespace.1 Documentation/ndctl/ndctl-destroy-namespace.1 Documentation/ndctl/ndctl-disable-dimm.1 Documentation/ndctl/ndctl-disable-namespace.1 Documentation/ndctl/ndctl-disable-region.1 Documentation/ndctl/ndctl-enable-dimm.1 Documentation/ndctl/ndctl-enable-namespace.1 Documentation/ndctl/ndctl-enable-region.1 Documentation/ndctl/ndctl-init-labels.1 Documentation/ndctl/ndctl-inject-error.1 Documentation/ndctl/ndctl-list.1 Documentation/ndctl/ndctl-read-labels.1 Documentation/ndctl/ndctl-write-labels.1 Documentation/ndctl/ndctl-zero-labels.1 Documentation/ndctl/ndctl.1 ccan/list/.dirstamp ccan/str/.dirstamp
cscope.files
cscope.out
daxctl/daxctl
daxctl/lib/libdaxctl.la daxctl/lib/libdaxctl.lo daxctl/lib/libdaxctl.pc
libccan.a
libutil.a
ndctl/lib/libndctl.pc
ndctl/ndctl
ndctl/util/.dirstamp
rhel/
sles/ndctl.spec
util/.dirstamp
util/log.lo
util/sysfs.lo
version.m4

nothing added to commit but untracked files present (use "git add" to track)

---
 .gitignore | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
.gitignore +19 -0
index 4899534..64e58fa 100644
@@ -12,3 +12,22 @@ Makefile.in
 /configure
 /libtool
 /stamp-h1
+*.1
+Documentation/daxctl/asciidoc.conf
+Documentation/ndctl/asciidoc.conf
+.dirstamp
+daxctl/daxctl
+daxctl/lib/libdaxctl.la
+daxctl/lib/libdaxctl.lo
+daxctl/lib/libdaxctl.pc
+*.a
+ndctl/lib/libndctl.pc
+ndctl/ndctl
+rhel/
+sles/ndctl.spec
+util/log.lo
+util/sysfs.lo
+version.m4
+*.swp
+cscope.files
+cscope.out
Signature · 6 lines
2.14.3

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
#1 lore raw

PATCH 2/2 ndctl: add sector_size to 'ndctl list' output

It used to be that the only PMEM namespaces with a variable sector size were ones with a BTT, but that has changed. sector_size still doesn't make sense for device DAX since we don't have a block I/O path, and we also skip it if we don't have a specified sector size, as happens with namespaces of devtype nd_namespace_io.

---
 util/json.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
util/json.c +17 -5
index 95beaa2..89306f0 100644
@@ -718,11 +718,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 			goto err;
 		json_object_object_add(jndns, "uuid", jobj);
 
-		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
-		if (!jobj)
-			goto err;
-		json_object_object_add(jndns, "sector_size", jobj);
-
 		bdev = ndctl_btt_get_block_device(btt);
 	} else if (pfn) {
 		ndctl_pfn_get_uuid(pfn, uuid);
@@ -774,6 +769,23 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 	} else
 		bdev = ndctl_namespace_get_block_device(ndns);
 
+	jobj = NULL;
+	if (btt) {
+		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
+		if (!jobj)
+			goto err;
+	} else if (!dax) {
+		unsigned int sector_size = ndctl_namespace_get_sector_size(ndns);
+
+		if (sector_size) {
+			jobj = json_object_new_int(sector_size);
+			if (!jobj)
+				goto err;
+		}
+	}
+	if (jobj)
+		json_object_object_add(jndns, "sector_size", jobj);
+
 	if (bdev && bdev[0]) {
 		jobj = json_object_new_string(bdev);
 		if (!jobj)
Signature · 6 lines
2.14.3

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [ndctl PATCH 2/2] ndctl: add sector_size to 'ndctl list' output

Quoted 7 lines · Ross Zwisler

It used to be that the only PMEM namespaces with a variable sector size were ones with a BTT, but that has changed. sector_size still doesn't make sense for device DAX since we don't have a block I/O path, and we also skip it if we don't have a specified sector size, as happens with namespaces of devtype nd_namespace_io.

Quoted 35 lines
---
  util/json.c | 22 +++++++++++++++++-----
  1 file changed, 17 insertions(+), 5 deletions(-)
util/json.c +10 -5
index 95beaa2..89306f0 100644
@@ -718,11 +718,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
  			goto err;
  		json_object_object_add(jndns, "uuid", jobj);
 
-		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
-		if (!jobj)
-			goto err;
-		json_object_object_add(jndns, "sector_size", jobj);
-
  		bdev = ndctl_btt_get_block_device(btt);
  	} else if (pfn) {
  		ndctl_pfn_get_uuid(pfn, uuid);
@@ -774,6 +769,23 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
  	} else
  		bdev = ndctl_namespace_get_block_device(ndns);
 
+	jobj = NULL;
+	if (btt) {
+		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
+		if (!jobj)
+			goto err;
+	} else if (!dax) {
+		unsigned int sector_size = ndctl_namespace_get_sector_size(ndns);
+
+		if (sector_size) {
+			jobj = json_object_new_int(sector_size);

util/json.c struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns, · line 791

Quoted 10 lines
util/json.c +7 -0
+			if (!jobj)
+				goto err;
+		}
+	}
+	if (jobj)
+		json_object_object_add(jndns, "sector_size", jobj);
+
  	if (bdev && bdev[0]) {
  		jobj = json_object_new_string(bdev);
  		if (!jobj)

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#3 lore raw

PATCH v2 2/2 ndctl: add sector_size to 'ndctl list' output

In reply to Ross Zwisler

It used to be that the only PMEM namespaces with a variable sector size were ones with a BTT, but that has changed. sector_size still doesn't make sense for device DAX since we don't have a block I/O path.

If we don't have a specified sector size, as happens with namespaces of devtype nd_namespace_io and older v1.1 namespace labels, we will display the default sector size of 512.

---
 util/json.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
util/json.c +18 -5
index 95beaa2..647bf03 100644
@@ -718,11 +718,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 			goto err;
 		json_object_object_add(jndns, "uuid", jobj);
 
-		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
-		if (!jobj)
-			goto err;
-		json_object_object_add(jndns, "sector_size", jobj);
-
 		bdev = ndctl_btt_get_block_device(btt);
 	} else if (pfn) {
 		ndctl_pfn_get_uuid(pfn, uuid);
@@ -774,6 +769,24 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 	} else
 		bdev = ndctl_namespace_get_block_device(ndns);
 
+	jobj = NULL;
+	if (btt) {
+		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
+		if (!jobj)
+			goto err;
+	} else if (!dax) {
+		unsigned int sector_size = ndctl_namespace_get_sector_size(ndns);
+
+		if (!sector_size)
+			sector_size = 512;
+
+		jobj = json_object_new_int(sector_size);
+		if (!jobj)
+			goto err;
+	}
+	if (jobj)
+		json_object_object_add(jndns, "sector_size", jobj);
+
 	if (bdev && bdev[0]) {
 		jobj = json_object_new_string(bdev);
 		if (!jobj)
Signature · 6 lines
2.14.3

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
maintainer Reviewed-by on v2 2/2
#4 lore raw

Re: [ndctl PATCH v2 2/2] ndctl: add sector_size to 'ndctl list' output

Quoted 9 lines · Ross Zwisler

It used to be that the only PMEM namespaces with a variable sector size were ones with a BTT, but that has changed. sector_size still doesn't make sense for device DAX since we don't have a block I/O path.

If we don't have a specified sector size, as happens with namespaces of devtype nd_namespace_io and older v1.1 namespace labels, we will display the default sector size of 512.

Quoted 36 lines
---
  util/json.c | 23 ++++++++++++++++++-----
  1 file changed, 18 insertions(+), 5 deletions(-)
util/json.c +11 -5
index 95beaa2..647bf03 100644
@@ -718,11 +718,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
  			goto err;
  		json_object_object_add(jndns, "uuid", jobj);
 
-		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
-		if (!jobj)
-			goto err;
-		json_object_object_add(jndns, "sector_size", jobj);
-
  		bdev = ndctl_btt_get_block_device(btt);
  	} else if (pfn) {
  		ndctl_pfn_get_uuid(pfn, uuid);
@@ -774,6 +769,24 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
  	} else
  		bdev = ndctl_namespace_get_block_device(ndns);
 
+	jobj = NULL;
+	if (btt) {
+		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
+		if (!jobj)
+			goto err;
+	} else if (!dax) {
+		unsigned int sector_size = ndctl_namespace_get_sector_size(ndns);
+
+		if (!sector_size)
+			sector_size = 512;
+

util/json.c struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns, · line 792

Quoted 10 lines
util/json.c +7 -0
+		jobj = json_object_new_int(sector_size);
+		if (!jobj)
+			goto err;
+	}
+	if (jobj)
+		json_object_object_add(jndns, "sector_size", jobj);
+
  	if (bdev && bdev[0]) {
  		jobj = json_object_new_string(bdev);
  		if (!jobj)

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#5 lore raw

Re: [ndctl PATCH v2 2/2] ndctl: add sector_size to 'ndctl list' output

In reply to Ross Zwisler
Quoted 31 lines · Ross Zwisler

It used to be that the only PMEM namespaces with a variable sector size were ones with a BTT, but that has changed. sector_size still doesn't make sense for device DAX since we don't have a block I/O path.

If we don't have a specified sector size, as happens with namespaces of devtype nd_namespace_io and older v1.1 namespace labels, we will display the default sector size of 512.

---
 util/json.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
util/json.c +0 -5
index 95beaa2..647bf03 100644
@@ -718,11 +718,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
                        goto err;
                json_object_object_add(jndns, "uuid", jobj);
 
-               jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
-               if (!jobj)
-                       goto err;
-               json_object_object_add(jndns, "sector_size", jobj);
-
                bdev = ndctl_btt_get_block_device(btt);
        } else if (pfn) {
                ndctl_pfn_get_uuid(pfn, uuid);
@@ -774,6 +769,24 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
        } else

util/json.c struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns, · line 779

Quoted 10 lines
util/json.c +8 -0
                bdev = ndctl_namespace_get_block_device(ndns);
 
+       jobj = NULL;
+       if (btt) {
+               jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
+               if (!jobj)
+                       goto err;
+       } else if (!dax) {
+               unsigned int sector_size = ndctl_namespace_get_sector_size(ndns);
+

I'd put a comment here that says on kernel's that do not export a sector_size attribute, or if userspace fails to select a dynamic sector_size, the kernel default size is 512.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#6 lore raw

PATCH v3 2/2 ndctl: add sector_size to 'ndctl list' output

It used to be that the only PMEM namespaces with a variable sector size were ones with a BTT, but that has changed. sector_size still doesn't make sense for device DAX since we don't have a block I/O path.

If we don't have a specified sector size, as happens with namespaces of devtype nd_namespace_io and older v1.1 namespace labels, we will display the default sector size of 512.

---
 util/json.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
util/json.c +24 -5
index 95beaa2..17d8f13 100644
@@ -718,11 +718,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 			goto err;
 		json_object_object_add(jndns, "uuid", jobj);
 
-		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
-		if (!jobj)
-			goto err;
-		json_object_object_add(jndns, "sector_size", jobj);
-
 		bdev = ndctl_btt_get_block_device(btt);
 	} else if (pfn) {
 		ndctl_pfn_get_uuid(pfn, uuid);
@@ -774,6 +769,30 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 	} else
 		bdev = ndctl_namespace_get_block_device(ndns);
 
+	jobj = NULL;
+	if (btt) {
+		jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
+		if (!jobj)
+			goto err;
+	} else if (!dax) {
+		unsigned int sector_size = ndctl_namespace_get_sector_size(ndns);
+
+		/*
+		 * The kernel will default to a 512 byte sector size on PMEM
+		 * namespaces that don't explicitly have a sector size. This
+		 * happens because they use pre-v1.2 labels or because they
+		 * don't have a label space (devtype=nd_namespace_io).
+		 */
+		if (!sector_size)
+			sector_size = 512;
+
+		jobj = json_object_new_int(sector_size);
+		if (!jobj)
+			goto err;
+	}
+	if (jobj)
+		json_object_object_add(jndns, "sector_size", jobj);
+
 	if (bdev && bdev[0]) {
 		jobj = json_object_new_string(bdev);
 		if (!jobj)
Signature · 6 lines
2.14.3

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm
Reviewed-by on v3 2/2
#7 lore raw

Re: [ndctl PATCH v3 2/2] ndctl: add sector_size to 'ndctl list' output

Quoted 62 lines · Ross Zwisler

It used to be that the only PMEM namespaces with a variable sector size were ones with a BTT, but that has changed. sector_size still doesn't make sense for device DAX since we don't have a block I/O path.

If we don't have a specified sector size, as happens with namespaces of devtype nd_namespace_io and older v1.1 namespace labels, we will display the default sector size of 512.

---
 util/json.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)
util/json.c +24 -6
index 95beaa2..17d8f13 100644
@@ -718,11 +718,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
                        goto err;
                json_object_object_add(jndns, "uuid", jobj);
 
-               jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
-               if (!jobj)
-                       goto err;
-               json_object_object_add(jndns, "sector_size", jobj);
-
                bdev = ndctl_btt_get_block_device(btt);
        } else if (pfn) {
                ndctl_pfn_get_uuid(pfn, uuid);
@@ -774,6 +769,30 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
        } else
                bdev = ndctl_namespace_get_block_device(ndns);
 
+       jobj = NULL;
+       if (btt) {
+               jobj = json_object_new_int(ndctl_btt_get_sector_size(btt));
+               if (!jobj)
+                       goto err;
+       } else if (!dax) {
+               unsigned int sector_size = ndctl_namespace_get_sector_size(ndns);
+
+               /*
+                * The kernel will default to a 512 byte sector size on PMEM
+                * namespaces that don't explicitly have a sector size. This
+                * happens because they use pre-v1.2 labels or because they
+                * don't have a label space (devtype=nd_namespace_io).
+                */
+               if (!sector_size)
+                       sector_size = 512;
+
+               jobj = json_object_new_int(sector_size);
+               if (!jobj)
+                       goto err;
+       }
+       if (jobj)
+               json_object_object_add(jndns, "sector_size", jobj);
+
        if (bdev && bdev[0]) {
                jobj = json_object_new_string(bdev);
                if (!jobj)
--
Quoted 2 lines

2.14.3

Looks good to me, you can add:

_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm

#8 lore raw
In reply to Ross Zwisler
Quoted 54 lines · Ross Zwisler

I noticed that my 'git status' output was quite noisy. Here's what I get with a full build using the suggested
./configure CFLAGS='-g -O0' --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib64 command and with some cscope files built:

  $ git status
  On branch pending
  Your branch is up-to-date with 'github/pending'.

Untracked files:
(use "git add <file>..." to include in what will be committed)

Documentation/daxctl/asciidoc.conf Documentation/daxctl/daxctl-io.1 Documentation/daxctl/daxctl-list.1 Documentation/daxctl/daxctl.1 Documentation/ndctl/asciidoc.conf Documentation/ndctl/ndctl-check-labels.1 Documentation/ndctl/ndctl-check-namespace.1 Documentation/ndctl/ndctl-create-namespace.1 Documentation/ndctl/ndctl-destroy-namespace.1 Documentation/ndctl/ndctl-disable-dimm.1 Documentation/ndctl/ndctl-disable-namespace.1 Documentation/ndctl/ndctl-disable-region.1 Documentation/ndctl/ndctl-enable-dimm.1 Documentation/ndctl/ndctl-enable-namespace.1 Documentation/ndctl/ndctl-enable-region.1 Documentation/ndctl/ndctl-init-labels.1 Documentation/ndctl/ndctl-inject-error.1 Documentation/ndctl/ndctl-list.1 Documentation/ndctl/ndctl-read-labels.1 Documentation/ndctl/ndctl-write-labels.1 Documentation/ndctl/ndctl-zero-labels.1 Documentation/ndctl/ndctl.1 ccan/list/.dirstamp ccan/str/.dirstamp
cscope.files
cscope.out
daxctl/daxctl
daxctl/lib/libdaxctl.la daxctl/lib/libdaxctl.lo daxctl/lib/libdaxctl.pc
libccan.a
libutil.a
ndctl/lib/libndctl.pc
ndctl/ndctl
ndctl/util/.dirstamp
rhel/
sles/ndctl.spec
util/.dirstamp
util/log.lo
util/sysfs.lo
version.m4

Quoted 1 line

nothing added to commit but untracked files present (use "git add" to track)

Looks good to me, you can tell I don't use 'git status' in my workflow.
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm