libnvdimm, region: update nd_region_available_dpa() for multi-pmem support
authorDan Williams <dan.j.williams@intel.com>
Sat, 1 Oct 2016 00:28:58 +0000 (17:28 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 7 Oct 2016 16:20:53 +0000 (09:20 -0700)
commita1f3e4d6a0c322eb3e7fdfcc9facdcdf19130434
treec737905cc17b5dd0f5b6015f1e0a0fcee0301a73
parent6ff3e912d32ece4e9cf8708da796e9e2e7979ffe
libnvdimm, region: update nd_region_available_dpa() for multi-pmem support

The free dpa (dimm-physical-address) space calculation reports how much
free space is available with consideration for aliased BLK + PMEM
regions.  Recall that BLK capacity is allocated from high addresses and
PMEM is allocated from low addresses in their respective regions.

nd_region_available_dpa() accounts for the fact that the largest
encroachment (lowest starting address) into PMEM capacity by a BLK
allocation limits the available capacity to that point, regardless if
there is BLK allocation hole at a higher address.  Similarly, for the
multi-pmem case we need to track the largest encroachment (highest
 ending address) of a PMEM allocation in BLK capacity regardless of
whether there is an allocation hole that a BLK allocation could fill at
a lower address.

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