diff options
author | Dan Williams <dan.j.williams@intel.com> | 2016-09-19 16:04:21 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2016-09-30 19:13:42 -0700 |
commit | ae8219f186d8e98a3239afc6ea49bb46f2871d2f (patch) | |
tree | 8c32ce83b2e3b6d5b9a7565edd2ab305436131ef /drivers/nvdimm/nd.h | |
parent | 44c462eb9e19dfa089b454271dd2dff5eaf1ad6d (diff) | |
download | linux-ae8219f186d8e98a3239afc6ea49bb46f2871d2f.tar.gz linux-ae8219f186d8e98a3239afc6ea49bb46f2871d2f.tar.bz2 linux-ae8219f186d8e98a3239afc6ea49bb46f2871d2f.zip |
libnvdimm, label: convert label tracking to a linked list
In preparation for enabling multiple namespaces per pmem region, convert
the label tracking to use a linked list. In particular this will allow
select_pmem_id() to move labels from the unvalidated state to the
validated state. Currently we only track one validated set per-region.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/nvdimm/nd.h')
-rw-r--r-- | drivers/nvdimm/nd.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index e58c40824e1f..f67c61f1a8a4 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h @@ -83,9 +83,6 @@ static inline struct nd_namespace_index *to_next_namespace_index( (unsigned long long) (res ? resource_size(res) : 0), \ (unsigned long long) (res ? res->start : 0), ##arg) -#define for_each_label(l, label, labels) \ - for (l = 0; (label = labels ? labels[l] : NULL); l++) - #define for_each_dpa_resource(ndd, res) \ for (res = (ndd)->dpa.child; res; res = res->sibling) @@ -98,11 +95,22 @@ struct nd_percpu_lane { spinlock_t lock; }; +struct nd_label_ent { + struct list_head list; + struct nd_namespace_label *label; +}; + +enum nd_mapping_lock_class { + ND_MAPPING_CLASS0, + ND_MAPPING_UUID_SCAN, +}; + struct nd_mapping { struct nvdimm *nvdimm; - struct nd_namespace_label **labels; u64 start; u64 size; + struct list_head labels; + struct mutex lock; /* * @ndd is for private use at region enable / disable time for * get_ndd() + put_ndd(), all other nd_mapping to ndd |