diff mbox

[ndctl,7/8] ndctl, create-namespace: fix sector mode default for pmem namespaces

Message ID 146135445871.4228.1090587699596226202.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State Accepted
Commit d83f7b2b34ec
Headers show

Commit Message

Dan Williams April 22, 2016, 7:47 p.m. UTC
The man page uses the following example for establishing a sector mode
namespace:

    ndctl create-namespace -e namespace0.0 -f -m sector

...however this only works for blk-type namespaces to inherit a default
sector size.  Default to 4K in the pmem-type namespaces.

Reported-by: Linda Knippers <linda.knippers@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 builtin-xaction-namespace.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Linda Knippers April 22, 2016, 11:07 p.m. UTC | #1
On 4/22/2016 3:47 PM, Dan Williams wrote:
> The man page uses the following example for establishing a sector mode
> namespace:
> 
>     ndctl create-namespace -e namespace0.0 -f -m sector
> 
> ...however this only works for blk-type namespaces to inherit a default
> sector size.  Default to 4K in the pmem-type namespaces.
> 
> Reported-by: Linda Knippers <linda.knippers@hpe.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Thanks Dan.
Tested-by: Linda Knippers <linda.knippers@hpe.com>

> ---
>  builtin-xaction-namespace.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c
> index 7d555a7d14a1..6ae8d7aee849 100644
> --- a/builtin-xaction-namespace.c
> +++ b/builtin-xaction-namespace.c
> @@ -410,6 +410,8 @@ static int validate_namespace_options(struct ndctl_namespace *ndns,
>  		else if (ndctl_namespace_get_type(ndns)
>  				== ND_DEVICE_NAMESPACE_BLK)
>  			p->sector_size = ndctl_namespace_get_sector_size(ndns);
> +		else if (p->mode == NDCTL_NS_MODE_SAFE)
> +				p->sector_size = 4096;
>  	}
>  
>  	if (param.map) {
>
diff mbox

Patch

diff --git a/builtin-xaction-namespace.c b/builtin-xaction-namespace.c
index 7d555a7d14a1..6ae8d7aee849 100644
--- a/builtin-xaction-namespace.c
+++ b/builtin-xaction-namespace.c
@@ -410,6 +410,8 @@  static int validate_namespace_options(struct ndctl_namespace *ndns,
 		else if (ndctl_namespace_get_type(ndns)
 				== ND_DEVICE_NAMESPACE_BLK)
 			p->sector_size = ndctl_namespace_get_sector_size(ndns);
+		else if (p->mode == NDCTL_NS_MODE_SAFE)
+				p->sector_size = 4096;
 	}
 
 	if (param.map) {