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

mm/swap: convert put_swap_page() to put_swap_folio()

With all callers now using a folio, we can convert this function.

Link: https://lkml.kernel.org/r/20220902194653.1739778-14-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent a4c366f0
......@@ -491,7 +491,7 @@ static inline long get_nr_swap_pages(void)
extern void si_swapinfo(struct sysinfo *);
swp_entry_t folio_alloc_swap(struct folio *folio);
bool folio_free_swap(struct folio *folio);
extern void put_swap_page(struct page *page, swp_entry_t entry);
void put_swap_folio(struct folio *folio, swp_entry_t entry);
extern swp_entry_t get_swap_page_of_type(int);
extern int get_swap_pages(int n, swp_entry_t swp_entries[], int entry_size);
extern int add_swap_count_continuation(swp_entry_t, gfp_t);
......@@ -576,7 +576,7 @@ static inline void swap_free(swp_entry_t swp)
{
}
static inline void put_swap_page(struct page *page, swp_entry_t swp)
static inline void put_swap_folio(struct folio *folio, swp_entry_t swp)
{
}
......
......@@ -1424,7 +1424,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc)
}
mutex_unlock(&shmem_swaplist_mutex);
put_swap_page(&folio->page, swap);
put_swap_folio(folio, swap);
redirty:
folio_mark_dirty(folio);
if (wbc->for_reclaim)
......
......@@ -343,7 +343,7 @@ swp_entry_t folio_alloc_swap(struct folio *folio)
get_swap_pages(1, &entry, 1);
out:
if (mem_cgroup_try_charge_swap(folio, entry)) {
put_swap_page(&folio->page, entry);
put_swap_folio(folio, entry);
entry.val = 0;
}
return entry;
......
......@@ -218,7 +218,7 @@ bool add_to_swap(struct folio *folio)
return true;
fail:
put_swap_page(&folio->page, entry);
put_swap_folio(folio, entry);
return false;
}
......@@ -237,7 +237,7 @@ void delete_from_swap_cache(struct folio *folio)
__delete_from_swap_cache(folio, entry, NULL);
xa_unlock_irq(&address_space->i_pages);
put_swap_page(&folio->page, entry);
put_swap_folio(folio, entry);
folio_ref_sub(folio, folio_nr_pages(folio));
}
......@@ -498,7 +498,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask,
return &folio->page;
fail_unlock:
put_swap_page(&folio->page, entry);
put_swap_folio(folio, entry);
folio_unlock(folio);
folio_put(folio);
return NULL;
......
......@@ -1332,7 +1332,7 @@ void swap_free(swp_entry_t entry)
/*
* Called after dropping swapcache to decrease refcnt to swap entries.
*/
void put_swap_page(struct page *page, swp_entry_t entry)
void put_swap_folio(struct folio *folio, swp_entry_t entry)
{
unsigned long offset = swp_offset(entry);
unsigned long idx = offset / SWAPFILE_CLUSTER;
......@@ -1341,7 +1341,7 @@ void put_swap_page(struct page *page, swp_entry_t entry)
unsigned char *map;
unsigned int i, free_entries = 0;
unsigned char val;
int size = swap_entry_size(thp_nr_pages(page));
int size = swap_entry_size(folio_nr_pages(folio));
si = _swap_info_get(entry);
if (!si)
......
......@@ -1352,7 +1352,7 @@ static int __remove_mapping(struct address_space *mapping, struct folio *folio,
mem_cgroup_swapout(folio, swap);
__delete_from_swap_cache(folio, swap, shadow);
xa_unlock_irq(&mapping->i_pages);
put_swap_page(&folio->page, swap);
put_swap_folio(folio, swap);
} else {
void (*free_folio)(struct folio *);
......
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