aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvdimm/nd-core.h
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-10-04 19:09:59 -0400
committerDan Williams <dan.j.williams@intel.com>2016-10-07 12:22:53 -0400
commit762d067dbad5f32560cb1657b7ca20034332dc56 (patch)
tree2d8b4300b38d277dfff626a067d44b1c3cf832b0 /drivers/nvdimm/nd-core.h
parent16660eaea0ccc6d0692f173922cd365876eb288e (diff)
libnvdimm, namespace: enable allocation of multiple pmem namespaces
Now that we have nd_region_available_dpa() able to handle the presence of multiple PMEM allocations in aliased PMEM regions, reuse that same infrastructure to track allocations from free space. In particular handle allocating from an aliased PMEM region in the case where there are dis-contiguous holes. The allocation for BLK and PMEM are documented in the space_valid() helper: 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 exists). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/nd-core.h')
-rw-r--r--drivers/nvdimm/nd-core.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/nvdimm/nd-core.h b/drivers/nvdimm/nd-core.h
index 7c2196a1d56f..3ba0b96ce7de 100644
--- a/drivers/nvdimm/nd-core.h
+++ b/drivers/nvdimm/nd-core.h
@@ -44,6 +44,23 @@ struct nvdimm {
44 struct resource *flush_wpq; 44 struct resource *flush_wpq;
45}; 45};
46 46
47/**
48 * struct blk_alloc_info - tracking info for BLK dpa scanning
49 * @nd_mapping: blk region mapping boundaries
50 * @available: decremented in alias_dpa_busy as aliased PMEM is scanned
51 * @busy: decremented in blk_dpa_busy to account for ranges already
52 * handled by alias_dpa_busy
53 * @res: alias_dpa_busy interprets this a free space range that needs to
54 * be truncated to the valid BLK allocation starting DPA, blk_dpa_busy
55 * treats it as a busy range that needs the aliased PMEM ranges
56 * truncated.
57 */
58struct blk_alloc_info {
59 struct nd_mapping *nd_mapping;
60 resource_size_t available, busy;
61 struct resource *res;
62};
63
47bool is_nvdimm(struct device *dev); 64bool is_nvdimm(struct device *dev);
48bool is_nd_pmem(struct device *dev); 65bool is_nd_pmem(struct device *dev);
49bool is_nd_blk(struct device *dev); 66bool is_nd_blk(struct device *dev);
@@ -80,6 +97,7 @@ resource_size_t nd_blk_available_dpa(struct nd_region *nd_region);
80resource_size_t nd_region_available_dpa(struct nd_region *nd_region); 97resource_size_t nd_region_available_dpa(struct nd_region *nd_region);
81resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd, 98resource_size_t nvdimm_allocated_dpa(struct nvdimm_drvdata *ndd,
82 struct nd_label_id *label_id); 99 struct nd_label_id *label_id);
100int alias_dpa_busy(struct device *dev, void *data);
83struct resource *nsblk_add_resource(struct nd_region *nd_region, 101struct resource *nsblk_add_resource(struct nd_region *nd_region,
84 struct nvdimm_drvdata *ndd, struct nd_namespace_blk *nsblk, 102 struct nvdimm_drvdata *ndd, struct nd_namespace_blk *nsblk,
85 resource_size_t start); 103 resource_size_t start);