1*ef24e0aaSTim Bird // SPDX-License-Identifier: GPL-2.0
22f52578fSMatthew Wilcox (Oracle) /*
32f52578fSMatthew Wilcox (Oracle) * Compatibility functions which bloat the callers too much to make inline.
42f52578fSMatthew Wilcox (Oracle) * All of the callers of these functions should be converted to use folios
52f52578fSMatthew Wilcox (Oracle) * eventually.
62f52578fSMatthew Wilcox (Oracle) */
72f52578fSMatthew Wilcox (Oracle)
83417013eSMatthew Wilcox (Oracle) #include <linux/migrate.h>
92f52578fSMatthew Wilcox (Oracle) #include <linux/pagemap.h>
104d510f3dSMatthew Wilcox (Oracle) #include <linux/rmap.h>
1176580b65SMatthew Wilcox (Oracle) #include <linux/swap.h>
12d1d8a3b4SMatthew Wilcox (Oracle) #include "internal.h"
132f52578fSMatthew Wilcox (Oracle)
unlock_page(struct page * page)144e136428SMatthew Wilcox (Oracle) void unlock_page(struct page *page)
154e136428SMatthew Wilcox (Oracle) {
164e136428SMatthew Wilcox (Oracle) return folio_unlock(page_folio(page));
174e136428SMatthew Wilcox (Oracle) }
184e136428SMatthew Wilcox (Oracle) EXPORT_SYMBOL(unlock_page);
194268b480SMatthew Wilcox (Oracle)
end_page_writeback(struct page * page)204268b480SMatthew Wilcox (Oracle) void end_page_writeback(struct page *page)
214268b480SMatthew Wilcox (Oracle) {
224268b480SMatthew Wilcox (Oracle) return folio_end_writeback(page_folio(page));
234268b480SMatthew Wilcox (Oracle) }
244268b480SMatthew Wilcox (Oracle) EXPORT_SYMBOL(end_page_writeback);
25490e016fSMatthew Wilcox (Oracle)
wait_on_page_writeback(struct page * page)26490e016fSMatthew Wilcox (Oracle) void wait_on_page_writeback(struct page *page)
27490e016fSMatthew Wilcox (Oracle) {
28490e016fSMatthew Wilcox (Oracle) return folio_wait_writeback(page_folio(page));
29490e016fSMatthew Wilcox (Oracle) }
30490e016fSMatthew Wilcox (Oracle) EXPORT_SYMBOL_GPL(wait_on_page_writeback);
31a49d0c50SMatthew Wilcox (Oracle)
mark_page_accessed(struct page * page)3276580b65SMatthew Wilcox (Oracle) void mark_page_accessed(struct page *page)
3376580b65SMatthew Wilcox (Oracle) {
3476580b65SMatthew Wilcox (Oracle) folio_mark_accessed(page_folio(page));
3576580b65SMatthew Wilcox (Oracle) }
3676580b65SMatthew Wilcox (Oracle) EXPORT_SYMBOL(mark_page_accessed);
373417013eSMatthew Wilcox (Oracle)
set_page_writeback(struct page * page)38b5612c36SMatthew Wilcox (Oracle) void set_page_writeback(struct page *page)
39f143f1eaSMatthew Wilcox (Oracle) {
40b5612c36SMatthew Wilcox (Oracle) folio_start_writeback(page_folio(page));
41f143f1eaSMatthew Wilcox (Oracle) }
42f143f1eaSMatthew Wilcox (Oracle) EXPORT_SYMBOL(set_page_writeback);
43b5e84594SMatthew Wilcox (Oracle)
set_page_dirty(struct page * page)44b5e84594SMatthew Wilcox (Oracle) bool set_page_dirty(struct page *page)
45b5e84594SMatthew Wilcox (Oracle) {
46b5e84594SMatthew Wilcox (Oracle) return folio_mark_dirty(page_folio(page));
47b5e84594SMatthew Wilcox (Oracle) }
48b5e84594SMatthew Wilcox (Oracle) EXPORT_SYMBOL(set_page_dirty);
4985d4d2ebSMatthew Wilcox (Oracle)
set_page_dirty_lock(struct page * page)507fce207aSJoanne Koong int set_page_dirty_lock(struct page *page)
517fce207aSJoanne Koong {
527fce207aSJoanne Koong return folio_mark_dirty_lock(page_folio(page));
537fce207aSJoanne Koong }
547fce207aSJoanne Koong EXPORT_SYMBOL(set_page_dirty_lock);
557fce207aSJoanne Koong
clear_page_dirty_for_io(struct page * page)569350f20aSMatthew Wilcox (Oracle) bool clear_page_dirty_for_io(struct page *page)
579350f20aSMatthew Wilcox (Oracle) {
589350f20aSMatthew Wilcox (Oracle) return folio_clear_dirty_for_io(page_folio(page));
599350f20aSMatthew Wilcox (Oracle) }
609350f20aSMatthew Wilcox (Oracle) EXPORT_SYMBOL(clear_page_dirty_for_io);
61cd78ab11SMatthew Wilcox (Oracle)
redirty_page_for_writepage(struct writeback_control * wbc,struct page * page)62cd78ab11SMatthew Wilcox (Oracle) bool redirty_page_for_writepage(struct writeback_control *wbc,
63cd78ab11SMatthew Wilcox (Oracle) struct page *page)
64cd78ab11SMatthew Wilcox (Oracle) {
65cd78ab11SMatthew Wilcox (Oracle) return folio_redirty_for_writepage(wbc, page_folio(page));
66cd78ab11SMatthew Wilcox (Oracle) }
67cd78ab11SMatthew Wilcox (Oracle) EXPORT_SYMBOL(redirty_page_for_writepage);
680d31125dSMatthew Wilcox (Oracle)
add_to_page_cache_lru(struct page * page,struct address_space * mapping,pgoff_t index,gfp_t gfp)699dd3d069SMatthew Wilcox (Oracle) int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
709dd3d069SMatthew Wilcox (Oracle) pgoff_t index, gfp_t gfp)
719dd3d069SMatthew Wilcox (Oracle) {
729dd3d069SMatthew Wilcox (Oracle) return filemap_add_folio(mapping, page_folio(page), index, gfp);
739dd3d069SMatthew Wilcox (Oracle) }
749dd3d069SMatthew Wilcox (Oracle) EXPORT_SYMBOL(add_to_page_cache_lru);
753f0c6a07SMatthew Wilcox (Oracle)
76b27652d9SMatthew Wilcox (Oracle) noinline
pagecache_get_page(struct address_space * mapping,pgoff_t index,fgf_t fgp_flags,gfp_t gfp)773f0c6a07SMatthew Wilcox (Oracle) struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
78ffc143dbSMatthew Wilcox (Oracle) fgf_t fgp_flags, gfp_t gfp)
793f0c6a07SMatthew Wilcox (Oracle) {
803f0c6a07SMatthew Wilcox (Oracle) struct folio *folio;
813f0c6a07SMatthew Wilcox (Oracle)
823f0c6a07SMatthew Wilcox (Oracle) folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
8366dabbb6SChristoph Hellwig if (IS_ERR(folio))
8448c9d113SChristoph Hellwig return NULL;
853f0c6a07SMatthew Wilcox (Oracle) return folio_file_page(folio, index);
863f0c6a07SMatthew Wilcox (Oracle) }
873f0c6a07SMatthew Wilcox (Oracle) EXPORT_SYMBOL(pagecache_get_page);
88