On Tue 04-06-19 14:43:54, Aneesh Kumar K.V wrote:
> This is needed so that we don't wrongly initialize a namespace
> which doesn't have enough space reserved for holding struct pages
> with the current kernel.
> 
> We also increment PFN_MIN_VERSION to make sure that older kernel
> won't initialize namespace created with newer kernel.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.ku...@linux.ibm.com>
...
> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
> index 00c57805cad3..e01eee9efafe 100644
> --- a/drivers/nvdimm/pfn_devs.c
> +++ b/drivers/nvdimm/pfn_devs.c
> @@ -467,6 +467,15 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char 
> *sig)
>       if (__le16_to_cpu(pfn_sb->version_minor) < 2)
>               pfn_sb->align = 0;
>  
> +     if (__le16_to_cpu(pfn_sb->version_minor) < 3) {
> +             /*
> +              * For a large part we use PAGE_SIZE. But we
> +              * do have some accounting code using SZ_4K.
> +              */
> +             pfn_sb->page_struct_size = cpu_to_le16(64);
> +             pfn_sb->page_size = cpu_to_le32(SZ_4K);
> +     }
> +
>       switch (le32_to_cpu(pfn_sb->mode)) {
>       case PFN_MODE_RAM:
>       case PFN_MODE_PMEM:

As we discussed with Aneesh privately, this actually means that existing
NVDIMM namespaces on PPC64 will stop working due to these defaults for old
superblocks. I don't think that's a good thing as upgrading kernels is
going to be nightmare due to this on PPC64. So I believe we should make
defaults for old superblocks such that working setups keep working without
sysadmin having to touch anything.

                                                                Honza
-- 
Jan Kara <j...@suse.com>
SUSE Labs, CR

Reply via email to