From patchwork Sat Feb 29 20:21:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 11414021 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D412930 for ; Sat, 29 Feb 2020 20:37:22 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E99DE20880 for ; Sat, 29 Feb 2020 20:37:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E99DE20880 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5DF3210FC358D; Sat, 29 Feb 2020 12:38:13 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=dan.j.williams@intel.com; receiver= Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 A1BA810FC3581 for ; Sat, 29 Feb 2020 12:38:11 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Feb 2020 12:37:19 -0800 X-IronPort-AV: E=Sophos;i="5.70,501,1574150400"; d="scan'208";a="273073885" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Feb 2020 12:37:19 -0800 Subject: [ndctl PATCH 13/36] ndctl/test: Update dax-dev to handle multiple e820 ranges From: Dan Williams To: linux-nvdimm@lists.01.org Cc: vishal.l.verma@intel.com Date: Sat, 29 Feb 2020 12:21:13 -0800 Message-ID: <158300767374.2141307.707811872453358886.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <158300760415.2141307.14060353322051900501.stgit@dwillia2-desk3.amr.corp.intel.com> References: <158300760415.2141307.14060353322051900501.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Message-ID-Hash: FK4K632L6WW5IEY45Q3PH3XO7URYV2MN X-Message-ID-Hash: FK4K632L6WW5IEY45Q3PH3XO7URYV2MN X-MailFrom: dan.j.williams@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Establish a convention that the first, lowest-index, region on the e820 bus always enables in fsdax mode without need for an nd_pfn instance. This is in preparation for a defining a collision test that requires multiple section-mis-aligned regions defined by memmap=nn!ss. Signed-off-by: Dan Williams --- test/dax-dev.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/dax-dev.c b/test/dax-dev.c index 0183b7af2052..49ccaa334e31 100644 --- a/test/dax-dev.c +++ b/test/dax-dev.c @@ -33,17 +33,28 @@ struct ndctl_namespace *ndctl_get_test_dev(struct ndctl_ctx *ctx) struct ndctl_bus *bus; struct ndctl_dax *dax; struct ndctl_pfn *pfn; - struct ndctl_region *region; struct ndctl_namespace *ndns; enum ndctl_namespace_mode mode; + struct ndctl_region *region, *min = NULL; bus = ndctl_bus_get_by_provider(ctx, "e820"); if (!bus) goto out; - region = ndctl_region_get_first(bus); - if (!region) + ndctl_region_foreach(bus, region) { + if (!min) { + min = region; + continue; + } + if (ndctl_region_get_id(region) < ndctl_region_get_id(min)) + min = region; + } + if (!min) goto out; + region = min; + + /* attempt to re-enable the region if a previous test disabled it */ + ndctl_region_enable(region); ndns = ndctl_namespace_get_first(region); if (!ndns)