* [ndctl PATCH] ndctl: fix the default BTT sector size for reconfig
@ 2018-01-29 20:22 Vishal Verma
2018-01-29 20:46 ` Dan Williams
2018-01-29 21:25 ` Ross Zwisler
0 siblings, 2 replies; 3+ messages in thread
From: Vishal Verma @ 2018-01-29 20:22 UTC (permalink / raw)
To: linux-nvdimm
reconfig attempted to reuse the 'previous' value for sector-size when
reconfiguring to a BTT mode or blk type namespace, but this may not
always be valid (for example when coming from a memory mode namespace).
Instead, when reconfiguring to BTT or blk, always default to 4096
unless a sector size is explicitly provided.
Cc: Dan Williams <dan.j.williams@intel.com>
Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Tested-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
ndctl/namespace.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index c793ba3..ceb9e7a 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -244,12 +244,10 @@ static int set_defaults(enum device_action mode)
error("invalid sector size: %s\n", param.sector_size);
rc = -EINVAL;
}
- } 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";
+ } else if (((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;
--
2.14.3
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [ndctl PATCH] ndctl: fix the default BTT sector size for reconfig
2018-01-29 20:22 [ndctl PATCH] ndctl: fix the default BTT sector size for reconfig Vishal Verma
@ 2018-01-29 20:46 ` Dan Williams
2018-01-29 21:25 ` Ross Zwisler
1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2018-01-29 20:46 UTC (permalink / raw)
To: Vishal Verma; +Cc: linux-nvdimm
On Mon, Jan 29, 2018 at 12:22 PM, Vishal Verma <vishal.l.verma@intel.com> wrote:
> reconfig attempted to reuse the 'previous' value for sector-size when
> reconfiguring to a BTT mode or blk type namespace, but this may not
> always be valid (for example when coming from a memory mode namespace).
> Instead, when reconfiguring to BTT or blk, always default to 4096
> unless a sector size is explicitly provided.
>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Tested-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
> ndctl/namespace.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index c793ba3..ceb9e7a 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -244,12 +244,10 @@ static int set_defaults(enum device_action mode)
> error("invalid sector size: %s\n", param.sector_size);
> rc = -EINVAL;
> }
> - } 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";
> + } else if (((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";
Looks good to me.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ndctl PATCH] ndctl: fix the default BTT sector size for reconfig
2018-01-29 20:22 [ndctl PATCH] ndctl: fix the default BTT sector size for reconfig Vishal Verma
2018-01-29 20:46 ` Dan Williams
@ 2018-01-29 21:25 ` Ross Zwisler
1 sibling, 0 replies; 3+ messages in thread
From: Ross Zwisler @ 2018-01-29 21:25 UTC (permalink / raw)
To: Vishal Verma; +Cc: linux-nvdimm
On Mon, Jan 29, 2018 at 01:22:36PM -0700, Vishal Verma wrote:
> reconfig attempted to reuse the 'previous' value for sector-size when
> reconfiguring to a BTT mode or blk type namespace, but this may not
> always be valid (for example when coming from a memory mode namespace).
> Instead, when reconfiguring to BTT or blk, always default to 4096
> unless a sector size is explicitly provided.
>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> Tested-by: Dave Jiang <dave.jiang@intel.com>
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Yep, this both allows the btt namespace creation to continue and, if the user
does actually specify a bogus sector size, i.e.:
# ./ndctl/ndctl create-namespace -f -e namespace0.0 --mode=sector -l0
failed to reconfigure namespace: Invalid argument
It prevents us from leaving our namespace in a zombie state where it is still
there but doesn't show up in 'ndctl list'.
Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-29 21:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29 20:22 [ndctl PATCH] ndctl: fix the default BTT sector size for reconfig Vishal Verma
2018-01-29 20:46 ` Dan Williams
2018-01-29 21:25 ` Ross Zwisler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).