libnvdimm for 6.1
- Fix nvdimm namespace creation on platforms that do not publish associated 'DIMM' metadata for a persistent memory region. - Miscellaneous fixes and cleanups. -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSbo+XnGs+rwLz9XGXfioYZHlFsZwUCY0nx4QAKCRDfioYZHlFs Zwg3AQD6t9gvqu7AV1eTEGrypC3C47Z5yeeEqLC7U9DjtnxP9wD/VWGNX7uYu6Ck rf8vyT7NFqg0khpU6XeaaDWQtasRggs= =WCrX -----END PGP SIGNATURE----- Merge tag 'libnvdimm-for-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm Pull nvdimm updates from Dan Williams: "Some small cleanups and fixes in and around the nvdimm subsystem. The most significant change is a regression fix for nvdimm namespace (volume) creation when the namespace size is smaller than 2MB/ Summary: - Fix nvdimm namespace creation on platforms that do not publish associated 'DIMM' metadata for a persistent memory region. - Miscellaneous fixes and cleanups" * tag 'libnvdimm-for-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: ACPI: HMAT: Release platform device in case of platform_device_add_data() fails dax: Remove usage of the deprecated ida_simple_xxx API libnvdimm/region: Allow setting align attribute on regions without mappings nvdimm/namespace: Fix comment typo nvdimm: make __nvdimm_security_overwrite_query static nvdimm/region: Fix kernel-doc nvdimm/namespace: drop unneeded temporary variable in size_store() nvdimm/namespace: return uuid_null only once in nd_dev_to_uuid()
This commit is contained in:
commit
19d17ab7c6
|
@ -48,7 +48,7 @@ void hmem_register_device(int target_nid, struct resource *r)
|
|||
rc = platform_device_add_data(pdev, &info, sizeof(info));
|
||||
if (rc < 0) {
|
||||
pr_err("hmem memregion_info allocation failure for %pr\n", &res);
|
||||
goto out_pdev;
|
||||
goto out_resource;
|
||||
}
|
||||
|
||||
rc = platform_device_add_resources(pdev, &res, 1);
|
||||
|
@ -66,7 +66,7 @@ void hmem_register_device(int target_nid, struct resource *r)
|
|||
return;
|
||||
|
||||
out_resource:
|
||||
put_device(&pdev->dev);
|
||||
platform_device_put(pdev);
|
||||
out_pdev:
|
||||
memregion_free(id);
|
||||
}
|
||||
|
|
|
@ -363,7 +363,7 @@ static void dax_free_inode(struct inode *inode)
|
|||
{
|
||||
struct dax_device *dax_dev = to_dax_dev(inode);
|
||||
if (inode->i_rdev)
|
||||
ida_simple_remove(&dax_minor_ida, iminor(inode));
|
||||
ida_free(&dax_minor_ida, iminor(inode));
|
||||
kmem_cache_free(dax_cache, dax_dev);
|
||||
}
|
||||
|
||||
|
@ -445,7 +445,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
|
|||
if (WARN_ON_ONCE(ops && !ops->zero_page_range))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
minor = ida_simple_get(&dax_minor_ida, 0, MINORMASK+1, GFP_KERNEL);
|
||||
minor = ida_alloc_max(&dax_minor_ida, MINORMASK, GFP_KERNEL);
|
||||
if (minor < 0)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
@ -459,7 +459,7 @@ struct dax_device *alloc_dax(void *private, const struct dax_operations *ops)
|
|||
return dax_dev;
|
||||
|
||||
err_dev:
|
||||
ida_simple_remove(&dax_minor_ida, minor);
|
||||
ida_free(&dax_minor_ida, minor);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(alloc_dax);
|
||||
|
|
|
@ -170,14 +170,11 @@ EXPORT_SYMBOL(nvdimm_namespace_disk_name);
|
|||
|
||||
const uuid_t *nd_dev_to_uuid(struct device *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return &uuid_null;
|
||||
|
||||
if (is_namespace_pmem(dev)) {
|
||||
if (dev && is_namespace_pmem(dev)) {
|
||||
struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
|
||||
|
||||
return nspm->uuid;
|
||||
} else
|
||||
}
|
||||
return &uuid_null;
|
||||
}
|
||||
EXPORT_SYMBOL(nd_dev_to_uuid);
|
||||
|
@ -388,7 +385,7 @@ static resource_size_t init_dpa_allocation(struct nd_label_id *label_id,
|
|||
*
|
||||
* BLK-space is valid as long as it does not precede a PMEM
|
||||
* allocation in a given region. PMEM-space must be contiguous
|
||||
* and adjacent to an existing existing allocation (if one
|
||||
* and adjacent to an existing allocation (if one
|
||||
* exists). If reserving PMEM any space is valid.
|
||||
*/
|
||||
static void space_valid(struct nd_region *nd_region, struct nvdimm_drvdata *ndd,
|
||||
|
@ -839,7 +836,6 @@ static ssize_t size_store(struct device *dev,
|
|||
{
|
||||
struct nd_region *nd_region = to_nd_region(dev->parent);
|
||||
unsigned long long val;
|
||||
uuid_t **uuid = NULL;
|
||||
int rc;
|
||||
|
||||
rc = kstrtoull(buf, 0, &val);
|
||||
|
@ -853,16 +849,12 @@ static ssize_t size_store(struct device *dev,
|
|||
if (rc >= 0)
|
||||
rc = nd_namespace_label_update(nd_region, dev);
|
||||
|
||||
if (is_namespace_pmem(dev)) {
|
||||
/* setting size zero == 'delete namespace' */
|
||||
if (rc == 0 && val == 0 && is_namespace_pmem(dev)) {
|
||||
struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
|
||||
|
||||
uuid = &nspm->uuid;
|
||||
}
|
||||
|
||||
if (rc == 0 && val == 0 && uuid) {
|
||||
/* setting size zero == 'delete namespace' */
|
||||
kfree(*uuid);
|
||||
*uuid = NULL;
|
||||
kfree(nspm->uuid);
|
||||
nspm->uuid = NULL;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "%llx %s (%d)\n", val, rc < 0 ? "fail" : "success", rc);
|
||||
|
|
|
@ -509,16 +509,13 @@ static ssize_t align_store(struct device *dev,
|
|||
{
|
||||
struct nd_region *nd_region = to_nd_region(dev);
|
||||
unsigned long val, dpa;
|
||||
u32 remainder;
|
||||
u32 mappings, remainder;
|
||||
int rc;
|
||||
|
||||
rc = kstrtoul(buf, 0, &val);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (!nd_region->ndr_mappings)
|
||||
return -ENXIO;
|
||||
|
||||
/*
|
||||
* Ensure space-align is evenly divisible by the region
|
||||
* interleave-width because the kernel typically has no facility
|
||||
|
@ -526,7 +523,8 @@ static ssize_t align_store(struct device *dev,
|
|||
* contribute to the tail capacity in system-physical-address
|
||||
* space for the namespace.
|
||||
*/
|
||||
dpa = div_u64_rem(val, nd_region->ndr_mappings, &remainder);
|
||||
mappings = max_t(u32, 1, nd_region->ndr_mappings);
|
||||
dpa = div_u64_rem(val, mappings, &remainder);
|
||||
if (!is_power_of_2(dpa) || dpa < PAGE_SIZE
|
||||
|| val > region_size(nd_region) || remainder)
|
||||
return -EINVAL;
|
||||
|
@ -1096,7 +1094,7 @@ int nvdimm_flush(struct nd_region *nd_region, struct bio *bio)
|
|||
return rc;
|
||||
}
|
||||
/**
|
||||
* nvdimm_flush - flush any posted write queues between the cpu and pmem media
|
||||
* generic_nvdimm_flush() - flush any posted write queues between the cpu and pmem media
|
||||
* @nd_region: interleaved pmem region
|
||||
*/
|
||||
int generic_nvdimm_flush(struct nd_region *nd_region)
|
||||
|
|
|
@ -408,7 +408,7 @@ static int security_overwrite(struct nvdimm *nvdimm, unsigned int keyid)
|
|||
return rc;
|
||||
}
|
||||
|
||||
void __nvdimm_security_overwrite_query(struct nvdimm *nvdimm)
|
||||
static void __nvdimm_security_overwrite_query(struct nvdimm *nvdimm)
|
||||
{
|
||||
struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(&nvdimm->dev);
|
||||
int rc;
|
||||
|
|
Loading…
Reference in New Issue