On Wed, Mar 30, 2022 at 11:16:10PM +0800, Shiyang Ruan wrote:
> > > +#if IS_ENABLED(CONFIG_MEMORY_FAILURE) && IS_ENABLED(CONFIG_FS_DAX)
> >
> > No real need for the IS_ENABLED. Also any reason to even build this
> > file if the options are not set? It seems like
> > xfs_dax_holder_operations should just be defined to NULL and the
> > whole file not supported if we can't support the functionality.
>
> Got it. These two CONFIG seem not related for now. So, I think I should
> wrap these code with #ifdef CONFIG_MEMORY_FAILURE here, and add
> `xfs-$(CONFIG_FS_DAX) += xfs_notify_failure.o` in the makefile.
I'd do
ifeq ($(CONFIG_MEMORY_FAILURE),y)
xfs-$(CONFIG_FS_DAX) += xfs_notify_failure.o
endif
in the makefile and keep it out of the actual source file entirely.
> > > +
> > > + /* Ignore the range out of filesystem area */
> > > + if ((offset + len) < ddev_start)
> >
> > No need for the inner braces.
> >
> > > + if ((offset + len) > ddev_end)
> >
> > No need for the braces either.
>
> Really no need? It is to make sure the range to be handled won't out of the
> filesystem area. And make sure the @offset and @len are valid and correct
> after subtract the bbdev_start.
Yes, but there is no need for the braces per the precedence rules in
C. So these could be:
if (offset + len < ddev_start)
and
if (offset + len > ddev_end)