aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-03-31 12:37:11 -0400
committerDan Williams <dan.j.williams@intel.com>2016-05-09 18:35:42 -0400
commit52ac23b25eb26511f8dea2382534eeada2fa8244 (patch)
tree6ecbcf8dbdb426016fb8cb6839154e9f6f20f431
parentcd03412a51ac4cb3001a8cdfae4560c9602f3387 (diff)
libnvdimm, dax: reserve space to store labels for device-dax
We may want to subdivide a device-dax range into multiple devices so that each can have separate permissions or naming. Reserve 128K of label space by default so we have the capability of making allocation decisions persistent. This reservation is not something we can add later since it would result in the default size of a device-dax range changing between kernel versions. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r--drivers/nvdimm/pfn_devs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
index 6ade2eb7615d..ca396c8f2cd5 100644
--- a/drivers/nvdimm/pfn_devs.c
+++ b/drivers/nvdimm/pfn_devs.c
@@ -540,6 +540,7 @@ static struct vmem_altmap *__nvdimm_setup_pfn(struct nd_pfn *nd_pfn,
540 540
541static int nd_pfn_init(struct nd_pfn *nd_pfn) 541static int nd_pfn_init(struct nd_pfn *nd_pfn)
542{ 542{
543 u32 dax_label_reserve = is_nd_dax(&nd_pfn->dev) ? SZ_128K : 0;
543 struct nd_namespace_common *ndns = nd_pfn->ndns; 544 struct nd_namespace_common *ndns = nd_pfn->ndns;
544 u32 start_pad = 0, end_trunc = 0; 545 u32 start_pad = 0, end_trunc = 0;
545 resource_size_t start, size; 546 resource_size_t start, size;
@@ -606,10 +607,11 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn)
606 size = resource_size(&nsio->res); 607 size = resource_size(&nsio->res);
607 npfns = (size - start_pad - end_trunc - SZ_8K) / SZ_4K; 608 npfns = (size - start_pad - end_trunc - SZ_8K) / SZ_4K;
608 if (nd_pfn->mode == PFN_MODE_PMEM) 609 if (nd_pfn->mode == PFN_MODE_PMEM)
609 offset = ALIGN(start + SZ_8K + 64 * npfns, nd_pfn->align) 610 offset = ALIGN(start + SZ_8K + 64 * npfns + dax_label_reserve,
610 - start; 611 nd_pfn->align) - start;
611 else if (nd_pfn->mode == PFN_MODE_RAM) 612 else if (nd_pfn->mode == PFN_MODE_RAM)
612 offset = ALIGN(start + SZ_8K, nd_pfn->align) - start; 613 offset = ALIGN(start + SZ_8K + dax_label_reserve,
614 nd_pfn->align) - start;
613 else 615 else
614 return -ENXIO; 616 return -ENXIO;
615 617