Skip to content

Commit d9d290d

Browse files
committed
nvdimm/region: Fix default alignment for small regions
In preparation for removing BLK aperture support the NVDIMM unit tests discovered that the default alignment can be set higher than the capacity of the region. Fall back to PAGE_SIZE in that case. Given this has not been seen in the wild, elide notifying -stable. Fixes: 2522afb ("libnvdimm/region: Introduce an 'align' attribute") Reviewed-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/164688416128.2879318.17890707310125575258.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 2bec6d9 commit d9d290d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/nvdimm/region_devs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,9 @@ static unsigned long default_align(struct nd_region *nd_region)
10251025
}
10261026
}
10271027

1028+
if (nd_region->ndr_size < MEMREMAP_COMPAT_ALIGN_MAX)
1029+
align = PAGE_SIZE;
1030+
10281031
mappings = max_t(u16, 1, nd_region->ndr_mappings);
10291032
div_u64_rem(align, mappings, &remainder);
10301033
if (remainder)

0 commit comments

Comments
 (0)