libnvdimm, region: move region-mapping input-paramters to nd_mapping_desc
Before we add more libnvdimm-private fields to nd_mapping make it clear which parameters are input vs libnvdimm internals. Use struct nd_mapping_desc instead of struct nd_mapping in nd_region_desc and make struct nd_mapping private to libnvdimm. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
@@ -98,6 +98,20 @@ struct nd_percpu_lane {
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
struct nd_mapping {
|
||||
struct nvdimm *nvdimm;
|
||||
struct nd_namespace_label **labels;
|
||||
u64 start;
|
||||
u64 size;
|
||||
/*
|
||||
* @ndd is for private use at region enable / disable time for
|
||||
* get_ndd() + put_ndd(), all other nd_mapping to ndd
|
||||
* conversions use to_ndd() which respects enabled state of the
|
||||
* nvdimm.
|
||||
*/
|
||||
struct nvdimm_drvdata *ndd;
|
||||
};
|
||||
|
||||
struct nd_region {
|
||||
struct device dev;
|
||||
struct ida ns_ida;
|
||||
|
@@ -755,10 +755,10 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
|
||||
int ro = 0;
|
||||
|
||||
for (i = 0; i < ndr_desc->num_mappings; i++) {
|
||||
struct nd_mapping *nd_mapping = &ndr_desc->nd_mapping[i];
|
||||
struct nvdimm *nvdimm = nd_mapping->nvdimm;
|
||||
struct nd_mapping_desc *mapping = &ndr_desc->mapping[i];
|
||||
struct nvdimm *nvdimm = mapping->nvdimm;
|
||||
|
||||
if ((nd_mapping->start | nd_mapping->size) % SZ_4K) {
|
||||
if ((mapping->start | mapping->size) % SZ_4K) {
|
||||
dev_err(&nvdimm_bus->dev, "%s: %s mapping%d is not 4K aligned\n",
|
||||
caller, dev_name(&nvdimm->dev), i);
|
||||
|
||||
@@ -809,11 +809,13 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
|
||||
ndl->count = 0;
|
||||
}
|
||||
|
||||
memcpy(nd_region->mapping, ndr_desc->nd_mapping,
|
||||
sizeof(struct nd_mapping) * ndr_desc->num_mappings);
|
||||
for (i = 0; i < ndr_desc->num_mappings; i++) {
|
||||
struct nd_mapping *nd_mapping = &ndr_desc->nd_mapping[i];
|
||||
struct nvdimm *nvdimm = nd_mapping->nvdimm;
|
||||
struct nd_mapping_desc *mapping = &ndr_desc->mapping[i];
|
||||
struct nvdimm *nvdimm = mapping->nvdimm;
|
||||
|
||||
nd_region->mapping[i].nvdimm = nvdimm;
|
||||
nd_region->mapping[i].start = mapping->start;
|
||||
nd_region->mapping[i].size = mapping->size;
|
||||
|
||||
get_device(&nvdimm->dev);
|
||||
}
|
||||
|
مرجع در شماره جدید
Block a user