linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 9/9] libnvdimm, label: switch to using v1.2 labels by default
Date: Thu, 08 Jun 2017 22:09:38 -0700	[thread overview]
Message-ID: <149698497813.11651.7323633285531215656.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <149698493023.11651.13036549892428981091.stgit@dwillia2-desk3.amr.corp.intel.com>

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>
---
 drivers/nvdimm/label.c |   10 +++++++---
 1 file 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;

      parent reply	other threads:[~2017-06-09  5:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09  5:08 [PATCH 0/9] libnvdimm, label: namespace specification v1.2 support Dan Williams
2017-06-09  5:08 ` [PATCH 1/9] libnvdimm, label: add v1.2 nvdimm label definitions Dan Williams
2017-06-09  5:09 ` [PATCH 2/9] libnvdimm, label: add v1.2 interleave-set-cookie algorithm Dan Williams
2017-06-09  5:09 ` [PATCH 3/9] libnvdimm, label: honor the lba size specified in v1.2 labels Dan Williams
2017-06-09  5:09 ` [PATCH 4/9] libnvdimm, label: populate the type_guid property for v1.2 namespaces Dan Williams
2017-06-09  5:09 ` [PATCH 5/9] libnvdimm, label: populate 'isetcookie' for blk-aperture namespaces Dan Williams
2017-06-09  5:09 ` [PATCH 6/9] libnvdimm, label: update 'nlabel' and 'position' handling for local namespaces Dan Williams
2017-06-09  5:09 ` [PATCH 7/9] libnvdimm, label: add v1.2 label checksum support Dan Williams
2017-06-09  5:09 ` [PATCH 8/9] libnvdimm, label: add address abstraction identifiers Dan Williams
2017-06-09  5:09 ` Dan Williams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=149698497813.11651.7323633285531215656.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).