diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-05-01 13:34:01 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2015-06-24 21:24:10 -0400 |
commit | 1b40e09a1232de537b193fa1b6b3ef16d3a1e397 (patch) | |
tree | 48111c53fa3125b7d1f46d0f01b9448acbee62d0 /drivers/nvdimm/region_devs.c | |
parent | bf9bccc14c05dae8caba29df6187c731710f5380 (diff) | |
download | linux-1b40e09a1232de537b193fa1b6b3ef16d3a1e397.tar.gz linux-1b40e09a1232de537b193fa1b6b3ef16d3a1e397.tar.bz2 linux-1b40e09a1232de537b193fa1b6b3ef16d3a1e397.zip |
libnvdimm: blk labels and namespace instantiation
A blk label set describes a namespace comprised of one or more
discontiguous dpa ranges on a single dimm. They may alias with one or
more pmem interleave sets that include the given dimm.
This is the runtime/volatile configuration infrastructure for sysfs
manipulation of 'alt_name', 'uuid', 'size', and 'sector_size'. A later
patch will make these settings persistent by writing back the label(s).
Unlike pmem namespaces, multiple blk namespaces can be created per
region. Once a blk namespace has been created a new seed device
(unconfigured child of a parent blk region) is instantiated. As long as
a region has 'available_size' != 0 new child namespaces may be created.
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/region_devs.c')
-rw-r--r-- | drivers/nvdimm/region_devs.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index b45806f7176d..ac21ce419beb 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -118,7 +118,12 @@ static int is_uuid_busy(struct device *dev, void *data) break; } case ND_DEVICE_NAMESPACE_BLK: { - /* TODO: blk namespace support */ + struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev); + + if (!nsblk->uuid) + break; + if (memcmp(uuid, nsblk->uuid, NSLABEL_UUID_LEN) == 0) + return -EBUSY; break; } default: @@ -230,7 +235,7 @@ resource_size_t nd_region_available_dpa(struct nd_region *nd_region) goto retry; } } else if (is_nd_blk(&nd_region->dev)) { - /* TODO: BLK Namespace support */ + available += nd_blk_available_dpa(nd_mapping); } } @@ -360,6 +365,13 @@ static void nd_region_notify_driver_action(struct nvdimm_bus *nvdimm_bus, nd_mapping->ndd = NULL; atomic_dec(&nvdimm->busy); } + } else if (dev->parent && is_nd_blk(dev->parent) && probe) { + struct nd_region *nd_region = to_nd_region(dev->parent); + + nvdimm_bus_lock(dev); + if (nd_region->ns_seed == dev) + nd_region_create_blk_seed(nd_region); + nvdimm_bus_unlock(dev); } } @@ -533,6 +545,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus, nd_region->ndr_mappings = ndr_desc->num_mappings; nd_region->provider_data = ndr_desc->provider_data; nd_region->nd_set = ndr_desc->nd_set; + ida_init(&nd_region->ns_ida); dev = &nd_region->dev; dev_set_name(dev, "region%d", nd_region->id); dev->parent = &nvdimm_bus->dev; |