From patchwork Fri Jun 9 05:27:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9777217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C7DE60393 for ; Fri, 9 Jun 2017 05:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EF6C1FE8B for ; Fri, 9 Jun 2017 05:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13B072843C; Fri, 9 Jun 2017 05:34:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9FECB1FE8B for ; Fri, 9 Jun 2017 05:34:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5BFCD20945520; Thu, 8 Jun 2017 22:32:56 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7C6A321967BC4 for ; Thu, 8 Jun 2017 22:32:55 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2017 22:34:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,316,1493708400"; d="scan'208";a="112277027" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.125]) by fmsmga005.fm.intel.com with ESMTP; 08 Jun 2017 22:34:04 -0700 Subject: [ndctl PATCH] test: update dpa-alloc for v1.2 labels From: Dan Williams To: linux-nvdimm@lists.01.org Date: Thu, 08 Jun 2017 22:27:38 -0700 Message-ID: <149698605827.12023.17205386042313262239.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP The v1.2 specification changes the default label size from 128 to 256. Account for this difference by initializing DEFAULT_AVAILABLE_SLOTS from sysfs directly, rather than hard-coding. Signed-off-by: Dan Williams --- test/dpa-alloc.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c index 9c80fa3fc8c9..d13cf5dde66f 100644 --- a/test/dpa-alloc.c +++ b/test/dpa-alloc.c @@ -38,7 +38,6 @@ static const char *NFIT_PROVIDER0 = "nfit_test.0"; static const char *NFIT_PROVIDER1 = "nfit_test.1"; #define SZ_4K 0x1000UL #define NUM_NAMESPACES 4 -#define DEFAULT_AVAILABLE_SLOTS 1015 struct test_dpa_namespace { struct ndctl_namespace *ndns; @@ -48,8 +47,8 @@ struct test_dpa_namespace { static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) { + unsigned int default_available_slots, available_slots, i; struct ndctl_region *region, *blk_region = NULL; - unsigned int available_slots, i; struct ndctl_namespace *ndns; struct ndctl_dimm *dimm; unsigned long size; @@ -110,13 +109,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) return -ENXIO; } - available_slots = ndctl_dimm_get_available_labels(dimm); - if (available_slots < DEFAULT_AVAILABLE_SLOTS) { - fprintf(stderr, "%s: expected %d\n", - ndctl_dimm_get_devname(dimm), - DEFAULT_AVAILABLE_SLOTS); - return -ENXIO; - } + default_available_slots = ndctl_dimm_get_available_labels(dimm); /* grow namespaces */ for (i = 0; i < ARRAY_SIZE(namespaces); i++) { @@ -151,10 +144,10 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) } available_slots = ndctl_dimm_get_available_labels(dimm); - if (available_slots != DEFAULT_AVAILABLE_SLOTS + if (available_slots != default_available_slots - ARRAY_SIZE(namespaces)) { fprintf(stderr, "expected %ld slots available\n", - DEFAULT_AVAILABLE_SLOTS + default_available_slots - ARRAY_SIZE(namespaces)); return -ENOSPC; } @@ -278,7 +271,7 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test) } available_slots = ndctl_dimm_get_available_labels(dimm); - if (available_slots != DEFAULT_AVAILABLE_SLOTS - 1) { + if (available_slots != default_available_slots - 1) { fprintf(stderr, "mishandled slot count\n"); return -ENXIO; }