Re: [PATCH v2] fs/dax: include <asm/page.h> to fix build error on ARC

From: Dan Williams
Date: Mon Jan 04 2021 - 15:13:51 EST


On Thu, Dec 31, 2020 at 8:29 PM Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
>
> fs/dax.c uses copy_user_page() but ARC does not provide that interface,
> resulting in a build error.
>
> Provide copy_user_page() in <asm/page.h> (beside copy_page()) and
> add <asm/page.h> to fs/dax.c to fix the build error.
>
> ../fs/dax.c: In function 'copy_cow_page_dax':
> ../fs/dax.c:702:2: error: implicit declaration of function 'copy_user_page'; did you mean 'copy_to_user_page'? [-Werror=implicit-function-declaration]
>
> Fixes: cccbce671582 ("filesystem-dax: convert to dax_direct_access()")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> Cc: Vineet Gupta <vgupta@xxxxxxxxxxxx>
> Cc: linux-snps-arc@xxxxxxxxxxxxxxxxxxx
> Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
> Acked-by: Vineet Gupta <vgupts@xxxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> Cc: Jan Kara <jack@xxxxxxx>
> Cc: linux-fsdevel@xxxxxxxxxxxxxxx
> Cc: linux-nvdimm@xxxxxxxxxxxx
> ---
> v2: rebase, add more Cc:
>
> arch/arc/include/asm/page.h | 1 +
> fs/dax.c | 1 +
> 2 files changed, 2 insertions(+)
>
> --- lnx-511-rc1.orig/fs/dax.c
> +++ lnx-511-rc1/fs/dax.c
> @@ -25,6 +25,7 @@
> #include <linux/sizes.h>
> #include <linux/mmu_notifier.h>
> #include <linux/iomap.h>
> +#include <asm/page.h>

I would expect this to come from one of the linux/ includes like
linux/mm.h. asm/ headers are implementation linux/ headers are api.

Once you drop that then the subject of this patch can just be "arc:
add a copy_user_page() implementation", and handled by the arc
maintainer (or I can take it with Vineet's ack).

> #include <asm/pgalloc.h>

Yes, this one should have a linux/ api header to front it, but that's
a cleanup for another day.

>
> #define CREATE_TRACE_POINTS
> --- lnx-511-rc1.orig/arch/arc/include/asm/page.h
> +++ lnx-511-rc1/arch/arc/include/asm/page.h
> @@ -10,6 +10,7 @@
> #ifndef __ASSEMBLY__
>
> #define clear_page(paddr) memset((paddr), 0, PAGE_SIZE)
> +#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
> #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
>
> struct vm_area_struct;