On Thu, Aug 4, 2016 at 8:32 AM, Dan Williams <[email protected]> wrote:
> While the kernel will prevent invalid configurations, the user
> experience of a kernel error message and disabling of the namespace is
> too harsh.  Trap and report these attempts to make create-namespace more
> user friendly.
>
>     # ndctl create-namespace -e namespace0.0 -m sector -l 513 -f -v
>     validate_namespace_options:437: region0: does not support btt sector_size 
> 513
>     failed to reconfigure namespace
>
> Reported-by: Yi Zhang <[email protected]>
> Signed-off-by: Dan Williams <[email protected]>
> ---
>  ndctl/builtin-xaction-namespace.c |   40 
> +++++++++++++++++++++++++++++++------
>  1 file changed, 34 insertions(+), 6 deletions(-)

Unit tests say we also need the following so that we don't try to set
a sector size on pmem namespaces.

diff --git a/ndctl/builtin-xaction-namespace.c
b/ndctl/builtin-xaction-namespace.c
index e136bfdefa39..35345fb26ec3 100644
--- a/ndctl/builtin-xaction-namespace.c
+++ b/ndctl/builtin-xaction-namespace.c
@@ -210,8 +210,13 @@ static int set_defaults(enum namespace_action mode)
                        error("'pmem' namespaces do not support
setting 'sector size'\n");
                        rc = -EINVAL;
                }
-       } else if (!param.reconfig)
-               param.sector_size = "4096";
+       } else if (!param.reconfig
+                       && (param.type && strcmp(param.type, "blk") == 0
+                               || (param.mode
+                                       && strcmp(param.mode, "safe") == 0))) {
+                       /* default sector size for blk-type or safe-mode */
+                       param.sector_size = "4096";
+       }

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

Reply via email to