With the new kernel updates to enforce wider alignment constraints by default ndctl has the ability to validate alignments problems before the kernel fails the namespace instantiation. Teach create-namespace to check the size argument against the region alignment rather than waiting for the kernel to fail the operation:
Before: # ndctl create-namespace -m fsdax -s 1073750016 -a 4k failed to create namespace: Invalid argument After: # ndctl create-namespace -m fsdax -s 1073750016 -a 4k Error: create namespace: region2: align setting is 0x1000000 size 0x40002000 is misaligned Cc: Aneesh Kumar K.V <[email protected]> Cc: Jeff Moyer <[email protected]> Signed-off-by: Dan Williams <[email protected]> --- ndctl/namespace.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ndctl/namespace.c b/ndctl/namespace.c index b967e9be578f..c4aab94abcd4 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -652,6 +652,14 @@ static int validate_namespace_options(struct ndctl_region *region, } } + region_align = ndctl_region_get_align(region); + if (region_align < ULONG_MAX && p->size % region_align) { + err("%s: align setting is %#lx size %#llx is misaligned\n", + ndctl_region_get_devname(region), region_align, + p->size); + return -EINVAL; + } + size_align = p->align; /* (re-)validate that the size satisfies the alignment */ _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]
