mm/filemap: remove unused parameter and change to void type for replace_page_cache_page()

Since commit 74d609585d ("page cache: Add and replace pages using the
XArray") was merged, the replace_page_cache_page() can not fail and always
return 0, we can remove the redundant return value and void it.  Moreover
remove the unused gfp_mask.

Link: https://lkml.kernel.org/r/609c30e5274ba15d8b90c872fd0d8ac437a9b2bb.1610071401.git.baolin.wang@linux.alibaba.com
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Baolin Wang 2021-02-24 12:01:42 -08:00 committed by Linus Torvalds
parent 1d2cae8ea1
commit 1f7ef65774
3 changed files with 3 additions and 12 deletions

View File

@ -844,11 +844,7 @@ static int fuse_try_move_page(struct fuse_copy_state *cs, struct page **pagep)
if (WARN_ON(PageMlocked(oldpage))) if (WARN_ON(PageMlocked(oldpage)))
goto out_fallback_unlock; goto out_fallback_unlock;
err = replace_page_cache_page(oldpage, newpage, GFP_KERNEL); replace_page_cache_page(oldpage, newpage);
if (err) {
unlock_page(newpage);
goto out_put_old;
}
get_page(newpage); get_page(newpage);

View File

@ -757,7 +757,7 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
pgoff_t index, gfp_t gfp_mask); pgoff_t index, gfp_t gfp_mask);
extern void delete_from_page_cache(struct page *page); extern void delete_from_page_cache(struct page *page);
extern void __delete_from_page_cache(struct page *page, void *shadow); extern void __delete_from_page_cache(struct page *page, void *shadow);
int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask); void replace_page_cache_page(struct page *old, struct page *new);
void delete_from_page_cache_batch(struct address_space *mapping, void delete_from_page_cache_batch(struct address_space *mapping,
struct pagevec *pvec); struct pagevec *pvec);

View File

@ -777,7 +777,6 @@ EXPORT_SYMBOL(file_write_and_wait_range);
* replace_page_cache_page - replace a pagecache page with a new one * replace_page_cache_page - replace a pagecache page with a new one
* @old: page to be replaced * @old: page to be replaced
* @new: page to replace with * @new: page to replace with
* @gfp_mask: allocation mode
* *
* This function replaces a page in the pagecache with a new one. On * This function replaces a page in the pagecache with a new one. On
* success it acquires the pagecache reference for the new page and * success it acquires the pagecache reference for the new page and
@ -786,10 +785,8 @@ EXPORT_SYMBOL(file_write_and_wait_range);
* caller must do that. * caller must do that.
* *
* The remove + add is atomic. This function cannot fail. * The remove + add is atomic. This function cannot fail.
*
* Return: %0
*/ */
int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask) void replace_page_cache_page(struct page *old, struct page *new)
{ {
struct address_space *mapping = old->mapping; struct address_space *mapping = old->mapping;
void (*freepage)(struct page *) = mapping->a_ops->freepage; void (*freepage)(struct page *) = mapping->a_ops->freepage;
@ -824,8 +821,6 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
if (freepage) if (freepage)
freepage(old); freepage(old);
put_page(old); put_page(old);
return 0;
} }
EXPORT_SYMBOL_GPL(replace_page_cache_page); EXPORT_SYMBOL_GPL(replace_page_cache_page);