Re: [PATCH v2] mm: Move page_mapping_file to pagemap.h

From: Matthew Wilcox
Date: Tue Mar 30 2021 - 13:16:27 EST


On Tue, Mar 30, 2021 at 08:11:19PM +0300, Mike Rapoport wrote:
> On Wed, Mar 17, 2021 at 12:30:11PM +0000, Matthew Wilcox (Oracle) wrote:
> > page_mapping_file() is only used by some architectures, and then it
> > is usually only used in one place. Make it a static inline function
> > so other architectures don't have to carry this dead code.
>
> As the original commit that replaced page_mapping() with
> page_mapping_file() [cb9f753a3731 ("mm: fix races between swapoff and flush
> dcache")] missed arch/nds32 I think it'll make sense to add the below hunk
> to this patch:
>
> diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c
> index 6eb98a7ad27d..ad5344ef5d33 100644
> --- a/arch/nds32/mm/cacheflush.c
> +++ b/arch/nds32/mm/cacheflush.c
> @@ -238,7 +238,7 @@ void flush_dcache_page(struct page *page)
> {
> struct address_space *mapping;
>
> - mapping = page_mapping(page);
> + mapping = page_mapping_file(page);
> if (mapping && !mapping_mapped(mapping))
> set_bit(PG_dcache_dirty, &page->flags);
> else {

Good catch, but it's its own distinct problem, so I'd make it a separate
patch.