]> git.baikalelectronics.ru Git - kernel.git/commit
libnvdimm, label: fix index block size calculation
authorDan Williams <dan.j.williams@intel.com>
Wed, 30 Aug 2017 01:28:18 +0000 (18:28 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 30 Aug 2017 01:28:18 +0000 (18:28 -0700)
commit70572602dc02e357667c9fd77b79b0ff7edc7a03
tree4e8457f9a47764d13b0d1d17ae59dea07a1076fa
parentef6b0a358acd6f153f1c73c04d5889ee03d411f3
libnvdimm, label: fix index block size calculation

The old calculation assumed that the label space was 128k and the label
size is 128. With v1.2 labels where the label size is 256 this
calculation will return zero. We are saved by the fact that the
nsindex_size is always pre-initialized from a previous 128 byte
assumption and we are lucky that the index sizes turn out the same.

Fix this going forward in case we start encountering different
geometries of label areas besides 128k.

Since the label size can change from one call to the next, drop the
caching of nsindex_size.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/nvdimm/label.c
drivers/nvdimm/nd.h