提交 d9d290d7 编写于 作者: D Dan Williams

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: 2522afb8 ("libnvdimm/region: Introduce an 'align' attribute")
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/164688416128.2879318.17890707310125575258.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
上级 2bec6d9a
...@@ -1025,6 +1025,9 @@ static unsigned long default_align(struct nd_region *nd_region) ...@@ -1025,6 +1025,9 @@ static unsigned long default_align(struct nd_region *nd_region)
} }
} }
if (nd_region->ndr_size < MEMREMAP_COMPAT_ALIGN_MAX)
align = PAGE_SIZE;
mappings = max_t(u16, 1, nd_region->ndr_mappings); mappings = max_t(u16, 1, nd_region->ndr_mappings);
div_u64_rem(align, mappings, &remainder); div_u64_rem(align, mappings, &remainder);
if (remainder) if (remainder)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册