summaryrefslogtreecommitdiff
path: root/drivers/nvdimm/region.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2015-06-25 11:20:04 +0300
committerDan Williams <dan.j.williams@intel.com>2015-06-25 11:20:04 +0300
commit8c2f7e8658df1d3b7cbfa62706941d14c715823a (patch)
treeac93512841113f4d1d7a38d788ec73bb21e2d605 /drivers/nvdimm/region.c
parent0ba1c634892b3590779803a701bcb82e8c32cc7a (diff)
downloadlinux-8c2f7e8658df1d3b7cbfa62706941d14c715823a.tar.xz
libnvdimm: infrastructure for btt devices
NVDIMM namespaces, in addition to accepting "struct bio" based requests, also have the capability to perform byte-aligned accesses. By default only the bio/block interface is used. However, if another driver can make effective use of the byte-aligned capability it can claim namespace interface and use the byte-aligned ->rw_bytes() interface. The BTT driver is the initial first consumer of this mechanism to allow adding atomic sector update semantics to a pmem or blk namespace. This patch is the sysfs infrastructure to allow configuring a BTT instance for a namespace. Enabling that BTT and performing i/o is in a subsequent patch. Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Neil Brown <neilb@suse.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/region.c')
-rw-r--r--drivers/nvdimm/region.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/nvdimm/region.c b/drivers/nvdimm/region.c
index 9aba44e483e0..2a5f3f53d79d 100644
--- a/drivers/nvdimm/region.c
+++ b/drivers/nvdimm/region.c
@@ -33,12 +33,13 @@ static int nd_region_probe(struct device *dev)
num_ns->count = rc + err;
dev_set_drvdata(dev, num_ns);
+ if (rc && err && rc == err)
+ return -ENODEV;
+
+ nd_region->btt_seed = nd_btt_create(nd_region);
if (err == 0)
return 0;
- if (rc == err)
- return -ENODEV;
-
/*
* Given multiple namespaces per region, we do not want to
* disable all the successfully registered peer namespaces upon
@@ -66,6 +67,7 @@ static int nd_region_remove(struct device *dev)
/* flush attribute readers and disable */
nvdimm_bus_lock(dev);
nd_region->ns_seed = NULL;
+ nd_region->btt_seed = NULL;
dev_set_drvdata(dev, NULL);
nvdimm_bus_unlock(dev);