Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / mm / folio-compat.c
blob1d1832e2a599d8601965ac516c61e7bc6f305edc
1 /*
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
4 * eventually.
5 */
7 #include <linux/migrate.h>
8 #include <linux/pagemap.h>
9 #include <linux/rmap.h>
10 #include <linux/swap.h>
11 #include "internal.h"
13 void unlock_page(struct page *page)
15 return folio_unlock(page_folio(page));
17 EXPORT_SYMBOL(unlock_page);
19 void end_page_writeback(struct page *page)
21 return folio_end_writeback(page_folio(page));
23 EXPORT_SYMBOL(end_page_writeback);
25 void wait_on_page_writeback(struct page *page)
27 return folio_wait_writeback(page_folio(page));
29 EXPORT_SYMBOL_GPL(wait_on_page_writeback);
31 void wait_for_stable_page(struct page *page)
33 return folio_wait_stable(page_folio(page));
35 EXPORT_SYMBOL_GPL(wait_for_stable_page);
37 void mark_page_accessed(struct page *page)
39 folio_mark_accessed(page_folio(page));
41 EXPORT_SYMBOL(mark_page_accessed);
43 void set_page_writeback(struct page *page)
45 folio_start_writeback(page_folio(page));
47 EXPORT_SYMBOL(set_page_writeback);
49 bool set_page_dirty(struct page *page)
51 return folio_mark_dirty(page_folio(page));
53 EXPORT_SYMBOL(set_page_dirty);
55 int set_page_dirty_lock(struct page *page)
57 return folio_mark_dirty_lock(page_folio(page));
59 EXPORT_SYMBOL(set_page_dirty_lock);
61 bool clear_page_dirty_for_io(struct page *page)
63 return folio_clear_dirty_for_io(page_folio(page));
65 EXPORT_SYMBOL(clear_page_dirty_for_io);
67 bool redirty_page_for_writepage(struct writeback_control *wbc,
68 struct page *page)
70 return folio_redirty_for_writepage(wbc, page_folio(page));
72 EXPORT_SYMBOL(redirty_page_for_writepage);
74 int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
75 pgoff_t index, gfp_t gfp)
77 return filemap_add_folio(mapping, page_folio(page), index, gfp);
79 EXPORT_SYMBOL(add_to_page_cache_lru);
81 noinline
82 struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
83 fgf_t fgp_flags, gfp_t gfp)
85 struct folio *folio;
87 folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
88 if (IS_ERR(folio))
89 return NULL;
90 return folio_file_page(folio, index);
92 EXPORT_SYMBOL(pagecache_get_page);
94 struct page *grab_cache_page_write_begin(struct address_space *mapping,
95 pgoff_t index)
97 return pagecache_get_page(mapping, index, FGP_WRITEBEGIN,
98 mapping_gfp_mask(mapping));
100 EXPORT_SYMBOL(grab_cache_page_write_begin);