Subject: Re: linux-next: manual merge of the nvdimm tree with the xfs tree

From: Stephen Rothwell <[email-masked]>
Date: Sat, 2 Jun 2018 11:33:12 +1000

Hi Darrick,

On Fri, 1 Jun 2018 17:59:48 -0700 "Darrick J. Wong" <[email-masked]> wrote:
>
> > + 	if (!dax_enabled) {
> >  -		pr_debug("VFS (%s): error: dax support not enabled\n",
> >  -				sb->s_id);
> >  +		pr_debug("%s: error: dax support not enabled\n",
> >  +				bdevname(bdev, buf));
> > - 		return false;
> > + 		return -EOPNOTSUPP;  
> 
> Hang on a sec, the changes in the xfs tree make this function return a
> boolean (true for dax-is-supported, false for dax-not-supported), but
> this change partially reverts the boolean return values.

OK, weird, that is what I though I had done.  Thanks for pointing it
out (I guess it was getting late :-().

> >   	}
> > - 
> > - 	return true;
> > + 	return 0;  
> 
> The merge should retain the 'return false' above and the 'return true'
> here... or possibly just return dax_enabled:
> 
> if (!dax_enabled) {
> 	pr_debug(...);
> 	pr_debug(...);
> }
> 
> return dax_enabled;

OK, I have fixed up my merge resolution.  The end of that function will
now look like this:

	if (IS_ENABLED(CONFIG_FS_DAX_LIMITED) && pfn_t_special(pfn)) {
		/*
		 * An arch that has enabled the pmem api should also
		 * have its drivers support pfn_t_devmap()
		 *
		 * This is a developer warning and should not trigger in
		 * production. dax_flush() will crash since it depends
		 * on being able to do (page_address(pfn_to_page())).
		 */
		WARN_ON(IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API));
		dax_enabled = true;
	} else if (pfn_t_devmap(pfn)) {
		struct dev_pagemap *pgmap;

		pgmap = get_dev_pagemap(pfn_t_to_pfn(pfn), NULL);
		if (pgmap && pgmap->type == MEMORY_DEVICE_FS_DAX)
			dax_enabled = true;
		put_dev_pagemap(pgmap);
	}

	if (!dax_enabled)
		pr_debug("%s: error: dax support not enabled\n",
				bdevname(bdev, buf));

	return dax_enabled;
}
EXPORT_SYMBOL_GPL(__bdev_dax_supported);

-- 
Cheers,
Stephen Rothwell