libnvdimm: remove redundant __func__ in dev_dbg
Dynamic debug can be instructed to add the function name to the debug output using the +f switch, so there is no need for the libnvdimm modules to do it again. If a user decides to add the +f switch for libnvdimm's dynamic debug this results in double prints of the function name. Reported-by: Johannes Thumshirn <jthumshirn@suse.de> Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
b814735f5c
commit
426824d63b
10 changed files with 77 additions and 93 deletions
|
@ -26,7 +26,7 @@ static void nd_btt_release(struct device *dev)
|
||||||
struct nd_region *nd_region = to_nd_region(dev->parent);
|
struct nd_region *nd_region = to_nd_region(dev->parent);
|
||||||
struct nd_btt *nd_btt = to_nd_btt(dev);
|
struct nd_btt *nd_btt = to_nd_btt(dev);
|
||||||
|
|
||||||
dev_dbg(dev, "%s\n", __func__);
|
dev_dbg(dev, "trace\n");
|
||||||
nd_detach_ndns(&nd_btt->dev, &nd_btt->ndns);
|
nd_detach_ndns(&nd_btt->dev, &nd_btt->ndns);
|
||||||
ida_simple_remove(&nd_region->btt_ida, nd_btt->id);
|
ida_simple_remove(&nd_region->btt_ida, nd_btt->id);
|
||||||
kfree(nd_btt->uuid);
|
kfree(nd_btt->uuid);
|
||||||
|
@ -74,8 +74,8 @@ static ssize_t sector_size_store(struct device *dev,
|
||||||
nvdimm_bus_lock(dev);
|
nvdimm_bus_lock(dev);
|
||||||
rc = nd_size_select_store(dev, buf, &nd_btt->lbasize,
|
rc = nd_size_select_store(dev, buf, &nd_btt->lbasize,
|
||||||
btt_lbasize_supported);
|
btt_lbasize_supported);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
buf[len - 1] == '\n' ? "" : "\n");
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ static ssize_t uuid_store(struct device *dev,
|
||||||
|
|
||||||
device_lock(dev);
|
device_lock(dev);
|
||||||
rc = nd_uuid_store(dev, &nd_btt->uuid, buf, len);
|
rc = nd_uuid_store(dev, &nd_btt->uuid, buf, len);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
buf[len - 1] == '\n' ? "" : "\n");
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
return rc ? rc : len;
|
return rc ? rc : len;
|
||||||
|
@ -131,8 +131,8 @@ static ssize_t namespace_store(struct device *dev,
|
||||||
device_lock(dev);
|
device_lock(dev);
|
||||||
nvdimm_bus_lock(dev);
|
nvdimm_bus_lock(dev);
|
||||||
rc = nd_namespace_store(dev, &nd_btt->ndns, buf, len);
|
rc = nd_namespace_store(dev, &nd_btt->ndns, buf, len);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
buf[len - 1] == '\n' ? "" : "\n");
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -206,8 +206,8 @@ static struct device *__nd_btt_create(struct nd_region *nd_region,
|
||||||
dev->groups = nd_btt_attribute_groups;
|
dev->groups = nd_btt_attribute_groups;
|
||||||
device_initialize(&nd_btt->dev);
|
device_initialize(&nd_btt->dev);
|
||||||
if (ndns && !__nd_attach_ndns(&nd_btt->dev, ndns, &nd_btt->ndns)) {
|
if (ndns && !__nd_attach_ndns(&nd_btt->dev, ndns, &nd_btt->ndns)) {
|
||||||
dev_dbg(&ndns->dev, "%s failed, already claimed by %s\n",
|
dev_dbg(&ndns->dev, "failed, already claimed by %s\n",
|
||||||
__func__, dev_name(ndns->claim));
|
dev_name(ndns->claim));
|
||||||
put_device(dev);
|
put_device(dev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -346,8 +346,7 @@ int nd_btt_probe(struct device *dev, struct nd_namespace_common *ndns)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
btt_sb = devm_kzalloc(dev, sizeof(*btt_sb), GFP_KERNEL);
|
btt_sb = devm_kzalloc(dev, sizeof(*btt_sb), GFP_KERNEL);
|
||||||
rc = __nd_btt_probe(to_nd_btt(btt_dev), ndns, btt_sb);
|
rc = __nd_btt_probe(to_nd_btt(btt_dev), ndns, btt_sb);
|
||||||
dev_dbg(dev, "%s: btt: %s\n", __func__,
|
dev_dbg(dev, "btt: %s\n", rc == 0 ? dev_name(btt_dev) : "<none>");
|
||||||
rc == 0 ? dev_name(btt_dev) : "<none>");
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
struct nd_btt *nd_btt = to_nd_btt(btt_dev);
|
struct nd_btt *nd_btt = to_nd_btt(btt_dev);
|
||||||
|
|
||||||
|
|
|
@ -984,8 +984,8 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
|
||||||
|
|
||||||
if (cmd == ND_CMD_CALL) {
|
if (cmd == ND_CMD_CALL) {
|
||||||
func = pkg.nd_command;
|
func = pkg.nd_command;
|
||||||
dev_dbg(dev, "%s:%s, idx: %llu, in: %u, out: %u, len %llu\n",
|
dev_dbg(dev, "%s, idx: %llu, in: %u, out: %u, len %llu\n",
|
||||||
__func__, dimm_name, pkg.nd_command,
|
dimm_name, pkg.nd_command,
|
||||||
in_len, out_len, buf_len);
|
in_len, out_len, buf_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -996,8 +996,8 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
|
||||||
u32 copy;
|
u32 copy;
|
||||||
|
|
||||||
if (out_size == UINT_MAX) {
|
if (out_size == UINT_MAX) {
|
||||||
dev_dbg(dev, "%s:%s unknown output size cmd: %s field: %d\n",
|
dev_dbg(dev, "%s unknown output size cmd: %s field: %d\n",
|
||||||
__func__, dimm_name, cmd_name, i);
|
dimm_name, cmd_name, i);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
if (out_len < sizeof(out_env))
|
if (out_len < sizeof(out_env))
|
||||||
|
@ -1012,9 +1012,8 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
|
||||||
|
|
||||||
buf_len = (u64) out_len + (u64) in_len;
|
buf_len = (u64) out_len + (u64) in_len;
|
||||||
if (buf_len > ND_IOCTL_MAX_BUFLEN) {
|
if (buf_len > ND_IOCTL_MAX_BUFLEN) {
|
||||||
dev_dbg(dev, "%s:%s cmd: %s buf_len: %llu > %d\n", __func__,
|
dev_dbg(dev, "%s cmd: %s buf_len: %llu > %d\n", dimm_name,
|
||||||
dimm_name, cmd_name, buf_len,
|
cmd_name, buf_len, ND_IOCTL_MAX_BUFLEN);
|
||||||
ND_IOCTL_MAX_BUFLEN);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ ssize_t nd_namespace_store(struct device *dev,
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
if (dev->driver) {
|
if (dev->driver) {
|
||||||
dev_dbg(dev, "%s: -EBUSY\n", __func__);
|
dev_dbg(dev, "namespace already active\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ static void nvdimm_map_release(struct kref *kref)
|
||||||
nvdimm_map = container_of(kref, struct nvdimm_map, kref);
|
nvdimm_map = container_of(kref, struct nvdimm_map, kref);
|
||||||
nvdimm_bus = nvdimm_map->nvdimm_bus;
|
nvdimm_bus = nvdimm_map->nvdimm_bus;
|
||||||
|
|
||||||
dev_dbg(&nvdimm_bus->dev, "%s: %pa\n", __func__, &nvdimm_map->offset);
|
dev_dbg(&nvdimm_bus->dev, "%pa\n", &nvdimm_map->offset);
|
||||||
list_del(&nvdimm_map->list);
|
list_del(&nvdimm_map->list);
|
||||||
if (nvdimm_map->flags)
|
if (nvdimm_map->flags)
|
||||||
memunmap(nvdimm_map->mem);
|
memunmap(nvdimm_map->mem);
|
||||||
|
@ -230,8 +230,8 @@ static int nd_uuid_parse(struct device *dev, u8 *uuid_out, const char *buf,
|
||||||
|
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
if (!isxdigit(str[0]) || !isxdigit(str[1])) {
|
if (!isxdigit(str[0]) || !isxdigit(str[1])) {
|
||||||
dev_dbg(dev, "%s: pos: %d buf[%zd]: %c buf[%zd]: %c\n",
|
dev_dbg(dev, "pos: %d buf[%zd]: %c buf[%zd]: %c\n",
|
||||||
__func__, i, str - buf, str[0],
|
i, str - buf, str[0],
|
||||||
str + 1 - buf, str[1]);
|
str + 1 - buf, str[1]);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ static void nd_dax_release(struct device *dev)
|
||||||
struct nd_dax *nd_dax = to_nd_dax(dev);
|
struct nd_dax *nd_dax = to_nd_dax(dev);
|
||||||
struct nd_pfn *nd_pfn = &nd_dax->nd_pfn;
|
struct nd_pfn *nd_pfn = &nd_dax->nd_pfn;
|
||||||
|
|
||||||
dev_dbg(dev, "%s\n", __func__);
|
dev_dbg(dev, "trace\n");
|
||||||
nd_detach_ndns(dev, &nd_pfn->ndns);
|
nd_detach_ndns(dev, &nd_pfn->ndns);
|
||||||
ida_simple_remove(&nd_region->dax_ida, nd_pfn->id);
|
ida_simple_remove(&nd_region->dax_ida, nd_pfn->id);
|
||||||
kfree(nd_pfn->uuid);
|
kfree(nd_pfn->uuid);
|
||||||
|
@ -129,8 +129,7 @@ int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns)
|
||||||
pfn_sb = devm_kzalloc(dev, sizeof(*pfn_sb), GFP_KERNEL);
|
pfn_sb = devm_kzalloc(dev, sizeof(*pfn_sb), GFP_KERNEL);
|
||||||
nd_pfn->pfn_sb = pfn_sb;
|
nd_pfn->pfn_sb = pfn_sb;
|
||||||
rc = nd_pfn_validate(nd_pfn, DAX_SIG);
|
rc = nd_pfn_validate(nd_pfn, DAX_SIG);
|
||||||
dev_dbg(dev, "%s: dax: %s\n", __func__,
|
dev_dbg(dev, "dax: %s\n", rc == 0 ? dev_name(dax_dev) : "<none>");
|
||||||
rc == 0 ? dev_name(dax_dev) : "<none>");
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
nd_detach_ndns(dax_dev, &nd_pfn->ndns);
|
nd_detach_ndns(dax_dev, &nd_pfn->ndns);
|
||||||
put_device(dax_dev);
|
put_device(dax_dev);
|
||||||
|
|
|
@ -131,7 +131,7 @@ int nvdimm_init_config_data(struct nvdimm_drvdata *ndd)
|
||||||
}
|
}
|
||||||
memcpy(ndd->data + offset, cmd->out_buf, cmd->in_length);
|
memcpy(ndd->data + offset, cmd->out_buf, cmd->in_length);
|
||||||
}
|
}
|
||||||
dev_dbg(ndd->dev, "%s: len: %zu rc: %d\n", __func__, offset, rc);
|
dev_dbg(ndd->dev, "len: %zu rc: %d\n", offset, rc);
|
||||||
kfree(cmd);
|
kfree(cmd);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -266,8 +266,7 @@ void nvdimm_drvdata_release(struct kref *kref)
|
||||||
struct device *dev = ndd->dev;
|
struct device *dev = ndd->dev;
|
||||||
struct resource *res, *_r;
|
struct resource *res, *_r;
|
||||||
|
|
||||||
dev_dbg(dev, "%s\n", __func__);
|
dev_dbg(dev, "trace\n");
|
||||||
|
|
||||||
nvdimm_bus_lock(dev);
|
nvdimm_bus_lock(dev);
|
||||||
for_each_dpa_resource_safe(ndd, res, _r)
|
for_each_dpa_resource_safe(ndd, res, _r)
|
||||||
nvdimm_free_dpa(ndd, res);
|
nvdimm_free_dpa(ndd, res);
|
||||||
|
@ -660,7 +659,7 @@ int nvdimm_bus_check_dimm_count(struct nvdimm_bus *nvdimm_bus, int dimm_count)
|
||||||
nd_synchronize();
|
nd_synchronize();
|
||||||
|
|
||||||
device_for_each_child(&nvdimm_bus->dev, &count, count_dimms);
|
device_for_each_child(&nvdimm_bus->dev, &count, count_dimms);
|
||||||
dev_dbg(&nvdimm_bus->dev, "%s: count: %d\n", __func__, count);
|
dev_dbg(&nvdimm_bus->dev, "count: %d\n", count);
|
||||||
if (count != dimm_count)
|
if (count != dimm_count)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -121,8 +121,7 @@ static int __nd_label_validate(struct nvdimm_drvdata *ndd)
|
||||||
|
|
||||||
memcpy(sig, nsindex[i]->sig, NSINDEX_SIG_LEN);
|
memcpy(sig, nsindex[i]->sig, NSINDEX_SIG_LEN);
|
||||||
if (memcmp(sig, NSINDEX_SIGNATURE, NSINDEX_SIG_LEN) != 0) {
|
if (memcmp(sig, NSINDEX_SIGNATURE, NSINDEX_SIG_LEN) != 0) {
|
||||||
dev_dbg(dev, "%s: nsindex%d signature invalid\n",
|
dev_dbg(dev, "nsindex%d signature invalid\n", i);
|
||||||
__func__, i);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +134,8 @@ static int __nd_label_validate(struct nvdimm_drvdata *ndd)
|
||||||
labelsize = 128;
|
labelsize = 128;
|
||||||
|
|
||||||
if (labelsize != sizeof_namespace_label(ndd)) {
|
if (labelsize != sizeof_namespace_label(ndd)) {
|
||||||
dev_dbg(dev, "%s: nsindex%d labelsize %d invalid\n",
|
dev_dbg(dev, "nsindex%d labelsize %d invalid\n",
|
||||||
__func__, i, nsindex[i]->labelsize);
|
i, nsindex[i]->labelsize);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,30 +144,28 @@ static int __nd_label_validate(struct nvdimm_drvdata *ndd)
|
||||||
sum = nd_fletcher64(nsindex[i], sizeof_namespace_index(ndd), 1);
|
sum = nd_fletcher64(nsindex[i], sizeof_namespace_index(ndd), 1);
|
||||||
nsindex[i]->checksum = __cpu_to_le64(sum_save);
|
nsindex[i]->checksum = __cpu_to_le64(sum_save);
|
||||||
if (sum != sum_save) {
|
if (sum != sum_save) {
|
||||||
dev_dbg(dev, "%s: nsindex%d checksum invalid\n",
|
dev_dbg(dev, "nsindex%d checksum invalid\n", i);
|
||||||
__func__, i);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
seq = __le32_to_cpu(nsindex[i]->seq);
|
seq = __le32_to_cpu(nsindex[i]->seq);
|
||||||
if ((seq & NSINDEX_SEQ_MASK) == 0) {
|
if ((seq & NSINDEX_SEQ_MASK) == 0) {
|
||||||
dev_dbg(dev, "%s: nsindex%d sequence: %#x invalid\n",
|
dev_dbg(dev, "nsindex%d sequence: %#x invalid\n", i, seq);
|
||||||
__func__, i, seq);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sanity check the index against expected values */
|
/* sanity check the index against expected values */
|
||||||
if (__le64_to_cpu(nsindex[i]->myoff)
|
if (__le64_to_cpu(nsindex[i]->myoff)
|
||||||
!= i * sizeof_namespace_index(ndd)) {
|
!= i * sizeof_namespace_index(ndd)) {
|
||||||
dev_dbg(dev, "%s: nsindex%d myoff: %#llx invalid\n",
|
dev_dbg(dev, "nsindex%d myoff: %#llx invalid\n",
|
||||||
__func__, i, (unsigned long long)
|
i, (unsigned long long)
|
||||||
__le64_to_cpu(nsindex[i]->myoff));
|
__le64_to_cpu(nsindex[i]->myoff));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (__le64_to_cpu(nsindex[i]->otheroff)
|
if (__le64_to_cpu(nsindex[i]->otheroff)
|
||||||
!= (!i) * sizeof_namespace_index(ndd)) {
|
!= (!i) * sizeof_namespace_index(ndd)) {
|
||||||
dev_dbg(dev, "%s: nsindex%d otheroff: %#llx invalid\n",
|
dev_dbg(dev, "nsindex%d otheroff: %#llx invalid\n",
|
||||||
__func__, i, (unsigned long long)
|
i, (unsigned long long)
|
||||||
__le64_to_cpu(nsindex[i]->otheroff));
|
__le64_to_cpu(nsindex[i]->otheroff));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -176,8 +173,7 @@ static int __nd_label_validate(struct nvdimm_drvdata *ndd)
|
||||||
size = __le64_to_cpu(nsindex[i]->mysize);
|
size = __le64_to_cpu(nsindex[i]->mysize);
|
||||||
if (size > sizeof_namespace_index(ndd)
|
if (size > sizeof_namespace_index(ndd)
|
||||||
|| size < sizeof(struct nd_namespace_index)) {
|
|| size < sizeof(struct nd_namespace_index)) {
|
||||||
dev_dbg(dev, "%s: nsindex%d mysize: %#llx invalid\n",
|
dev_dbg(dev, "nsindex%d mysize: %#llx invalid\n", i, size);
|
||||||
__func__, i, size);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,9 +181,8 @@ static int __nd_label_validate(struct nvdimm_drvdata *ndd)
|
||||||
if (nslot * sizeof_namespace_label(ndd)
|
if (nslot * sizeof_namespace_label(ndd)
|
||||||
+ 2 * sizeof_namespace_index(ndd)
|
+ 2 * sizeof_namespace_index(ndd)
|
||||||
> ndd->nsarea.config_size) {
|
> ndd->nsarea.config_size) {
|
||||||
dev_dbg(dev, "%s: nsindex%d nslot: %u invalid, config_size: %#x\n",
|
dev_dbg(dev, "nsindex%d nslot: %u invalid, config_size: %#x\n",
|
||||||
__func__, i, nslot,
|
i, nslot, ndd->nsarea.config_size);
|
||||||
ndd->nsarea.config_size);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
valid[i] = true;
|
valid[i] = true;
|
||||||
|
@ -356,8 +351,8 @@ static bool slot_valid(struct nvdimm_drvdata *ndd,
|
||||||
sum = nd_fletcher64(nd_label, sizeof_namespace_label(ndd), 1);
|
sum = nd_fletcher64(nd_label, sizeof_namespace_label(ndd), 1);
|
||||||
nd_label->checksum = __cpu_to_le64(sum_save);
|
nd_label->checksum = __cpu_to_le64(sum_save);
|
||||||
if (sum != sum_save) {
|
if (sum != sum_save) {
|
||||||
dev_dbg(ndd->dev, "%s fail checksum. slot: %d expect: %#llx\n",
|
dev_dbg(ndd->dev, "fail checksum. slot: %d expect: %#llx\n",
|
||||||
__func__, slot, sum);
|
slot, sum);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,8 +417,8 @@ int nd_label_active_count(struct nvdimm_drvdata *ndd)
|
||||||
u64 dpa = __le64_to_cpu(nd_label->dpa);
|
u64 dpa = __le64_to_cpu(nd_label->dpa);
|
||||||
|
|
||||||
dev_dbg(ndd->dev,
|
dev_dbg(ndd->dev,
|
||||||
"%s: slot%d invalid slot: %d dpa: %llx size: %llx\n",
|
"slot%d invalid slot: %d dpa: %llx size: %llx\n",
|
||||||
__func__, slot, label_slot, dpa, size);
|
slot, label_slot, dpa, size);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
@ -650,7 +645,7 @@ static int __pmem_label_update(struct nd_region *nd_region,
|
||||||
slot = nd_label_alloc_slot(ndd);
|
slot = nd_label_alloc_slot(ndd);
|
||||||
if (slot == UINT_MAX)
|
if (slot == UINT_MAX)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
dev_dbg(ndd->dev, "%s: allocated: %d\n", __func__, slot);
|
dev_dbg(ndd->dev, "allocated: %d\n", slot);
|
||||||
|
|
||||||
nd_label = to_label(ndd, slot);
|
nd_label = to_label(ndd, slot);
|
||||||
memset(nd_label, 0, sizeof_namespace_label(ndd));
|
memset(nd_label, 0, sizeof_namespace_label(ndd));
|
||||||
|
@ -678,7 +673,7 @@ static int __pmem_label_update(struct nd_region *nd_region,
|
||||||
sum = nd_fletcher64(nd_label, sizeof_namespace_label(ndd), 1);
|
sum = nd_fletcher64(nd_label, sizeof_namespace_label(ndd), 1);
|
||||||
nd_label->checksum = __cpu_to_le64(sum);
|
nd_label->checksum = __cpu_to_le64(sum);
|
||||||
}
|
}
|
||||||
nd_dbg_dpa(nd_region, ndd, res, "%s\n", __func__);
|
nd_dbg_dpa(nd_region, ndd, res, "\n");
|
||||||
|
|
||||||
/* update label */
|
/* update label */
|
||||||
offset = nd_label_offset(ndd, nd_label);
|
offset = nd_label_offset(ndd, nd_label);
|
||||||
|
@ -700,7 +695,7 @@ static int __pmem_label_update(struct nd_region *nd_region,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (victim) {
|
if (victim) {
|
||||||
dev_dbg(ndd->dev, "%s: free: %d\n", __func__, slot);
|
dev_dbg(ndd->dev, "free: %d\n", slot);
|
||||||
slot = to_slot(ndd, victim->label);
|
slot = to_slot(ndd, victim->label);
|
||||||
nd_label_free_slot(ndd, slot);
|
nd_label_free_slot(ndd, slot);
|
||||||
victim->label = NULL;
|
victim->label = NULL;
|
||||||
|
@ -868,7 +863,7 @@ static int __blk_label_update(struct nd_region *nd_region,
|
||||||
slot = nd_label_alloc_slot(ndd);
|
slot = nd_label_alloc_slot(ndd);
|
||||||
if (slot == UINT_MAX)
|
if (slot == UINT_MAX)
|
||||||
goto abort;
|
goto abort;
|
||||||
dev_dbg(ndd->dev, "%s: allocated: %d\n", __func__, slot);
|
dev_dbg(ndd->dev, "allocated: %d\n", slot);
|
||||||
|
|
||||||
nd_label = to_label(ndd, slot);
|
nd_label = to_label(ndd, slot);
|
||||||
memset(nd_label, 0, sizeof_namespace_label(ndd));
|
memset(nd_label, 0, sizeof_namespace_label(ndd));
|
||||||
|
@ -928,7 +923,7 @@ static int __blk_label_update(struct nd_region *nd_region,
|
||||||
|
|
||||||
/* free up now unused slots in the new index */
|
/* free up now unused slots in the new index */
|
||||||
for_each_set_bit(slot, victim_map, victim_map ? nslot : 0) {
|
for_each_set_bit(slot, victim_map, victim_map ? nslot : 0) {
|
||||||
dev_dbg(ndd->dev, "%s: free: %d\n", __func__, slot);
|
dev_dbg(ndd->dev, "free: %d\n", slot);
|
||||||
nd_label_free_slot(ndd, slot);
|
nd_label_free_slot(ndd, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,7 +1087,7 @@ static int del_labels(struct nd_mapping *nd_mapping, u8 *uuid)
|
||||||
active--;
|
active--;
|
||||||
slot = to_slot(ndd, nd_label);
|
slot = to_slot(ndd, nd_label);
|
||||||
nd_label_free_slot(ndd, slot);
|
nd_label_free_slot(ndd, slot);
|
||||||
dev_dbg(ndd->dev, "%s: free: %d\n", __func__, slot);
|
dev_dbg(ndd->dev, "free: %d\n", slot);
|
||||||
list_move_tail(&label_ent->list, &list);
|
list_move_tail(&label_ent->list, &list);
|
||||||
label_ent->label = NULL;
|
label_ent->label = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1100,7 +1095,7 @@ static int del_labels(struct nd_mapping *nd_mapping, u8 *uuid)
|
||||||
|
|
||||||
if (active == 0) {
|
if (active == 0) {
|
||||||
nd_mapping_free_labels(nd_mapping);
|
nd_mapping_free_labels(nd_mapping);
|
||||||
dev_dbg(ndd->dev, "%s: no more active labels\n", __func__);
|
dev_dbg(ndd->dev, "no more active labels\n");
|
||||||
}
|
}
|
||||||
mutex_unlock(&nd_mapping->lock);
|
mutex_unlock(&nd_mapping->lock);
|
||||||
|
|
||||||
|
|
|
@ -421,7 +421,7 @@ static ssize_t alt_name_store(struct device *dev,
|
||||||
rc = __alt_name_store(dev, buf, len);
|
rc = __alt_name_store(dev, buf, len);
|
||||||
if (rc >= 0)
|
if (rc >= 0)
|
||||||
rc = nd_namespace_label_update(nd_region, dev);
|
rc = nd_namespace_label_update(nd_region, dev);
|
||||||
dev_dbg(dev, "%s: %s(%zd)\n", __func__, rc < 0 ? "fail " : "", rc);
|
dev_dbg(dev, "%s(%zd)\n", rc < 0 ? "fail " : "", rc);
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -1007,7 +1007,7 @@ static ssize_t __size_store(struct device *dev, unsigned long long val)
|
||||||
if (uuid_not_set(uuid, dev, __func__))
|
if (uuid_not_set(uuid, dev, __func__))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
if (nd_region->ndr_mappings == 0) {
|
if (nd_region->ndr_mappings == 0) {
|
||||||
dev_dbg(dev, "%s: not associated with dimm(s)\n", __func__);
|
dev_dbg(dev, "not associated with dimm(s)\n");
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1105,8 +1105,7 @@ static ssize_t size_store(struct device *dev,
|
||||||
*uuid = NULL;
|
*uuid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(dev, "%s: %llx %s (%d)\n", __func__, val, rc < 0
|
dev_dbg(dev, "%llx %s (%d)\n", val, rc < 0 ? "fail" : "success", rc);
|
||||||
? "fail" : "success", rc);
|
|
||||||
|
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
@ -1270,8 +1269,8 @@ static ssize_t uuid_store(struct device *dev,
|
||||||
rc = nd_namespace_label_update(nd_region, dev);
|
rc = nd_namespace_label_update(nd_region, dev);
|
||||||
else
|
else
|
||||||
kfree(uuid);
|
kfree(uuid);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
buf[len - 1] == '\n' ? "" : "\n");
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -1355,9 +1354,8 @@ static ssize_t sector_size_store(struct device *dev,
|
||||||
rc = nd_size_select_store(dev, buf, lbasize, supported);
|
rc = nd_size_select_store(dev, buf, lbasize, supported);
|
||||||
if (rc >= 0)
|
if (rc >= 0)
|
||||||
rc = nd_namespace_label_update(nd_region, dev);
|
rc = nd_namespace_label_update(nd_region, dev);
|
||||||
dev_dbg(dev, "%s: result: %zd %s: %s%s", __func__,
|
dev_dbg(dev, "result: %zd %s: %s%s", rc, rc < 0 ? "tried" : "wrote",
|
||||||
rc, rc < 0 ? "tried" : "wrote", buf,
|
buf, buf[len - 1] == '\n' ? "" : "\n");
|
||||||
buf[len - 1] == '\n' ? "" : "\n");
|
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -1519,7 +1517,7 @@ static ssize_t holder_class_store(struct device *dev,
|
||||||
rc = __holder_class_store(dev, buf);
|
rc = __holder_class_store(dev, buf);
|
||||||
if (rc >= 0)
|
if (rc >= 0)
|
||||||
rc = nd_namespace_label_update(nd_region, dev);
|
rc = nd_namespace_label_update(nd_region, dev);
|
||||||
dev_dbg(dev, "%s: %s(%zd)\n", __func__, rc < 0 ? "fail " : "", rc);
|
dev_dbg(dev, "%s(%zd)\n", rc < 0 ? "fail " : "", rc);
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -1717,8 +1715,7 @@ struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev)
|
||||||
if (uuid_not_set(nsblk->uuid, &ndns->dev, __func__))
|
if (uuid_not_set(nsblk->uuid, &ndns->dev, __func__))
|
||||||
return ERR_PTR(-ENODEV);
|
return ERR_PTR(-ENODEV);
|
||||||
if (!nsblk->lbasize) {
|
if (!nsblk->lbasize) {
|
||||||
dev_dbg(&ndns->dev, "%s: sector size not set\n",
|
dev_dbg(&ndns->dev, "sector size not set\n");
|
||||||
__func__);
|
|
||||||
return ERR_PTR(-ENODEV);
|
return ERR_PTR(-ENODEV);
|
||||||
}
|
}
|
||||||
if (!nd_namespace_blk_validate(nsblk))
|
if (!nd_namespace_blk_validate(nsblk))
|
||||||
|
@ -1798,9 +1795,7 @@ static bool has_uuid_at_pos(struct nd_region *nd_region, u8 *uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found_uuid) {
|
if (found_uuid) {
|
||||||
dev_dbg(ndd->dev,
|
dev_dbg(ndd->dev, "duplicate entry for uuid\n");
|
||||||
"%s duplicate entry for uuid\n",
|
|
||||||
__func__);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
found_uuid = true;
|
found_uuid = true;
|
||||||
|
@ -1994,14 +1989,13 @@ static struct device *create_namespace_pmem(struct nd_region *nd_region,
|
||||||
namespace_pmem_release(dev);
|
namespace_pmem_release(dev);
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case -EINVAL:
|
case -EINVAL:
|
||||||
dev_dbg(&nd_region->dev, "%s: invalid label(s)\n", __func__);
|
dev_dbg(&nd_region->dev, "invalid label(s)\n");
|
||||||
break;
|
break;
|
||||||
case -ENODEV:
|
case -ENODEV:
|
||||||
dev_dbg(&nd_region->dev, "%s: label not found\n", __func__);
|
dev_dbg(&nd_region->dev, "label not found\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_dbg(&nd_region->dev, "%s: unexpected err: %d\n",
|
dev_dbg(&nd_region->dev, "unexpected err: %d\n", rc);
|
||||||
__func__, rc);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ERR_PTR(rc);
|
return ERR_PTR(rc);
|
||||||
|
@ -2334,8 +2328,8 @@ static struct device **scan_labels(struct nd_region *nd_region)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(&nd_region->dev, "%s: discovered %d %s namespace%s\n",
|
dev_dbg(&nd_region->dev, "discovered %d %s namespace%s\n",
|
||||||
__func__, count, is_nd_blk(&nd_region->dev)
|
count, is_nd_blk(&nd_region->dev)
|
||||||
? "blk" : "pmem", count == 1 ? "" : "s");
|
? "blk" : "pmem", count == 1 ? "" : "s");
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
|
@ -2467,7 +2461,7 @@ static int init_active_labels(struct nd_region *nd_region)
|
||||||
get_ndd(ndd);
|
get_ndd(ndd);
|
||||||
|
|
||||||
count = nd_label_active_count(ndd);
|
count = nd_label_active_count(ndd);
|
||||||
dev_dbg(ndd->dev, "%s: %d\n", __func__, count);
|
dev_dbg(ndd->dev, "count: %d\n", count);
|
||||||
if (!count)
|
if (!count)
|
||||||
continue;
|
continue;
|
||||||
for (j = 0; j < count; j++) {
|
for (j = 0; j < count; j++) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ static void nd_pfn_release(struct device *dev)
|
||||||
struct nd_region *nd_region = to_nd_region(dev->parent);
|
struct nd_region *nd_region = to_nd_region(dev->parent);
|
||||||
struct nd_pfn *nd_pfn = to_nd_pfn(dev);
|
struct nd_pfn *nd_pfn = to_nd_pfn(dev);
|
||||||
|
|
||||||
dev_dbg(dev, "%s\n", __func__);
|
dev_dbg(dev, "trace\n");
|
||||||
nd_detach_ndns(&nd_pfn->dev, &nd_pfn->ndns);
|
nd_detach_ndns(&nd_pfn->dev, &nd_pfn->ndns);
|
||||||
ida_simple_remove(&nd_region->pfn_ida, nd_pfn->id);
|
ida_simple_remove(&nd_region->pfn_ida, nd_pfn->id);
|
||||||
kfree(nd_pfn->uuid);
|
kfree(nd_pfn->uuid);
|
||||||
|
@ -94,8 +94,8 @@ static ssize_t mode_store(struct device *dev,
|
||||||
else
|
else
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
}
|
}
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
buf[len - 1] == '\n' ? "" : "\n");
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -144,8 +144,8 @@ static ssize_t align_store(struct device *dev,
|
||||||
nvdimm_bus_lock(dev);
|
nvdimm_bus_lock(dev);
|
||||||
rc = nd_size_select_store(dev, buf, &nd_pfn->align,
|
rc = nd_size_select_store(dev, buf, &nd_pfn->align,
|
||||||
nd_pfn_supported_alignments());
|
nd_pfn_supported_alignments());
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
buf[len - 1] == '\n' ? "" : "\n");
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -171,8 +171,8 @@ static ssize_t uuid_store(struct device *dev,
|
||||||
|
|
||||||
device_lock(dev);
|
device_lock(dev);
|
||||||
rc = nd_uuid_store(dev, &nd_pfn->uuid, buf, len);
|
rc = nd_uuid_store(dev, &nd_pfn->uuid, buf, len);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
buf[len - 1] == '\n' ? "" : "\n");
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
return rc ? rc : len;
|
return rc ? rc : len;
|
||||||
|
@ -201,8 +201,8 @@ static ssize_t namespace_store(struct device *dev,
|
||||||
device_lock(dev);
|
device_lock(dev);
|
||||||
nvdimm_bus_lock(dev);
|
nvdimm_bus_lock(dev);
|
||||||
rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
|
rc = nd_namespace_store(dev, &nd_pfn->ndns, buf, len);
|
||||||
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
|
dev_dbg(dev, "result: %zd wrote: %s%s", rc, buf,
|
||||||
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
|
buf[len - 1] == '\n' ? "" : "\n");
|
||||||
nvdimm_bus_unlock(dev);
|
nvdimm_bus_unlock(dev);
|
||||||
device_unlock(dev);
|
device_unlock(dev);
|
||||||
|
|
||||||
|
@ -314,8 +314,8 @@ struct device *nd_pfn_devinit(struct nd_pfn *nd_pfn,
|
||||||
dev = &nd_pfn->dev;
|
dev = &nd_pfn->dev;
|
||||||
device_initialize(&nd_pfn->dev);
|
device_initialize(&nd_pfn->dev);
|
||||||
if (ndns && !__nd_attach_ndns(&nd_pfn->dev, ndns, &nd_pfn->ndns)) {
|
if (ndns && !__nd_attach_ndns(&nd_pfn->dev, ndns, &nd_pfn->ndns)) {
|
||||||
dev_dbg(&ndns->dev, "%s failed, already claimed by %s\n",
|
dev_dbg(&ndns->dev, "failed, already claimed by %s\n",
|
||||||
__func__, dev_name(ndns->claim));
|
dev_name(ndns->claim));
|
||||||
put_device(dev);
|
put_device(dev);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -510,8 +510,7 @@ int nd_pfn_probe(struct device *dev, struct nd_namespace_common *ndns)
|
||||||
nd_pfn = to_nd_pfn(pfn_dev);
|
nd_pfn = to_nd_pfn(pfn_dev);
|
||||||
nd_pfn->pfn_sb = pfn_sb;
|
nd_pfn->pfn_sb = pfn_sb;
|
||||||
rc = nd_pfn_validate(nd_pfn, PFN_SIG);
|
rc = nd_pfn_validate(nd_pfn, PFN_SIG);
|
||||||
dev_dbg(dev, "%s: pfn: %s\n", __func__,
|
dev_dbg(dev, "pfn: %s\n", rc == 0 ? dev_name(pfn_dev) : "<none>");
|
||||||
rc == 0 ? dev_name(pfn_dev) : "<none>");
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
nd_detach_ndns(pfn_dev, &nd_pfn->ndns);
|
nd_detach_ndns(pfn_dev, &nd_pfn->ndns);
|
||||||
put_device(pfn_dev);
|
put_device(pfn_dev);
|
||||||
|
|
|
@ -66,7 +66,7 @@ static blk_status_t pmem_clear_poison(struct pmem_device *pmem,
|
||||||
rc = BLK_STS_IOERR;
|
rc = BLK_STS_IOERR;
|
||||||
if (cleared > 0 && cleared / 512) {
|
if (cleared > 0 && cleared / 512) {
|
||||||
cleared /= 512;
|
cleared /= 512;
|
||||||
dev_dbg(dev, "%s: %#llx clear %ld sector%s\n", __func__,
|
dev_dbg(dev, "%#llx clear %ld sector%s\n",
|
||||||
(unsigned long long) sector, cleared,
|
(unsigned long long) sector, cleared,
|
||||||
cleared > 1 ? "s" : "");
|
cleared > 1 ? "s" : "");
|
||||||
badblocks_clear(&pmem->bb, sector, cleared);
|
badblocks_clear(&pmem->bb, sector, cleared);
|
||||||
|
|
Loading…
Add table
Reference in a new issue