2 * Compatibility functions which bloat the callers too much to make inline.
3 * All of the callers of these functions should be converted to use folios
7 #include <linux/migrate.h>
8 #include <linux/pagemap.h>
9 #include <linux/swap.h>
11 struct address_space *page_mapping(struct page *page)
13 return folio_mapping(page_folio(page));
15 EXPORT_SYMBOL(page_mapping);
17 void unlock_page(struct page *page)
19 return folio_unlock(page_folio(page));
21 EXPORT_SYMBOL(unlock_page);
23 void end_page_writeback(struct page *page)
25 return folio_end_writeback(page_folio(page));
27 EXPORT_SYMBOL(end_page_writeback);
29 void wait_on_page_writeback(struct page *page)
31 return folio_wait_writeback(page_folio(page));
33 EXPORT_SYMBOL_GPL(wait_on_page_writeback);
35 void wait_for_stable_page(struct page *page)
37 return folio_wait_stable(page_folio(page));
39 EXPORT_SYMBOL_GPL(wait_for_stable_page);
41 bool page_mapped(struct page *page)
43 return folio_mapped(page_folio(page));
45 EXPORT_SYMBOL(page_mapped);
47 void mark_page_accessed(struct page *page)
49 folio_mark_accessed(page_folio(page));
51 EXPORT_SYMBOL(mark_page_accessed);
53 #ifdef CONFIG_MIGRATION
54 int migrate_page_move_mapping(struct address_space *mapping,
55 struct page *newpage, struct page *page, int extra_count)
57 return folio_migrate_mapping(mapping, page_folio(newpage),
58 page_folio(page), extra_count);
60 EXPORT_SYMBOL(migrate_page_move_mapping);
62 void migrate_page_states(struct page *newpage, struct page *page)
64 folio_migrate_flags(page_folio(newpage), page_folio(page));
66 EXPORT_SYMBOL(migrate_page_states);
68 void migrate_page_copy(struct page *newpage, struct page *page)
70 folio_migrate_copy(page_folio(newpage), page_folio(page));
72 EXPORT_SYMBOL(migrate_page_copy);
75 bool set_page_writeback(struct page *page)
77 return folio_start_writeback(page_folio(page));
79 EXPORT_SYMBOL(set_page_writeback);
81 bool set_page_dirty(struct page *page)
83 return folio_mark_dirty(page_folio(page));
85 EXPORT_SYMBOL(set_page_dirty);
87 int __set_page_dirty_nobuffers(struct page *page)
89 return filemap_dirty_folio(page_mapping(page), page_folio(page));
91 EXPORT_SYMBOL(__set_page_dirty_nobuffers);
93 bool clear_page_dirty_for_io(struct page *page)
95 return folio_clear_dirty_for_io(page_folio(page));
97 EXPORT_SYMBOL(clear_page_dirty_for_io);
99 bool redirty_page_for_writepage(struct writeback_control *wbc,
102 return folio_redirty_for_writepage(wbc, page_folio(page));
104 EXPORT_SYMBOL(redirty_page_for_writepage);
106 void lru_cache_add(struct page *page)
108 folio_add_lru(page_folio(page));
110 EXPORT_SYMBOL(lru_cache_add);
112 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
113 pgoff_t index, gfp_t gfp)
115 return filemap_add_folio(mapping, page_folio(page), index, gfp);
117 EXPORT_SYMBOL(add_to_page_cache_lru);
120 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
121 int fgp_flags, gfp_t gfp)
125 folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
126 if ((fgp_flags & FGP_HEAD) || !folio || xa_is_value(folio))
128 return folio_file_page(folio, index);
130 EXPORT_SYMBOL(pagecache_get_page);
132 struct page *grab_cache_page_write_begin(struct address_space *mapping,
133 pgoff_t index, unsigned flags)
135 unsigned fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE;
137 if (flags & AOP_FLAG_NOFS)
138 fgp_flags |= FGP_NOFS;
139 return pagecache_get_page(mapping, index, fgp_flags,
140 mapping_gfp_mask(mapping));
142 EXPORT_SYMBOL(grab_cache_page_write_begin);
144 void delete_from_page_cache(struct page *page)
146 return filemap_remove_folio(page_folio(page));
149 int try_to_release_page(struct page *page, gfp_t gfp)
151 return filemap_release_folio(page_folio(page), gfp);
153 EXPORT_SYMBOL(try_to_release_page);