btrfs: Convert btree_migratepage to migrate_folio

Use a folio throughout this function.  migrate_page() will be converted
later.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarDavid Sterba <dsterba@suse.com>
parent 108ca835
...@@ -952,28 +952,28 @@ void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_ ...@@ -952,28 +952,28 @@ void btrfs_submit_metadata_bio(struct inode *inode, struct bio *bio, int mirror_
} }
#ifdef CONFIG_MIGRATION #ifdef CONFIG_MIGRATION
static int btree_migratepage(struct address_space *mapping, static int btree_migrate_folio(struct address_space *mapping,
struct page *newpage, struct page *page, struct folio *dst, struct folio *src, enum migrate_mode mode)
enum migrate_mode mode)
{ {
/* /*
* we can't safely write a btree page from here, * we can't safely write a btree page from here,
* we haven't done the locking hook * we haven't done the locking hook
*/ */
if (PageDirty(page)) if (folio_test_dirty(src))
return -EAGAIN; return -EAGAIN;
/* /*
* Buffers may be managed in a filesystem specific way. * Buffers may be managed in a filesystem specific way.
* We must have no buffers or drop them. * We must have no buffers or drop them.
*/ */
if (page_has_private(page) && if (folio_get_private(src) &&
!try_to_release_page(page, GFP_KERNEL)) !filemap_release_folio(src, GFP_KERNEL))
return -EAGAIN; return -EAGAIN;
return migrate_page(mapping, newpage, page, mode); return migrate_page(mapping, &dst->page, &src->page, mode);
} }
#else
#define btree_migrate_folio NULL
#endif #endif
static int btree_writepages(struct address_space *mapping, static int btree_writepages(struct address_space *mapping,
struct writeback_control *wbc) struct writeback_control *wbc)
{ {
...@@ -1073,10 +1073,8 @@ static const struct address_space_operations btree_aops = { ...@@ -1073,10 +1073,8 @@ static const struct address_space_operations btree_aops = {
.writepages = btree_writepages, .writepages = btree_writepages,
.release_folio = btree_release_folio, .release_folio = btree_release_folio,
.invalidate_folio = btree_invalidate_folio, .invalidate_folio = btree_invalidate_folio,
#ifdef CONFIG_MIGRATION .migrate_folio = btree_migrate_folio,
.migratepage = btree_migratepage, .dirty_folio = btree_dirty_folio,
#endif
.dirty_folio = btree_dirty_folio,
}; };
struct extent_buffer *btrfs_find_create_tree_block( struct extent_buffer *btrfs_find_create_tree_block(
......
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