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: [ndctl PATCH] ndctl, test: fix dpa-alloc for kernels with 4M min size
Date: Thu, 22 Feb 2018 22:59:11 -0800	[thread overview]
Message-ID: <151936915162.18166.5719880718484465492.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)

Now that ndctl is no longer using the kernel provided ndctl.h header,
and the minimum namespace size has been reduced on recent kernels, the
dpa-alloc test can no longer assume that ND_MIN_NAMESPACE_SIZE matches
what the kernel supports. Instead use a hard coded 4MB size that works
with all kernels.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/dpa-alloc.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c
index 8bb7dd7408a1..9a9c6b64c504 100644
--- a/test/dpa-alloc.c
+++ b/test/dpa-alloc.c
@@ -25,13 +25,13 @@
 
 #include <test.h>
 #include <ndctl.h>
+#include <util/size.h>
 #include <linux/version.h>
 #include <ndctl/libndctl.h>
 #include <ccan/array_size/array_size.h>
 
 static const char *NFIT_PROVIDER0 = "nfit_test.0";
 static const char *NFIT_PROVIDER1 = "nfit_test.1";
-#define SZ_4K 0x1000UL
 #define NUM_NAMESPACES 4
 
 struct test_dpa_namespace {
@@ -40,6 +40,8 @@ struct test_dpa_namespace {
 	uuid_t uuid;
 } namespaces[NUM_NAMESPACES];
 
+#define MIN_SIZE SZ_4M
+
 static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
 {
 	unsigned int default_available_slots, available_slots, i;
@@ -97,8 +99,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
 	}
 	region = blk_region;
 
-	if (ndctl_region_get_available_size(region) / ND_MIN_NAMESPACE_SIZE
-			< NUM_NAMESPACES) {
+	if (ndctl_region_get_available_size(region) / MIN_SIZE < NUM_NAMESPACES) {
 		fprintf(stderr, "%s insufficient available_size\n",
 				ndctl_region_get_devname(region));
 		return -ENXIO;
@@ -119,7 +120,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
 		uuid_generate_random(uuid);
 		ndctl_namespace_set_uuid(ndns, uuid);
 		ndctl_namespace_set_sector_size(ndns, 512);
-		ndctl_namespace_set_size(ndns, ND_MIN_NAMESPACE_SIZE);
+		ndctl_namespace_set_size(ndns, MIN_SIZE);
 		rc = ndctl_namespace_enable(ndns);
 		if (rc) {
 			fprintf(stderr, "failed to enable %s: %d\n",
@@ -129,7 +130,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
 		ndctl_namespace_disable_invalidate(ndns);
 		rc = ndctl_namespace_set_size(ndns, SZ_4K);
 		if (rc) {
-			fprintf(stderr, "failed to init %s to size: %ld\n",
+			fprintf(stderr, "failed to init %s to size: %d\n",
 					ndctl_namespace_get_devname(ndns),
 					SZ_4K);
 			return rc;

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

                 reply	other threads:[~2018-02-23  7:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=151936915162.18166.5719880718484465492.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.