[PATCH] mm/nvdimm: Pick the right alignment default when creating dax devices
Dan Williams
dan.j.williams at intel.com
Mon May 20 02:30:47 AEST 2019
On Sun, May 19, 2019 at 1:55 AM Aneesh Kumar K.V
<aneesh.kumar at linux.ibm.com> wrote:
>
>
> Hi Dan,
>
> "Aneesh Kumar K.V" <aneesh.kumar at linux.ibm.com> writes:
>
> > On 5/17/19 8:19 PM, Vaibhav Jain wrote:
> >> Hi Aneesh,
> >>
>
> ....
>
> >>
> >>> + /*
> >>> + * Check whether the we support the alignment. For Dax if the
> >>> + * superblock alignment is not matching, we won't initialize
> >>> + * the device.
> >>> + */
> >>> + if (!nd_supported_alignment(align) &&
> >>> + memcmp(pfn_sb->signature, DAX_SIG, PFN_SIG_LEN)) {
> >> Suggestion to change this check to:
> >>
> >> if (memcmp(pfn_sb->signature, DAX_SIG, PFN_SIG_LEN) &&
> >> !nd_supported_alignment(align))
> >>
> >> It would look a bit more natural i.e. "If the device has dax signature and alignment is
> >> not supported".
> >>
> >
> > I guess that should be !memcmp()? . I will send an updated patch with
> > the hash failure details in the commit message.
> >
>
> We need clarification on what the expected failure behaviour should be.
> The nd_pmem_probe doesn't really have a failure behaviour in this
> regard. For example.
>
> I created a dax device with 16M alignment
>
> {
> "dev":"namespace0.0",
> "mode":"devdax",
> "map":"dev",
> "size":"9.98 GiB (10.72 GB)",
> "uuid":"ba62ef22-ebdf-4779-96f5-e6135383ed22",
> "raw_uuid":"7b2492f9-7160-4ee9-9c3d-2f547d9ef3ee",
> "daxregion":{
> "id":0,
> "size":"9.98 GiB (10.72 GB)",
> "align":16777216,
> "devices":[
> {
> "chardev":"dax0.0",
> "size":"9.98 GiB (10.72 GB)"
> }
> ]
> },
> "align":16777216,
> "numa_node":0,
> "supported_alignments":[
> 65536,
> 16777216
> ]
> }
>
> Now what we want is to fail the initialization of the device when we
> boot a kernel that doesn't support 16M page size. But with the
> nd_pmem_probe failure behaviour we now end up with
>
> [
> {
> "dev":"namespace0.0",
> "mode":"fsdax",
> "map":"mem",
> "size":10737418240,
> "uuid":"7b2492f9-7160-4ee9-9c3d-2f547d9ef3ee",
> "blockdev":"pmem0"
> }
> ]
>
> So it did fallthrough the
>
> /* if we find a valid info-block we'll come back as that personality */
> if (nd_btt_probe(dev, ndns) == 0 || nd_pfn_probe(dev, ndns) == 0
> || nd_dax_probe(dev, ndns) == 0)
> return -ENXIO;
>
> /* ...otherwise we're just a raw pmem device */
> return pmem_attach_disk(dev, ndns);
>
>
> Is it ok if i update the code such that we don't do that default
> pmem_atach_disk if we have a label area?
Yes. This seems a new case where the driver finds a valid info-block,
but the capability to load that configuration is missing. So perhaps
special case a EOPNOTSUPP return code from those info-block probe
routines as "fail, and don't fallback to a raw device".
More information about the Linuxppc-dev
mailing list