diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-10-19 19:33:31 +0100 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-11-08 17:37:18 -0800 |
commit | 524984ff66ee4b63264dffe568c3547a20b4136c (patch) | |
tree | 3a49ec8c2ede1958bb6dbd4a426b68cfe7f25e0e /mm/swap_state.c | |
parent | dd8095b15a6034165bc48da1eb6d0acc73c1558a (diff) |
mm: convert find_get_incore_page() to filemap_get_incore_folio()
Return the containing folio instead of the precise page. One of the
callers wants the folio and the other can do the folio->page conversion
itself. Nets 442 bytes of text size reduction, 478 bytes removed and 36
bytes added.
Link: https://lkml.kernel.org/r/20221019183332.2802139-4-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/swap_state.c')
-rw-r--r-- | mm/swap_state.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/mm/swap_state.c b/mm/swap_state.c index 44e3530520e8..40fe6f23e105 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -373,16 +373,17 @@ struct folio *swap_cache_get_folio(swp_entry_t entry, } /** - * find_get_incore_page - Find and get a page from the page or swap caches. + * filemap_get_incore_folio - Find and get a folio from the page or swap caches. * @mapping: The address_space to search. * @index: The page cache index. * - * This differs from find_get_page() in that it will also look for the - * page in the swap cache. + * This differs from filemap_get_folio() in that it will also look for the + * folio in the swap cache. * - * Return: The found page or %NULL. + * Return: The found folio or %NULL. */ -struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index) +struct folio *filemap_get_incore_folio(struct address_space *mapping, + pgoff_t index) { swp_entry_t swp; struct swap_info_struct *si; @@ -405,9 +406,7 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index) folio = filemap_get_folio(swap_address_space(swp), index); put_swap_device(si); out: - if (!folio) - return NULL; - return folio_file_page(folio, index); + return folio; } struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, |