[ndctl PATCH] ndctl, list: always show 'name' if it is available
by Dan Williams
The user-friendly name of a namespace should always be emitted.
Reported-by: Linda Knippers <linda.knippers(a)hpe.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
util/json.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/util/json.c b/util/json.c
index 559a022ae405..2b2b5af16504 100644
--- a/util/json.c
+++ b/util/json.c
@@ -558,7 +558,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
struct json_object *jobj, *jbbs = NULL;
unsigned long long size = ULLONG_MAX;
enum ndctl_namespace_mode mode;
- const char *bdev = NULL;
+ const char *bdev = NULL, *name;
unsigned int bb_count;
struct ndctl_btt *btt;
struct ndctl_pfn *pfn;
@@ -654,7 +654,6 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
json_object_object_add(jndns, "daxregion", jobj);
} else if (dax_region) {
struct daxctl_dev *dev;
- const char *name;
dev = daxctl_dev_get_first(dax_region);
name = daxctl_dev_get_devname(dev);
@@ -664,22 +663,12 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
json_object_object_add(jndns, "chardev", jobj);
}
} else if (ndctl_namespace_get_type(ndns) != ND_DEVICE_NAMESPACE_IO) {
- const char *name;
-
ndctl_namespace_get_uuid(ndns, uuid);
uuid_unparse(uuid, buf);
jobj = json_object_new_string(buf);
if (!jobj)
goto err;
json_object_object_add(jndns, "uuid", jobj);
-
- name = ndctl_namespace_get_alt_name(ndns);
- if (name[0]) {
- jobj = json_object_new_string(name);
- if (!jobj)
- goto err;
- json_object_object_add(jndns, "name", jobj);
- }
bdev = ndctl_namespace_get_block_device(ndns);
} else
bdev = ndctl_namespace_get_block_device(ndns);
@@ -698,6 +687,14 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
json_object_object_add(jndns, "state", jobj);
}
+ name = ndctl_namespace_get_alt_name(ndns);
+ if (name && name[0]) {
+ jobj = json_object_new_string(name);
+ if (!jobj)
+ goto err;
+ json_object_object_add(jndns, "name", jobj);
+ }
+
numa = ndctl_namespace_get_numa_node(ndns);
if (numa >= 0) {
jobj = json_object_new_int(numa);
5 years
Re: KVM "fake DAX" flushing interface - discussion
by Pankaj Gupta
> > A] Problems to solve:
> > ------------------
> >
> > 1] We are considering two approaches for 'fake DAX flushing interface'.
> >
> > 1.1] fake dax with NVDIMM flush hints & KVM async page fault
> >
> > - Existing interface.
> >
> > - The approach to use flush hint address is already nacked upstream.
> >
> > - Flush hint not queued interface for flushing. Applications might
> > avoid to use it.
>
> This doesn't contradicts the last point about async operation and vcpu
> control. KVM async page faults turn the Address Flush Hints write into
> an async operation so the guest can get other work done while waiting
> for completion.
>
> >
> > - Flush hint address traps from guest to host and do an entire fsync
> > on backing file which itself is costly.
> >
> > - Can be used to flush specific pages on host backing disk. We can
> > send data(pages information) equal to cache-line size(limitation)
> > and tell host to sync corresponding pages instead of entire disk
> > sync.
>
> Are you sure? Your previous point says only the entire device can be
> synced. The NVDIMM Adress Flush Hints interface does not involve
> address range information.
Just syncing entire block device should be simple but costly. Using flush
hint address to write data which contains list/info of dirty pages to
flush requires more thought. This calls mmio write callback at Qemu side.
As per Intel (ACPI spec 6.1, Table 5-135) there is limit to max length
of data guest can write and is equal to cache line size.
>
> >
> > - This will be an asynchronous operation and vCPU control is returned
> > quickly.
> >
> >
> > 1.2] Using additional para virt device in addition to pmem device(fake dax
> > with device flush)
>
> Perhaps this can be exposed via ACPI as part of the NVDIMM standards
> instead of a separate KVM-only paravirt device.
Same reason as above. If we decide on sending list of dirty pages there is
limit to send max size of data to host using flush hint address.
>
5 years
KVM "fake DAX" flushing interface - discussion
by Pankaj Gupta
Hello,
We shared a proposal for 'KVM fake DAX flushing interface'.
https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg02478.html
We did initial POC in which we used 'virtio-blk' device to perform
a device flush on pmem fsync on ext4 filesystem. They are few hacks
to make things work. We need suggestions on below points before we
start actual implementation.
A] Problems to solve:
------------------
1] We are considering two approaches for 'fake DAX flushing interface'.
1.1] fake dax with NVDIMM flush hints & KVM async page fault
- Existing interface.
- The approach to use flush hint address is already nacked upstream.
- Flush hint not queued interface for flushing. Applications might
avoid to use it.
- Flush hint address traps from guest to host and do an entire fsync
on backing file which itself is costly.
- Can be used to flush specific pages on host backing disk. We can
send data(pages information) equal to cache-line size(limitation)
and tell host to sync corresponding pages instead of entire disk sync.
- This will be an asynchronous operation and vCPU control is returned
quickly.
1.2] Using additional para virt device in addition to pmem device(fake dax with device flush)
- New interface
- Guest maintains information of DAX dirty pages as exceptional entries in
radix tree.
- If we want to flush specific pages from guest to host, we need to send
list of the dirty pages corresponding to file on which we are doing fsync.
- This will require implementation of new interface, a new paravirt device
for sending flush requests.
- Host side will perform fsync/fdatasync on list of dirty pages or entire
block device backed file.
2] Questions:
-----------
2.1] Not sure why WPQ flush is not a queued interface? We can force applications
to call this? device DAX neither calls fsync/msync?
2.2] Depending upon interface we decide, we need optimal solution to sync
range of pages?
- Send range of pages from guest to host to sync asynchronously instead
of syncing entire block device?
- Other option is to sync entire disk backing file to make sure all the
writes are persistent. In our case, backing file is a regular file on
non NVDIMM device so host page cache has list of dirty pages which
can be used either with fsync or similar interface.
2.3] If we do host fsync on entire disk we will be flushing all the dirty data
to backend file. Just thinking what would be better approach, flushing
pages on corresponding guest file fsync or entire block device?
2.4] If we decide to choose one of the above approaches, we need to consider
all DAX supporting filesystems(ext4/xfs). Would hooking code to corresponding
fsync code of fs seems reasonable? Just thinking for flush hint address use-case?
Or how flush hint addresses would be invoked with fsync or similar api?
2.5] Also with filesystem journalling and other mount options like barriers,
ordered etc, how we decide to use page flush hint or regular fsync on file?
2.6] If at guest side we have PFN of all the dirty pages in radixtree? and we send
these to to host? At host side would we able to find corresponding page and flush
them all?
Suggestions & ideas are welcome.
Thanks,
Pankaj
5 years
Persistent Memory type vs Reserved Memory type
by Soccer Liu
Hi:
I am trying to debug an issue related to my private built kernel's (4.11 from upstream with ACPI/NFIT/NVDIMM enabled) interaction with a persistent memory device's type.
We have a way to emulate a software based NVDIMM device into a guest, which is running my private built kernel. When the host set this emulated NVDIMM device as Reserved type, I was able to see a pmem0 block device exposed and everything seems to function correctly.however, when it's exposed as a Persistent Memory type, the kernel does not boot and it has a black screen and no usefully logging could help root cause this.
My questions are:
1. Is this a known issue for 4.11? 2. Is there any patches NIFT/NVDIMM beyond 4.11 that's needed to get Persistent Memory type supported? 3. In this case, is there anyway to debug this further?
ThanksCheng-mean
5 years
[GIT PULL] libnvdimm fixes for 4.13-rc2
by Williams, Dan J
Hi Linus, please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm tags/libnvdimm-fixes-4.13-rc2
...to receive a handful of small fixes for 4.13-rc2. 3 of these fixes
are tagged for -stable. They have all appeared in at least one -next
release with no reported issues. Full commit log below:
---
The following changes since commit 5771a8c08880cdca3bfb4a3fc6d309d6bba20877:
Linux v4.13-rc1 (2017-07-15 15:22:10 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm tags/libnvdimm-fixes-4.13-rc2
for you to fetch changes up to bbb3be170ac2891526ad07b18af7db226879a8e7:
device-dax: fix sysfs duplicate warnings (2017-07-18 17:49:14 -0700)
----------------------------------------------------------------
libnvdimm for 4.13-rc2
* Fix handling of media errors that span a sector
* Fix support of multiple namespaces in a libnvdimm region being in
device-dax mode
* Clean up the machine check notifier properly when the nfit driver
fails to register
* Address a static analysis (smatch) report in device-dax
----------------------------------------------------------------
Dan Williams (3):
device-dax: fix 'passing zero to ERR_PTR()' warning
MAINTAINERS: list drivers/acpi/nfit/ files for libnvdimm sub-system
device-dax: fix sysfs duplicate warnings
Prarit Bhargava (1):
acpi/nfit: Fix memory corruption/Unregister mce decoder on failure
Toshi Kani (1):
libnvdimm: fix badblock range handling of ARS range
MAINTAINERS | 2 +-
drivers/acpi/nfit/core.c | 10 +++++++++-
drivers/dax/device-dax.h | 2 +-
drivers/dax/device.c | 33 +++++++++++++++++++++++----------
drivers/dax/pmem.c | 12 +++++++-----
drivers/nvdimm/core.c | 7 ++++---
6 files changed, 45 insertions(+), 21 deletions(-)
---
commit 4e3f0701f25ab194c5362576b1146a1e6cc6c2e7
Author: Toshi Kani <toshi.kani(a)hpe.com>
Date: Fri Jul 7 17:44:26 2017 -0600
libnvdimm: fix badblock range handling of ARS range
__add_badblock_range() does not account sector alignment when
it sets 'num_sectors'. Therefore, an ARS error record range
spanning across two sectors is set to a single sector length,
which leaves the 2nd sector unprotected.
Change __add_badblock_range() to set 'num_sectors' properly.
Cc: <stable(a)vger.kernel.org>
Fixes: 0caeef63e6d2 ("libnvdimm: Add a poison list and export badblocks")
Signed-off-by: Toshi Kani <toshi.kani(a)hpe.com>
Reviewed-by: Vishal Verma <vishal.l.verma(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit 43fe51e11c194a6576634585f81ba33e104194a5
Author: Dan Williams <dan.j.williams(a)intel.com>
Date: Wed Jul 12 13:42:37 2017 -0700
device-dax: fix 'passing zero to ERR_PTR()' warning
Dan Carpenter reports:
The patch 7b6be8444e0f: "dax: refactor dax-fs into a generic provider
of 'struct dax_device' instances" from Apr 11, 2017, leads to the
following static checker warning:
drivers/dax/device.c:643 devm_create_dev_dax()
warn: passing zero to 'ERR_PTR'
Fix the case where we inadvertently leak 0 to ERR_PTR() by setting at
every error case, and make it clear that 'count' is never 0.
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit 7e700d2c59e5853c9126642976b4f5768f64c9b3
Author: Prarit Bhargava <prarit(a)redhat.com>
Date: Wed May 31 13:32:00 2017 -0400
acpi/nfit: Fix memory corruption/Unregister mce decoder on failure
nfit_init() calls nfit_mce_register() on module load. When the module
load fails the nfit mce decoder is not unregistered. The module's
memory is freed leaving the decoder chain referencing junk. This will
cause panics as future registrations will reference the free'd memory.
Unregister the nfit mce decoder on module init failure.
[v2]: register and then unregister mce handler to avoid losing mce events
[v3]: also cleanup nfit workqueue
Fixes: 6839a6d96f4e ("nfit: do an ARS scrub on hitting a latent media error")
Cc: <stable(a)vger.kernel.org>
Cc: "Rafael J. Wysocki" <rjw(a)rjwysocki.net>
Cc: Len Brown <lenb(a)kernel.org>
Cc: Vishal Verma <vishal.l.verma(a)intel.com>
Cc: "Lee, Chun-Yi" <joeyli.kernel(a)gmail.com>
Cc: Linda Knippers <linda.knippers(a)hpe.com>
Cc: lszubowi(a)redhat.com
Acked-by: Jeff Moyer <jmoyer(a)redhat.com>
Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
Reviewed-by: Vishal Verma <vishal.l.verma(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit 23b9babb50ff5ac8eb9208b978b2a630e99bf90b
Author: Dan Williams <dan.j.williams(a)intel.com>
Date: Mon Jul 17 09:58:51 2017 -0700
MAINTAINERS: list drivers/acpi/nfit/ files for libnvdimm sub-system
Patches that update the drivers/acpi/nfit/ directory need to be copied
to the nvdimm mailing list. The drivers/acpi/nfit* glob has been broken
ever since the nfit driver source was refactored into multiple files
under the drivers/acpi/nfit/ directory.
Reported-by: Prarit Bhargava <prarit(a)redhat.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
commit bbb3be170ac2891526ad07b18af7db226879a8e7
Author: Dan Williams <dan.j.williams(a)intel.com>
Date: Tue Jul 18 17:49:14 2017 -0700
device-dax: fix sysfs duplicate warnings
Fix warnings of the form...
WARNING: CPU: 10 PID: 4983 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x62/0x80
sysfs: cannot create duplicate filename '/class/dax/dax12.0'
Call Trace:
dump_stack+0x63/0x86
__warn+0xcb/0xf0
warn_slowpath_fmt+0x5a/0x80
? kernfs_path_from_node+0x4f/0x60
sysfs_warn_dup+0x62/0x80
sysfs_do_create_link_sd.isra.2+0x97/0xb0
sysfs_create_link+0x25/0x40
device_add+0x266/0x630
devm_create_dax_dev+0x2cf/0x340 [dax]
dax_pmem_probe+0x1f5/0x26e [dax_pmem]
nvdimm_bus_probe+0x71/0x120
...by reusing the namespace id for the device-dax instance name.
Now that we have decided that there will never by more than one
device-dax instance per libnvdimm-namespace parent device [1], we can
directly reuse the namepace ids. There are some possible follow-on
cleanups, but those are saved for a later patch to simplify the -stable
backport.
[1]: https://lists.01.org/pipermail/linux-nvdimm/2016-December/008266.html
Fixes: 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple pmem...")
Cc: Jeff Moyer <jmoyer(a)redhat.com>
Cc: <stable(a)vger.kernel.org>
Reported-by: Dariusz Dokupil <dariusz.dokupil(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
5 years
[ndctl PATCH] ndctl: allow bus device names as a filter option
by Dan Williams
For example, allow:
ndctl list -b ndbus0
...in addition to the existing provider based method:
ndctl list -b ACPI.NFIT
...or the id based method:
ndctl list -b 0
Cc: Vishal Verma <vishal.l.verma(a)intel.com>
Reported-by: Dave Jiang <dave.jiang(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
util/filter.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/util/filter.c b/util/filter.c
index 74ab3535c98e..93d56928a3dc 100644
--- a/util/filter.c
+++ b/util/filter.c
@@ -21,8 +21,8 @@
struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *ident)
{
char *end = NULL;
- const char *provider;
unsigned long bus_id, id;
+ const char *provider, *devname;
if (!ident || strcmp(ident, "all") == 0)
return bus;
@@ -32,12 +32,14 @@ struct ndctl_bus *util_bus_filter(struct ndctl_bus *bus, const char *ident)
bus_id = ULONG_MAX;
provider = ndctl_bus_get_provider(bus);
+ devname = ndctl_bus_get_devname(bus);
id = ndctl_bus_get_id(bus);
if (bus_id < ULONG_MAX && bus_id == id)
return bus;
- if (bus_id == ULONG_MAX && strcmp(ident, provider) == 0)
+ if (bus_id == ULONG_MAX && (strcmp(ident, provider) == 0
+ || strcmp(ident, devname) == 0))
return bus;
return NULL;
5 years
[ndctl PATCH 0/6] multi-device-dax support and other fixes
by Dan Williams
A test report highlighted the fact that the unit tests never verified
that multiple-namespaces in a region could be in device-dax mode. This
was fixed in the kernel [1], but there is some fallout to handle in
ndctl and daxctl:
1/ teach libdaxctl that there may be multiple dax-region instances that
share the same region-id
2/ update 'ndctl list' to assume that there will only ever be one
device-dax instance per-namespace and emit the "chardev" by default
(Linda).
3/ fix 'daxctl list' to differentiate regions by path, since 'id' may be
duplicated.
4/ add a regression test for multi-dax configurations
---
Dan Williams (6):
ndctl, daxctl: propagate loglevel to internal libdaxctl instance
daxctl: stop carrying 'dax_region' in the daxctl_region region_path
daxctl: fix support for multiple instances per-region id
ndctl, list: emit device-dax 'chardev' by default
daxctl, list: clarify output when multiple regions share an id
test: add multi-dax test
daxctl/lib/libdaxctl.c | 78 ++++++++++++++++++++++++++++++++++------------
daxctl/lib/libdaxctl.sym | 5 +++
daxctl/libdaxctl.h | 2 +
daxctl/list.c | 2 +
ndctl/lib/libndctl.c | 2 +
ndctl/list.c | 2 +
ndctl/namespace.c | 2 +
test/Makefile.am | 1 +
test/multi-dax.sh | 61 ++++++++++++++++++++++++++++++++++++
util/json.c | 34 ++++++++++++++++++--
util/json.h | 3 +-
11 files changed, 165 insertions(+), 27 deletions(-)
create mode 100755 test/multi-dax.sh
5 years
[PATCH] device-dax: fix sysfs duplicate warnings
by Dan Williams
Fix warnings of the form...
WARNING: CPU: 10 PID: 4983 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x62/0x80
sysfs: cannot create duplicate filename '/class/dax/dax12.0'
Call Trace:
dump_stack+0x63/0x86
__warn+0xcb/0xf0
warn_slowpath_fmt+0x5a/0x80
? kernfs_path_from_node+0x4f/0x60
sysfs_warn_dup+0x62/0x80
sysfs_do_create_link_sd.isra.2+0x97/0xb0
sysfs_create_link+0x25/0x40
device_add+0x266/0x630
devm_create_dax_dev+0x2cf/0x340 [dax]
dax_pmem_probe+0x1f5/0x26e [dax_pmem]
nvdimm_bus_probe+0x71/0x120
...by reusing the namespace id for the device-dax instance name.
Now that we have decided that there will never by more than one
device-dax instance per libnvdimm-namespace parent device [1], we can
directly reuse the namepace ids. There are some possible follow-on
cleanups, but those are saved for a later patch to simplify the -stable
backport.
[1]: https://lists.01.org/pipermail/linux-nvdimm/2016-December/008266.html
Fixes: 98a29c39dc68 ("libnvdimm, namespace: allow creation of multiple pmem...")
Cc: Jeff Moyer <jmoyer(a)redhat.com>
Cc: <stable(a)vger.kernel.org>
Reported-by: Dariusz Dokupil <dariusz.dokupil(a)intel.com>
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
drivers/dax/device-dax.h | 2 +-
drivers/dax/device.c | 24 ++++++++++++++++--------
drivers/dax/pmem.c | 12 +++++++-----
3 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/drivers/dax/device-dax.h b/drivers/dax/device-dax.h
index fdcd9769ffde..688b051750bd 100644
--- a/drivers/dax/device-dax.h
+++ b/drivers/dax/device-dax.h
@@ -21,5 +21,5 @@ struct dax_region *alloc_dax_region(struct device *parent,
int region_id, struct resource *res, unsigned int align,
void *addr, unsigned long flags);
struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
- struct resource *res, int count);
+ int id, struct resource *res, int count);
#endif /* __DEVICE_DAX_H__ */
diff --git a/drivers/dax/device.c b/drivers/dax/device.c
index 44d72e5e64cc..e9f3b3e4bbf4 100644
--- a/drivers/dax/device.c
+++ b/drivers/dax/device.c
@@ -529,7 +529,8 @@ static void dev_dax_release(struct device *dev)
struct dax_region *dax_region = dev_dax->region;
struct dax_device *dax_dev = dev_dax->dax_dev;
- ida_simple_remove(&dax_region->ida, dev_dax->id);
+ if (dev_dax->id >= 0)
+ ida_simple_remove(&dax_region->ida, dev_dax->id);
dax_region_put(dax_region);
put_dax(dax_dev);
kfree(dev_dax);
@@ -559,7 +560,7 @@ static void unregister_dev_dax(void *dev)
}
struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
- struct resource *res, int count)
+ int id, struct resource *res, int count)
{
struct device *parent = dax_region->dev;
struct dax_device *dax_dev;
@@ -590,10 +591,16 @@ struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
if (i < count)
goto err_id;
- dev_dax->id = ida_simple_get(&dax_region->ida, 0, 0, GFP_KERNEL);
- if (dev_dax->id < 0) {
- rc = dev_dax->id;
- goto err_id;
+ if (id < 0) {
+ id = ida_simple_get(&dax_region->ida, 0, 0, GFP_KERNEL);
+ dev_dax->id = id;
+ if (id < 0) {
+ rc = id;
+ goto err_id;
+ }
+ } else {
+ /* region provider owns @id lifetime */
+ dev_dax->id = -1;
}
/*
@@ -625,7 +632,7 @@ struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
dev->parent = parent;
dev->groups = dax_attribute_groups;
dev->release = dev_dax_release;
- dev_set_name(dev, "dax%d.%d", dax_region->id, dev_dax->id);
+ dev_set_name(dev, "dax%d.%d", dax_region->id, id);
rc = cdev_device_add(cdev, dev);
if (rc) {
@@ -641,7 +648,8 @@ struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region,
return dev_dax;
err_dax:
- ida_simple_remove(&dax_region->ida, dev_dax->id);
+ if (dev_dax->id >= 0)
+ ida_simple_remove(&dax_region->ida, dev_dax->id);
err_id:
kfree(dev_dax);
diff --git a/drivers/dax/pmem.c b/drivers/dax/pmem.c
index 9f2a0b4fd801..8d8c852ba8f2 100644
--- a/drivers/dax/pmem.c
+++ b/drivers/dax/pmem.c
@@ -58,13 +58,12 @@ static void dax_pmem_percpu_kill(void *data)
static int dax_pmem_probe(struct device *dev)
{
- int rc;
void *addr;
struct resource res;
+ int rc, id, region_id;
struct nd_pfn_sb *pfn_sb;
struct dev_dax *dev_dax;
struct dax_pmem *dax_pmem;
- struct nd_region *nd_region;
struct nd_namespace_io *nsio;
struct dax_region *dax_region;
struct nd_namespace_common *ndns;
@@ -123,14 +122,17 @@ static int dax_pmem_probe(struct device *dev)
/* adjust the dax_region resource to the start of data */
res.start += le64_to_cpu(pfn_sb->dataoff);
- nd_region = to_nd_region(dev->parent);
- dax_region = alloc_dax_region(dev, nd_region->id, &res,
+ rc = sscanf(dev_name(&ndns->dev), "namespace%d.%d", ®ion_id, &id);
+ if (rc != 2)
+ return -EINVAL;
+
+ dax_region = alloc_dax_region(dev, region_id, &res,
le32_to_cpu(pfn_sb->align), addr, PFN_DEV|PFN_MAP);
if (!dax_region)
return -ENOMEM;
/* TODO: support for subdividing a dax region... */
- dev_dax = devm_create_dev_dax(dax_region, &res, 1);
+ dev_dax = devm_create_dev_dax(dax_region, id, &res, 1);
/* child dev_dax instances now own the lifetime of the dax_region */
dax_region_put(dax_region);
5 years