diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-06-17 23:14:46 +0200 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-06-25 03:24:10 +0200 |
commit | bf9bccc14c05dae8caba29df6187c731710f5380 (patch) | |
tree | cbf00a172bc70598748231748ca2ad14867063ad /drivers/nvdimm/dimm.c | |
parent | libnvdimm: namespace indices: read and validate (diff) | |
download | linux-bf9bccc14c05dae8caba29df6187c731710f5380.tar.xz linux-bf9bccc14c05dae8caba29df6187c731710f5380.zip |
libnvdimm: pmem label sets and namespace instantiation.
A complete label set is a PMEM-label per-dimm per-interleave-set where
all the UUIDs match and the interleave set cookie matches the hosting
interleave set.
Present sysfs attributes for manipulation of a PMEM-namespace's
'alt_name', 'uuid', and 'size' attributes. A later patch will make
these settings persistent by writing back the label.
Note that PMEM allocations grow forwards from the start of an interleave
set (lowest dimm-physical-address (DPA)). BLK-namespaces that alias
with a PMEM interleave set will grow allocations backward from the
highest DPA.
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Neil Brown <neilb@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/dimm.c')
-rw-r--r-- | drivers/nvdimm/dimm.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c index 2df97c3c3b34..71d12bb67339 100644 --- a/drivers/nvdimm/dimm.c +++ b/drivers/nvdimm/dimm.c @@ -21,18 +21,6 @@ #include "label.h" #include "nd.h" -static void free_data(struct nvdimm_drvdata *ndd) -{ - if (!ndd) - return; - - if (ndd->data && is_vmalloc_addr(ndd->data)) - vfree(ndd->data); - else - kfree(ndd->data); - kfree(ndd); -} - static int nvdimm_probe(struct device *dev) { struct nvdimm_drvdata *ndd; @@ -49,6 +37,8 @@ static int nvdimm_probe(struct device *dev) ndd->dpa.start = 0; ndd->dpa.end = -1; ndd->dev = dev; + get_device(dev); + kref_init(&ndd->kref); rc = nvdimm_init_nsarea(ndd); if (rc) @@ -74,21 +64,18 @@ static int nvdimm_probe(struct device *dev) return 0; err: - free_data(ndd); + put_ndd(ndd); return rc; } static int nvdimm_remove(struct device *dev) { struct nvdimm_drvdata *ndd = dev_get_drvdata(dev); - struct resource *res, *_r; nvdimm_bus_lock(dev); dev_set_drvdata(dev, NULL); - for_each_dpa_resource_safe(ndd, res, _r) - nvdimm_free_dpa(ndd, res); nvdimm_bus_unlock(dev); - free_data(ndd); + put_ndd(ndd); return 0; } |