]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: remove page_swap_info()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 13 Dec 2023 21:58:40 +0000 (21:58 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 29 Dec 2023 19:58:32 +0000 (11:58 -0800)
It's more efficient to get the swap_info_struct by calling
swp_swap_info() directly.

Link: https://lkml.kernel.org/r/20231213215842.671461-12-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/swap.h
mm/swap.h
mm/swapfile.c

index 2d09e9b7ee700fe57e5b5444f2f8d90f1acd804f..4db00ddad26169060e1d42d5ca9b9723546ab81c 100644 (file)
@@ -487,8 +487,7 @@ extern sector_t swapdev_block(int, pgoff_t);
 extern int __swap_count(swp_entry_t entry);
 extern int swap_swapcount(struct swap_info_struct *si, swp_entry_t entry);
 extern int swp_swapcount(swp_entry_t entry);
-extern struct swap_info_struct *page_swap_info(struct page *);
-extern struct swap_info_struct *swp_swap_info(swp_entry_t entry);
+struct swap_info_struct *swp_swap_info(swp_entry_t entry);
 struct backing_dev_info;
 extern int init_swap_address_space(unsigned int type, unsigned long nr_pages);
 extern void exit_swap_address_space(unsigned int type);
index 859ae8f0fd2d4a296d1ee62107f17e5c3ab0a627..6bf25342589fcb8f4e7373df9a563b4eeed792ef 100644 (file)
--- a/mm/swap.h
+++ b/mm/swap.h
@@ -60,7 +60,7 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t flag,
 
 static inline unsigned int folio_swap_flags(struct folio *folio)
 {
-       return page_swap_info(&folio->page)->flags;
+       return swp_swap_info(folio->swap)->flags;
 }
 #else /* CONFIG_SWAP */
 struct swap_iocb;
index f3e23a3d26aec782f5ff4bacdb8d8276c5a74b66..2f877ca445137887aebc7c8782fb00776aba09f0 100644 (file)
@@ -3369,18 +3369,12 @@ struct swap_info_struct *swp_swap_info(swp_entry_t entry)
        return swap_type_to_swap_info(swp_type(entry));
 }
 
-struct swap_info_struct *page_swap_info(struct page *page)
-{
-       swp_entry_t entry = page_swap_entry(page);
-       return swp_swap_info(entry);
-}
-
 /*
  * out-of-line methods to avoid include hell.
  */
 struct address_space *swapcache_mapping(struct folio *folio)
 {
-       return page_swap_info(&folio->page)->swap_file->f_mapping;
+       return swp_swap_info(folio->swap)->swap_file->f_mapping;
 }
 EXPORT_SYMBOL_GPL(swapcache_mapping);