From patchwork Fri Feb 23 06:59:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10236947 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 95987602DC for ; Fri, 23 Feb 2018 07:08:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81E5528FDF for ; Fri, 23 Feb 2018 07:08:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F2C72900B; Fri, 23 Feb 2018 07:08:21 +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 CFC7328FDF for ; Fri, 23 Feb 2018 07:08:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 10C7B220F33C4; Thu, 22 Feb 2018 23:02:19 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=dan.j.williams@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 5708321FD73D9 for ; Thu, 22 Feb 2018 23:02:17 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Feb 2018 23:08:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,382,1515484800"; d="scan'208";a="32970515" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga001.fm.intel.com with ESMTP; 22 Feb 2018 23:08:16 -0800 Subject: [ndctl PATCH] ndctl, test: fix dpa-alloc for kernels with 4M min size From: Dan Williams To: linux-nvdimm@lists.01.org Date: Thu, 22 Feb 2018 22:59:11 -0800 Message-ID: <151936915162.18166.5719880718484465492.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.23 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 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 --- 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 #include +#include #include #include #include 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;