12f52578fSMatthew Wilcox (Oracle) /* 22f52578fSMatthew Wilcox (Oracle) * Compatibility functions which bloat the callers too much to make inline. 32f52578fSMatthew Wilcox (Oracle) * All of the callers of these functions should be converted to use folios 42f52578fSMatthew Wilcox (Oracle) * eventually. 52f52578fSMatthew Wilcox (Oracle) */ 62f52578fSMatthew Wilcox (Oracle) 73417013eSMatthew Wilcox (Oracle) #include <linux/migrate.h> 82f52578fSMatthew Wilcox (Oracle) #include <linux/pagemap.h> 976580b65SMatthew Wilcox (Oracle) #include <linux/swap.h> 102f52578fSMatthew Wilcox (Oracle) 112f52578fSMatthew Wilcox (Oracle) struct address_space *page_mapping(struct page *page) 122f52578fSMatthew Wilcox (Oracle) { 132f52578fSMatthew Wilcox (Oracle) return folio_mapping(page_folio(page)); 142f52578fSMatthew Wilcox (Oracle) } 152f52578fSMatthew Wilcox (Oracle) EXPORT_SYMBOL(page_mapping); 164e136428SMatthew Wilcox (Oracle) 174e136428SMatthew Wilcox (Oracle) void unlock_page(struct page *page) 184e136428SMatthew Wilcox (Oracle) { 194e136428SMatthew Wilcox (Oracle) return folio_unlock(page_folio(page)); 204e136428SMatthew Wilcox (Oracle) } 214e136428SMatthew Wilcox (Oracle) EXPORT_SYMBOL(unlock_page); 224268b480SMatthew Wilcox (Oracle) 234268b480SMatthew Wilcox (Oracle) void end_page_writeback(struct page *page) 244268b480SMatthew Wilcox (Oracle) { 254268b480SMatthew Wilcox (Oracle) return folio_end_writeback(page_folio(page)); 264268b480SMatthew Wilcox (Oracle) } 274268b480SMatthew Wilcox (Oracle) EXPORT_SYMBOL(end_page_writeback); 28490e016fSMatthew Wilcox (Oracle) 29490e016fSMatthew Wilcox (Oracle) void wait_on_page_writeback(struct page *page) 30490e016fSMatthew Wilcox (Oracle) { 31490e016fSMatthew Wilcox (Oracle) return folio_wait_writeback(page_folio(page)); 32490e016fSMatthew Wilcox (Oracle) } 33490e016fSMatthew Wilcox (Oracle) EXPORT_SYMBOL_GPL(wait_on_page_writeback); 34a49d0c50SMatthew Wilcox (Oracle) 35a49d0c50SMatthew Wilcox (Oracle) void wait_for_stable_page(struct page *page) 36a49d0c50SMatthew Wilcox (Oracle) { 37a49d0c50SMatthew Wilcox (Oracle) return folio_wait_stable(page_folio(page)); 38a49d0c50SMatthew Wilcox (Oracle) } 39a49d0c50SMatthew Wilcox (Oracle) EXPORT_SYMBOL_GPL(wait_for_stable_page); 40dd10ab04SMatthew Wilcox (Oracle) 41dd10ab04SMatthew Wilcox (Oracle) bool page_mapped(struct page *page) 42dd10ab04SMatthew Wilcox (Oracle) { 43dd10ab04SMatthew Wilcox (Oracle) return folio_mapped(page_folio(page)); 44dd10ab04SMatthew Wilcox (Oracle) } 45dd10ab04SMatthew Wilcox (Oracle) EXPORT_SYMBOL(page_mapped); 4676580b65SMatthew Wilcox (Oracle) 4776580b65SMatthew Wilcox (Oracle) void mark_page_accessed(struct page *page) 4876580b65SMatthew Wilcox (Oracle) { 4976580b65SMatthew Wilcox (Oracle) folio_mark_accessed(page_folio(page)); 5076580b65SMatthew Wilcox (Oracle) } 5176580b65SMatthew Wilcox (Oracle) EXPORT_SYMBOL(mark_page_accessed); 523417013eSMatthew Wilcox (Oracle) 533417013eSMatthew Wilcox (Oracle) #ifdef CONFIG_MIGRATION 543417013eSMatthew Wilcox (Oracle) int migrate_page_move_mapping(struct address_space *mapping, 553417013eSMatthew Wilcox (Oracle) struct page *newpage, struct page *page, int extra_count) 563417013eSMatthew Wilcox (Oracle) { 573417013eSMatthew Wilcox (Oracle) return folio_migrate_mapping(mapping, page_folio(newpage), 583417013eSMatthew Wilcox (Oracle) page_folio(page), extra_count); 593417013eSMatthew Wilcox (Oracle) } 603417013eSMatthew Wilcox (Oracle) EXPORT_SYMBOL(migrate_page_move_mapping); 6119138349SMatthew Wilcox (Oracle) 6219138349SMatthew Wilcox (Oracle) void migrate_page_states(struct page *newpage, struct page *page) 6319138349SMatthew Wilcox (Oracle) { 6419138349SMatthew Wilcox (Oracle) folio_migrate_flags(page_folio(newpage), page_folio(page)); 6519138349SMatthew Wilcox (Oracle) } 6619138349SMatthew Wilcox (Oracle) EXPORT_SYMBOL(migrate_page_states); 67715cbfd6SMatthew Wilcox (Oracle) 68715cbfd6SMatthew Wilcox (Oracle) void migrate_page_copy(struct page *newpage, struct page *page) 69715cbfd6SMatthew Wilcox (Oracle) { 70715cbfd6SMatthew Wilcox (Oracle) folio_migrate_copy(page_folio(newpage), page_folio(page)); 71715cbfd6SMatthew Wilcox (Oracle) } 72715cbfd6SMatthew Wilcox (Oracle) EXPORT_SYMBOL(migrate_page_copy); 733417013eSMatthew Wilcox (Oracle) #endif 74f143f1eaSMatthew Wilcox (Oracle) 75f143f1eaSMatthew Wilcox (Oracle) bool set_page_writeback(struct page *page) 76f143f1eaSMatthew Wilcox (Oracle) { 77f143f1eaSMatthew Wilcox (Oracle) return folio_start_writeback(page_folio(page)); 78f143f1eaSMatthew Wilcox (Oracle) } 79f143f1eaSMatthew Wilcox (Oracle) EXPORT_SYMBOL(set_page_writeback); 80b5e84594SMatthew Wilcox (Oracle) 81b5e84594SMatthew Wilcox (Oracle) bool set_page_dirty(struct page *page) 82b5e84594SMatthew Wilcox (Oracle) { 83b5e84594SMatthew Wilcox (Oracle) return folio_mark_dirty(page_folio(page)); 84b5e84594SMatthew Wilcox (Oracle) } 85b5e84594SMatthew Wilcox (Oracle) EXPORT_SYMBOL(set_page_dirty); 8685d4d2ebSMatthew Wilcox (Oracle) 8785d4d2ebSMatthew Wilcox (Oracle) int __set_page_dirty_nobuffers(struct page *page) 8885d4d2ebSMatthew Wilcox (Oracle) { 8985d4d2ebSMatthew Wilcox (Oracle) return filemap_dirty_folio(page_mapping(page), page_folio(page)); 9085d4d2ebSMatthew Wilcox (Oracle) } 9185d4d2ebSMatthew Wilcox (Oracle) EXPORT_SYMBOL(__set_page_dirty_nobuffers); 929350f20aSMatthew Wilcox (Oracle) 939350f20aSMatthew Wilcox (Oracle) bool clear_page_dirty_for_io(struct page *page) 949350f20aSMatthew Wilcox (Oracle) { 959350f20aSMatthew Wilcox (Oracle) return folio_clear_dirty_for_io(page_folio(page)); 969350f20aSMatthew Wilcox (Oracle) } 979350f20aSMatthew Wilcox (Oracle) EXPORT_SYMBOL(clear_page_dirty_for_io); 98*cd78ab11SMatthew Wilcox (Oracle) 99*cd78ab11SMatthew Wilcox (Oracle) bool redirty_page_for_writepage(struct writeback_control *wbc, 100*cd78ab11SMatthew Wilcox (Oracle) struct page *page) 101*cd78ab11SMatthew Wilcox (Oracle) { 102*cd78ab11SMatthew Wilcox (Oracle) return folio_redirty_for_writepage(wbc, page_folio(page)); 103*cd78ab11SMatthew Wilcox (Oracle) } 104*cd78ab11SMatthew Wilcox (Oracle) EXPORT_SYMBOL(redirty_page_for_writepage); 105