@@ -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)
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 <dan.j.williams@intel.com> --- test/dax-dev.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)