@@ -242,11 +242,8 @@ void __delete_from_page_cache(struct page *page, void *shadow)
static void page_cache_free_page(struct address_space *mapping,
struct page *page)
{
- void (*freepage)(struct page *);
-
- freepage = mapping->a_ops->freepage;
- if (freepage)
- freepage(page);
+ if (mapping->a_ops->freepage)
+ mapping->a_ops->freepage(page);
if (PageTransHuge(page) && !PageHuge(page)) {
page_ref_sub(page, HPAGE_PMD_NR);
@@ -790,7 +787,6 @@ EXPORT_SYMBOL(file_write_and_wait_range);
int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
{
struct address_space *mapping = old->mapping;
- void (*freepage)(struct page *) = mapping->a_ops->freepage;
pgoff_t offset = old->index;
XA_STATE(xas, &mapping->i_pages, offset);
unsigned long flags;
@@ -819,8 +815,8 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
if (PageSwapBacked(new))
__inc_lruvec_page_state(new, NR_SHMEM);
xas_unlock_irqrestore(&xas, flags);
- if (freepage)
- freepage(old);
+ if (mapping->a_ops->freepage)
+ mapping->a_ops->freepage(old);
put_page(old);
return 0;
@@ -903,9 +903,6 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
xa_unlock_irqrestore(&mapping->i_pages, flags);
put_swap_page(page, swap);
} else {
- void (*freepage)(struct page *);
-
- freepage = mapping->a_ops->freepage;
/*
* Remember a shadow entry for reclaimed file cache in
* order to detect refaults, thus thrashing, later on.
@@ -928,8 +925,8 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
__delete_from_page_cache(page, shadow);
xa_unlock_irqrestore(&mapping->i_pages, flags);
- if (freepage != NULL)
- freepage(page);
+ if (mapping->a_ops->freepage != NULL)
+ mapping->a_ops->freepage(page);
}
return 1;