summaryrefslogtreecommitdiff
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-09-02 20:46:14 +0100
committerAndrew Morton <akpm@linux-foundation.org>2022-10-03 14:02:47 -0700
commit0d698e257241436e01182508d93fc290987eb37d (patch)
tree679f9ffe862177045a706c2162fc041c1fe25b21 /mm/shmem.c
parent7a7256d5f512b6c17957df7f59cf5e281b3ddba3 (diff)
downloadlwn-0d698e257241436e01182508d93fc290987eb37d.tar.gz
lwn-0d698e257241436e01182508d93fc290987eb37d.zip
shmem: convert shmem_replace_page() to shmem_replace_folio()
The caller has a folio, so convert the calling convention and rename the function. Link: https://lkml.kernel.org/r/20220902194653.1739778-19-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/shmem.c')
-rw-r--r--mm/shmem.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index 8754e2b4800a..2bb6f5cfdc11 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1608,7 +1608,7 @@ static bool shmem_should_replace_folio(struct folio *folio, gfp_t gfp)
return folio_zonenum(folio) > gfp_zone(gfp);
}
-static int shmem_replace_page(struct page **pagep, gfp_t gfp,
+static int shmem_replace_folio(struct folio **foliop, gfp_t gfp,
struct shmem_inode_info *info, pgoff_t index)
{
struct folio *old, *new;
@@ -1617,7 +1617,7 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp,
pgoff_t swap_index;
int error;
- old = page_folio(*pagep);
+ old = *foliop;
entry = folio_swap_entry(old);
swap_index = swp_offset(entry);
swap_mapping = swap_address_space(entry);
@@ -1666,7 +1666,7 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp,
old = new;
} else {
folio_add_lru(new);
- *pagep = &new->page;
+ *foliop = new;
}
folio_clear_swapcache(old);
@@ -1772,8 +1772,7 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index,
arch_swap_restore(swap, folio);
if (shmem_should_replace_folio(folio, gfp)) {
- error = shmem_replace_page(&page, gfp, info, index);
- folio = page_folio(page);
+ error = shmem_replace_folio(&folio, gfp, info, index);
if (error)
goto failed;
}