f2fs: Convert to filemap_migrate_folio()

filemap_migrate_folio() fits f2fs's needs perfectly.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: default avatarChao Yu <chao@kernel.org>
parent e7b15bae
...@@ -463,9 +463,7 @@ const struct address_space_operations f2fs_meta_aops = { ...@@ -463,9 +463,7 @@ const struct address_space_operations f2fs_meta_aops = {
.dirty_folio = f2fs_dirty_meta_folio, .dirty_folio = f2fs_dirty_meta_folio,
.invalidate_folio = f2fs_invalidate_folio, .invalidate_folio = f2fs_invalidate_folio,
.release_folio = f2fs_release_folio, .release_folio = f2fs_release_folio,
#ifdef CONFIG_MIGRATION .migrate_folio = filemap_migrate_folio,
.migratepage = f2fs_migrate_page,
#endif
}; };
static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino, static void __add_ino_entry(struct f2fs_sb_info *sbi, nid_t ino,
......
...@@ -3751,42 +3751,6 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block) ...@@ -3751,42 +3751,6 @@ static sector_t f2fs_bmap(struct address_space *mapping, sector_t block)
return blknr; return blknr;
} }
#ifdef CONFIG_MIGRATION
#include <linux/migrate.h>
int f2fs_migrate_page(struct address_space *mapping,
struct page *newpage, struct page *page, enum migrate_mode mode)
{
int rc, extra_count = 0;
BUG_ON(PageWriteback(page));
rc = migrate_page_move_mapping(mapping, newpage,
page, extra_count);
if (rc != MIGRATEPAGE_SUCCESS)
return rc;
/* guarantee to start from no stale private field */
set_page_private(newpage, 0);
if (PagePrivate(page)) {
set_page_private(newpage, page_private(page));
SetPagePrivate(newpage);
get_page(newpage);
set_page_private(page, 0);
ClearPagePrivate(page);
put_page(page);
}
if (mode != MIGRATE_SYNC_NO_COPY)
migrate_page_copy(newpage, page);
else
migrate_page_states(newpage, page);
return MIGRATEPAGE_SUCCESS;
}
#endif
#ifdef CONFIG_SWAP #ifdef CONFIG_SWAP
static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk, static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
unsigned int blkcnt) unsigned int blkcnt)
...@@ -4018,15 +3982,13 @@ const struct address_space_operations f2fs_dblock_aops = { ...@@ -4018,15 +3982,13 @@ const struct address_space_operations f2fs_dblock_aops = {
.write_begin = f2fs_write_begin, .write_begin = f2fs_write_begin,
.write_end = f2fs_write_end, .write_end = f2fs_write_end,
.dirty_folio = f2fs_dirty_data_folio, .dirty_folio = f2fs_dirty_data_folio,
.migrate_folio = filemap_migrate_folio,
.invalidate_folio = f2fs_invalidate_folio, .invalidate_folio = f2fs_invalidate_folio,
.release_folio = f2fs_release_folio, .release_folio = f2fs_release_folio,
.direct_IO = noop_direct_IO, .direct_IO = noop_direct_IO,
.bmap = f2fs_bmap, .bmap = f2fs_bmap,
.swap_activate = f2fs_swap_activate, .swap_activate = f2fs_swap_activate,
.swap_deactivate = f2fs_swap_deactivate, .swap_deactivate = f2fs_swap_deactivate,
#ifdef CONFIG_MIGRATION
.migratepage = f2fs_migrate_page,
#endif
}; };
void f2fs_clear_page_cache_dirty_tag(struct page *page) void f2fs_clear_page_cache_dirty_tag(struct page *page)
......
...@@ -3764,10 +3764,6 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, ...@@ -3764,10 +3764,6 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,
void f2fs_write_failed(struct inode *inode, loff_t to); void f2fs_write_failed(struct inode *inode, loff_t to);
void f2fs_invalidate_folio(struct folio *folio, size_t offset, size_t length); void f2fs_invalidate_folio(struct folio *folio, size_t offset, size_t length);
bool f2fs_release_folio(struct folio *folio, gfp_t wait); bool f2fs_release_folio(struct folio *folio, gfp_t wait);
#ifdef CONFIG_MIGRATION
int f2fs_migrate_page(struct address_space *mapping, struct page *newpage,
struct page *page, enum migrate_mode mode);
#endif
bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len); bool f2fs_overwrite_io(struct inode *inode, loff_t pos, size_t len);
void f2fs_clear_page_cache_dirty_tag(struct page *page); void f2fs_clear_page_cache_dirty_tag(struct page *page);
int f2fs_init_post_read_processing(void); int f2fs_init_post_read_processing(void);
......
...@@ -2165,9 +2165,7 @@ const struct address_space_operations f2fs_node_aops = { ...@@ -2165,9 +2165,7 @@ const struct address_space_operations f2fs_node_aops = {
.dirty_folio = f2fs_dirty_node_folio, .dirty_folio = f2fs_dirty_node_folio,
.invalidate_folio = f2fs_invalidate_folio, .invalidate_folio = f2fs_invalidate_folio,
.release_folio = f2fs_release_folio, .release_folio = f2fs_release_folio,
#ifdef CONFIG_MIGRATION .migrate_folio = filemap_migrate_folio,
.migratepage = f2fs_migrate_page,
#endif
}; };
static struct free_nid *__lookup_free_nid_list(struct f2fs_nm_info *nm_i, static struct free_nid *__lookup_free_nid_list(struct f2fs_nm_info *nm_i,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment