[PATCH v2 6/6] mm, swap: remove no longer used swap mapping helper

Kairui Song posted 6 patches 9 months, 2 weeks ago
There is a newer version of this series
[PATCH v2 6/6] mm, swap: remove no longer used swap mapping helper
Posted by Kairui Song 9 months, 2 weeks ago
From: Kairui Song <kasong@tencent.com>

This helper existed to fix the circular header dependency issue
but it is no longer used since commit 0d40cfe63a2f ("fs: remove
folio_file_mapping()"), remove it.

Signed-off-by: Kairui Song <kasong@tencent.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/pagemap.h | 1 -
 mm/swapfile.c           | 9 ---------
 2 files changed, 10 deletions(-)

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 47b5746d5a65..a071cdc8f902 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -533,7 +533,6 @@ static inline void filemap_nr_thps_dec(struct address_space *mapping)
 }
 
 struct address_space *folio_mapping(struct folio *);
-struct address_space *swapcache_mapping(struct folio *);
 
 /**
  * folio_flush_mapping - Find the file mapping this folio belongs to.
diff --git a/mm/swapfile.c b/mm/swapfile.c
index bf6c98009909..1a36e1f4f198 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3653,15 +3653,6 @@ struct swap_info_struct *swp_swap_info(swp_entry_t entry)
 	return swap_type_to_swap_info(swp_type(entry));
 }
 
-/*
- * out-of-line methods to avoid include hell.
- */
-struct address_space *swapcache_mapping(struct folio *folio)
-{
-	return swp_swap_info(folio->swap)->swap_file->f_mapping;
-}
-EXPORT_SYMBOL_GPL(swapcache_mapping);
-
 /*
  * add_swap_count_continuation - called when a swap count is duplicated
  * beyond SWAP_MAP_MAX, it allocates a new page and links that to the entry's
-- 
2.49.0
Re: [PATCH v2 6/6] mm, swap: remove no longer used swap mapping helper
Posted by David Hildenbrand 9 months, 2 weeks ago
On 29.04.25 13:49, Kairui Song wrote:
> From: Kairui Song <kasong@tencent.com>
> 
> This helper existed to fix the circular header dependency issue
> but it is no longer used since commit 0d40cfe63a2f ("fs: remove
> folio_file_mapping()"), remove it.
> 
> Signed-off-by: Kairui Song <kasong@tencent.com>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>   include/linux/pagemap.h | 1 -
>   mm/swapfile.c           | 9 ---------
>   2 files changed, 10 deletions(-)
> 
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 47b5746d5a65..a071cdc8f902 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -533,7 +533,6 @@ static inline void filemap_nr_thps_dec(struct address_space *mapping)
>   }
>   
>   struct address_space *folio_mapping(struct folio *);
> -struct address_space *swapcache_mapping(struct folio *);
>   
>   /**
>    * folio_flush_mapping - Find the file mapping this folio belongs to.
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index bf6c98009909..1a36e1f4f198 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -3653,15 +3653,6 @@ struct swap_info_struct *swp_swap_info(swp_entry_t entry)
>   	return swap_type_to_swap_info(swp_type(entry));
>   }
>   
> -/*
> - * out-of-line methods to avoid include hell.
> - */
> -struct address_space *swapcache_mapping(struct folio *folio)
> -{
> -	return swp_swap_info(folio->swap)->swap_file->f_mapping;
> -}
> -EXPORT_SYMBOL_GPL(swapcache_mapping);
> -
>   /*
>    * add_swap_count_continuation - called when a swap count is duplicated
>    * beyond SWAP_MAP_MAX, it allocates a new page and links that to the entry's

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb