Commit dd8095b1 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

mm/swap: convert find_get_incore_page to use folios

Eliminates a use of FGP_HEAD and saves 35 bytes of text.

Link: https://lkml.kernel.org/r/20221019183332.2802139-3-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 9ee2c086
...@@ -386,17 +386,14 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index) ...@@ -386,17 +386,14 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index)
{ {
swp_entry_t swp; swp_entry_t swp;
struct swap_info_struct *si; struct swap_info_struct *si;
struct page *page = pagecache_get_page(mapping, index, struct folio *folio = __filemap_get_folio(mapping, index, FGP_ENTRY, 0);
FGP_ENTRY | FGP_HEAD, 0);
if (!page) if (!xa_is_value(folio))
return page; goto out;
if (!xa_is_value(page))
return find_subpage(page, index);
if (!shmem_mapping(mapping)) if (!shmem_mapping(mapping))
return NULL; return NULL;
swp = radix_to_swp_entry(page); swp = radix_to_swp_entry(folio);
/* There might be swapin error entries in shmem mapping. */ /* There might be swapin error entries in shmem mapping. */
if (non_swap_entry(swp)) if (non_swap_entry(swp))
return NULL; return NULL;
...@@ -404,9 +401,13 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index) ...@@ -404,9 +401,13 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index)
si = get_swap_device(swp); si = get_swap_device(swp);
if (!si) if (!si)
return NULL; return NULL;
page = find_get_page(swap_address_space(swp), swp_offset(swp)); index = swp_offset(swp);
folio = filemap_get_folio(swap_address_space(swp), index);
put_swap_device(si); put_swap_device(si);
return page; out:
if (!folio)
return NULL;
return folio_file_page(folio, index);
} }
struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment