diff options
author | Dan Williams <dan.j.williams@intel.com> | 2017-06-07 10:19:46 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2017-06-15 14:31:41 -0700 |
commit | 8990cdf10cf50dc68aaf5a8479b04304d05f1581 (patch) | |
tree | 51456a6d77d3ca90a345d4d952cf392d4a7a5646 /drivers/nvdimm | |
parent | b3fde74ea195d2f9f49830a29f971a0aab4cd67a (diff) | |
download | linux-8990cdf10cf50dc68aaf5a8479b04304d05f1581.tar.bz2 |
libnvdimm, label: switch to using v1.2 labels by default
The rules for which version of the label specification are in effect at
any given point in time are as follows:
1/ If a DIMM has an existing / valid index block then the version
specified is used regardless if it is a previous version.
2/ By default when the kernel is initializing new index blocks the
latest specification version (v1.2 at time of writing) is used.
3/ An environment that wants to force create v1.1 label-sets must
arrange for userspace to disable all active regions / namespaces /
dimms and write a valid set of v1.1 index blocks to the dimms.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm')
-rw-r--r-- | drivers/nvdimm/label.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c index 837bf21c8555..235f2089fab2 100644 --- a/drivers/nvdimm/label.c +++ b/drivers/nvdimm/label.c @@ -222,9 +222,10 @@ int nd_label_validate(struct nvdimm_drvdata *ndd) * need to know the size of the labels, and we can't trust the * size of the labels until we validate the index blocks. * Resolve this dependency loop by probing for known label - * sizes. + * sizes, but default to v1.2 256-byte namespace labels if + * discovery fails. */ - int label_size[] = { 256, 128 }; + int label_size[] = { 128, 256 }; int i, rc; for (i = 0; i < ARRAY_SIZE(label_size); i++) { @@ -532,7 +533,10 @@ static int nd_label_write_index(struct nvdimm_drvdata *ndd, int index, u32 seq, nsindex->labeloff = __cpu_to_le64(offset); nsindex->nslot = __cpu_to_le32(nslot); nsindex->major = __cpu_to_le16(1); - nsindex->minor = __cpu_to_le16(1); + if (sizeof_namespace_label(ndd) < 256) + nsindex->minor = __cpu_to_le16(1); + else + nsindex->minor = __cpu_to_le16(2); nsindex->checksum = __cpu_to_le64(0); if (flags & ND_NSINDEX_INIT) { unsigned long *free = (unsigned long *) nsindex->free; |