diff options
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; |