All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [PATCH 2/2] ndctl, create-namespace: skip attempts to set 'align' on older kernels
Date: Wed, 09 Nov 2016 17:28:20 -0800	[thread overview]
Message-ID: <147874130070.37588.7156973366536136882.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <147874129531.37588.12721076898149272280.stgit@dwillia2-desk3.amr.corp.intel.com>

Prior to 4.5 kernel the 'align' attribute for pfn devices did not exist.
Skip attempts to set it on those kernels.

Link: https://github.com/pmem/ndctl/issues/7
Reported-by: Yigal Korman <yigal@plexistor.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 ndctl/builtin-xaction-namespace.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/ndctl/builtin-xaction-namespace.c b/ndctl/builtin-xaction-namespace.c
index c55625274f62..8257eb9cd65e 100644
--- a/ndctl/builtin-xaction-namespace.c
+++ b/ndctl/builtin-xaction-namespace.c
@@ -319,7 +319,14 @@ static int setup_namespace(struct ndctl_region *region,
 
 		try(ndctl_pfn, set_uuid, pfn, uuid);
 		try(ndctl_pfn, set_location, pfn, p->loc);
-		try(ndctl_pfn, set_align, pfn, SZ_2M);
+
+		/*
+		 * TODO: when we allow setting a non-default alignment
+		 * we'll need to check for "has_align" earlier and fail
+		 * non-default attempts on older kernels.
+		 */
+		if (ndctl_pfn_has_align(pfn))
+			try(ndctl_pfn, set_align, pfn, SZ_2M);
 		try(ndctl_pfn, set_namespace, pfn, ndns);
 		rc = ndctl_pfn_enable(pfn);
 	} else if (p->mode == NDCTL_NS_MODE_DAX) {
@@ -327,6 +334,7 @@ static int setup_namespace(struct ndctl_region *region,
 
 		try(ndctl_dax, set_uuid, dax, uuid);
 		try(ndctl_dax, set_location, dax, p->loc);
+		/* device-dax assumes 'align' attribute present */
 		try(ndctl_dax, set_align, dax, SZ_2M);
 		try(ndctl_dax, set_namespace, dax, ndns);
 		rc = ndctl_dax_enable(dax);

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

      reply	other threads:[~2016-11-10  1:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10  1:28 [PATCH 1/2] libndctl: add ndctl_pfn_has_align() api Dan Williams
2016-11-10  1:28 ` 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=147874130070.37588.7156973366536136882.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.