Skip to contentSkip to conversation

ndctl: Use the same align value as original namespace on reconfigure

PATCH In review Aneesh Kumar K.V 2 participants 6 messages Aug 7, 2019 – Oct 18, 2019 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ndctl: Use the same align value as original namespace on reconfigure

When using reconfigure command to add a name to the namespace we end up updating the align attribute. Avoid this by using the value from the original namespace. Do this only if we are keeping the namespace mode same.

---
 ndctl/namespace.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
ndctl/namespace.c +16 -0
index 1f212a2b3a9b..24e51bb35ae1 100644
@@ -596,6 +596,22 @@ static int validate_namespace_options(struct ndctl_region *region,
 			return -ENXIO;
 		}
 	} else {
+
+		/*
+		 * If we are tryint to reconfigure with the same namespace mode
+		 * Use the align details from the origin namespace. Otherwise
+		 * pick the align details from seed namespace
+		 */
+		if (ndns && p->mode == ndctl_namespace_get_mode(ndns)) {
+			struct ndctl_pfn *ns_pfn = ndctl_namespace_get_pfn(ndns);
+			struct ndctl_dax *ns_dax = ndctl_namespace_get_dax(ndns);
+			if (ns_pfn)
+				p->align = ndctl_pfn_get_align(ns_pfn);
+			else if (ns_dax)
+				p->align = ndctl_dax_get_align(ns_dax);
+			else
+				p->align = sysconf(_SC_PAGE_SIZE);
+		} else
 		/*
 		 * Use the seed namespace alignment as the default if we need
 		 * one. If we don't then use PAGE_SIZE so the size_align
Signature · 6 lines
2.21.0

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

Hi Dan/Vishal,

Any update on this?

-aneesh

Quoted 39 lines · Aneesh Kumar K.V

When using reconfigure command to add a name to the namespace we end up updating the align attribute. Avoid this by using the value from the original namespace. Do this only if we are keeping the namespace mode same.

---
 ndctl/namespace.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
ndctl/namespace.c +16 -0
index 1f212a2b3a9b..24e51bb35ae1 100644
@@ -596,6 +596,22 @@ static int validate_namespace_options(struct ndctl_region *region,
 			return -ENXIO;
 		}
 	} else {
+
+		/*
+		 * If we are tryint to reconfigure with the same namespace mode
+		 * Use the align details from the origin namespace. Otherwise
+		 * pick the align details from seed namespace
+		 */
+		if (ndns && p->mode == ndctl_namespace_get_mode(ndns)) {
+			struct ndctl_pfn *ns_pfn = ndctl_namespace_get_pfn(ndns);
+			struct ndctl_dax *ns_dax = ndctl_namespace_get_dax(ndns);
+			if (ns_pfn)
+				p->align = ndctl_pfn_get_align(ns_pfn);
+			else if (ns_dax)
+				p->align = ndctl_dax_get_align(ns_dax);
+			else
+				p->align = sysconf(_SC_PAGE_SIZE);
+		} else
 		/*
 		 * Use the seed namespace alignment as the default if we need
 		 * one. If we don't then use PAGE_SIZE so the size_align
Signature · 1 line
2.21.0

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

maintainer
#2 lore raw
In reply to Aneesh Kumar K.V
Quoted 9 lines · Aneesh Kumar K.V

When using reconfigure command to add a name to the namespace we end up updating the align attribute. Avoid this by using the value from the original namespace. Do this only if we are keeping the namespace mode same.

---
 ndctl/namespace.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Hi Aneesh,

A few comments below:

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 601

Quoted 12 lines
ndctl/namespace.c +3 -0
index 1f212a2b3a9b..24e51bb35ae1 100644
@@ -596,6 +596,22 @@ static int validate_namespace_options(struct ndctl_region *region,
 			return -ENXIO;
 		}
 	} else {
+
+		/*
+		 * If we are tryint to reconfigure with the same namespace mode

^trying

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 602

Quoted 1 line
ndctl/namespace.c +1 -0
+		 * Use the align details from the origin namespace. Otherwise

s/origin/original/

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 605

Quoted 3 lines
ndctl/namespace.c +3 -0
+		 * pick the align details from seed namespace
+		 */
+		if (ndns && p->mode == ndctl_namespace_get_mode(ndns)) {

Do we need to depend on the mode here?

I'm thinking it should be sufficient to do:
1. Check We're in 'reconfigure'
2. Check param.align was not supplied
3. Get alignment from the pfn/dax personality, and just use that.

Does this make sense (Maybe I'm missing something).

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 613

Quoted 8 lines
ndctl/namespace.c +8 -0
+			struct ndctl_pfn *ns_pfn = ndctl_namespace_get_pfn(ndns);
+			struct ndctl_dax *ns_dax = ndctl_namespace_get_dax(ndns);
+			if (ns_pfn)
+				p->align = ndctl_pfn_get_align(ns_pfn);
+			else if (ns_dax)
+				p->align = ndctl_dax_get_align(ns_dax);
+			else
+				p->align = sysconf(_SC_PAGE_SIZE);

Do we need the page size fallback here - there are other checks after this point that also do a similar fallback, do they not catch the default case?

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 617

Quoted 4 lines
ndctl/namespace.c +1 -0
+		} else
 		/*
 		 * Use the seed namespace alignment as the default if we need
 		 * one. If we don't then use PAGE_SIZE so the size_align

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

#3 lore raw
Quoted 40 lines · Vishal L
Quoted 9 lines · Aneesh Kumar K.V

When using reconfigure command to add a name to the namespace we end up updating the align attribute. Avoid this by using the value from the original namespace. Do this only if we are keeping the namespace mode same.

---
 ndctl/namespace.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Hi Aneesh,

A few comments below:

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 601

Quoted 12 lines
ndctl/namespace.c +3 -0
index 1f212a2b3a9b..24e51bb35ae1 100644
@@ -596,6 +596,22 @@ static int validate_namespace_options(struct ndctl_region *region,
 			return -ENXIO;
 		}
 	} else {
+
+		/*
+		 * If we are tryint to reconfigure with the same namespace mode

^trying

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 602

Quoted 1 line
ndctl/namespace.c +1 -0
+		 * Use the align details from the origin namespace. Otherwise

s/origin/original/

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 605

Quoted 3 lines
ndctl/namespace.c +3 -0
+		 * pick the align details from seed namespace
+		 */
+		if (ndns && p->mode == ndctl_namespace_get_mode(ndns)) {

Do we need to depend on the mode here?

Quoted 6 lines

I'm thinking it should be sufficient to do:
1. Check We're in 'reconfigure'
2. Check param.align was not supplied
3. Get alignment from the pfn/dax personality, and just use that.

Does this make sense (Maybe I'm missing something).

We want to use the align value from the seed when we are trying to reconfigure a namespace with a different mode. ie, if we are moving a fsdax namespace with align value 64K to a devdax, IMHO we should pick 16M as alignment for devdax.

Quoted 13 lines

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 613

Quoted 9 lines
ndctl/namespace.c +8 -0
+			struct ndctl_pfn *ns_pfn = ndctl_namespace_get_pfn(ndns);
+			struct ndctl_dax *ns_dax = ndctl_namespace_get_dax(ndns);
+			if (ns_pfn)
+				p->align = ndctl_pfn_get_align(ns_pfn);
+			else if (ns_dax)
+				p->align = ndctl_dax_get_align(ns_dax);
+			else
+				p->align = sysconf(_SC_PAGE_SIZE);

Do we need the page size fallback here - there are other checks after this point that also do a similar fallback, do they not catch the default case?

I did that to simplify the code with that else if

Quoted 5 lines

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 617

Quoted 5 lines
ndctl/namespace.c +1 -0
+		} else
 		/*
 		 * Use the seed namespace alignment as the default if we need
 		 * one. If we don't then use PAGE_SIZE so the size_align

-aneesh

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

#4 lore raw
Quoted 69 lines · Aneesh Kumar K.V
Quoted 40 lines · Vishal L
Quoted 9 lines · Aneesh Kumar K.V

When using reconfigure command to add a name to the namespace we end up updating the align attribute. Avoid this by using the value from the original namespace. Do this only if we are keeping the namespace mode same.

---
 ndctl/namespace.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Hi Aneesh,

A few comments below:

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 601

Quoted 12 lines
ndctl/namespace.c +3 -0
index 1f212a2b3a9b..24e51bb35ae1 100644
@@ -596,6 +596,22 @@ static int validate_namespace_options(struct ndctl_region *region,
 			return -ENXIO;
 		}
 	} else {
+
+		/*
+		 * If we are tryint to reconfigure with the same namespace mode

^trying

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 602

Quoted 1 line
ndctl/namespace.c +1 -0
+		 * Use the align details from the origin namespace. Otherwise

s/origin/original/

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 605

Quoted 3 lines
ndctl/namespace.c +3 -0
+		 * pick the align details from seed namespace
+		 */
+		if (ndns && p->mode == ndctl_namespace_get_mode(ndns)) {

Do we need to depend on the mode here?

Quoted 6 lines

I'm thinking it should be sufficient to do:
1. Check We're in 'reconfigure'
2. Check param.align was not supplied
3. Get alignment from the pfn/dax personality, and just use that.

Does this make sense (Maybe I'm missing something).

We want to use the align value from the seed when we are trying to reconfigure a namespace with a different mode. ie, if we are moving a fsdax namespace with align value 64K to a devdax, IMHO we should pick 16M as alignment for devdax.

Quoted 13 lines

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 613

Quoted 9 lines
ndctl/namespace.c +8 -0
+			struct ndctl_pfn *ns_pfn = ndctl_namespace_get_pfn(ndns);
+			struct ndctl_dax *ns_dax = ndctl_namespace_get_dax(ndns);
+			if (ns_pfn)
+				p->align = ndctl_pfn_get_align(ns_pfn);
+			else if (ns_dax)
+				p->align = ndctl_dax_get_align(ns_dax);
+			else
+				p->align = sysconf(_SC_PAGE_SIZE);

Do we need the page size fallback here - there are other checks after this point that also do a similar fallback, do they not catch the default case?

Quoted 7 lines

I did that to simplify the code with that else if

Quoted 5 lines

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 617

Quoted 5 lines
ndctl/namespace.c +1 -0
+		} else
 		/*
 		 * Use the seed namespace alignment as the default if we need
 		 * one. If we don't then use PAGE_SIZE so the size_align

Any update on this.?

-aneesh
_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]

maintainer
#5 lore raw
Quoted 68 lines · Aneesh Kumar K.V
Quoted 66 lines · Aneesh Kumar K.V
Quoted 39 lines · Vishal L
Quoted 9 lines · Aneesh Kumar K.V

When using reconfigure command to add a name to the namespace we end up updating the align attribute. Avoid this by using the value from the original namespace. Do this only if we are keeping the namespace mode same.

---
 ndctl/namespace.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Hi Aneesh,

A few comments below:

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 601

Quoted 11 lines
ndctl/namespace.c +3 -0
index 1f212a2b3a9b..24e51bb35ae1 100644
@@ -596,6 +596,22 @@ static int validate_namespace_options(struct ndctl_region *region,
 			return -ENXIO;
 		}
 	} else {
+
+		/*
+		 * If we are tryint to reconfigure with the same namespace mode

^trying

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 602

Quoted 1 line
ndctl/namespace.c +1 -0
+		 * Use the align details from the origin namespace. Otherwise

s/origin/original/

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 605

Quoted 3 lines
ndctl/namespace.c +3 -0
+		 * pick the align details from seed namespace
+		 */
+		if (ndns && p->mode == ndctl_namespace_get_mode(ndns)) {

Do we need to depend on the mode here?

Quoted 6 lines

I'm thinking it should be sufficient to do:
1. Check We're in 'reconfigure'
2. Check param.align was not supplied
3. Get alignment from the pfn/dax personality, and just use that.

Does this make sense (Maybe I'm missing something).

We want to use the align value from the seed when we are trying to reconfigure a namespace with a different mode. ie, if we are moving a fsdax namespace with align value 64K to a devdax, IMHO we should pick 16M as alignment for devdax.

Quoted 12 lines

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 613

Quoted 8 lines
ndctl/namespace.c +8 -0
+			struct ndctl_pfn *ns_pfn = ndctl_namespace_get_pfn(ndns);
+			struct ndctl_dax *ns_dax = ndctl_namespace_get_dax(ndns);
+			if (ns_pfn)
+				p->align = ndctl_pfn_get_align(ns_pfn);
+			else if (ns_dax)
+				p->align = ndctl_dax_get_align(ns_dax);
+			else
+				p->align = sysconf(_SC_PAGE_SIZE);

Do we need the page size fallback here - there are other checks after this point that also do a similar fallback, do they not catch the default case?

Quoted 8 lines
Quoted 6 lines

I did that to simplify the code with that else if

Quoted 4 lines

ndctl/namespace.c static int validate_namespace_options(struct ndctl_region *region, · line 617

Quoted 4 lines
ndctl/namespace.c +1 -0
+		} else
 		/*
 		 * Use the seed namespace alignment as the default if we need
 		 * one. If we don't then use PAGE_SIZE so the size_align

Any update on this.?

Yes - I've applied it to the pending branch, and it will be in v67.

_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]