mm/migrate: Convert fallback_migrate_page() to fallback_migrate_folio()

Use a folio throughout.  migrate_page() will be converted to
migrate_folio() later.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 5490da4f
...@@ -805,11 +805,11 @@ static int writeout(struct address_space *mapping, struct page *page) ...@@ -805,11 +805,11 @@ static int writeout(struct address_space *mapping, struct page *page)
/* /*
* Default handling if a filesystem does not provide a migration function. * Default handling if a filesystem does not provide a migration function.
*/ */
static int fallback_migrate_page(struct address_space *mapping, static int fallback_migrate_folio(struct address_space *mapping,
struct page *newpage, struct page *page, enum migrate_mode mode) struct folio *dst, struct folio *src, enum migrate_mode mode)
{ {
if (PageDirty(page)) { if (folio_test_dirty(src)) {
/* Only writeback pages in full synchronous migration */ /* Only writeback folios in full synchronous migration */
switch (mode) { switch (mode) {
case MIGRATE_SYNC: case MIGRATE_SYNC:
case MIGRATE_SYNC_NO_COPY: case MIGRATE_SYNC_NO_COPY:
...@@ -817,18 +817,18 @@ static int fallback_migrate_page(struct address_space *mapping, ...@@ -817,18 +817,18 @@ static int fallback_migrate_page(struct address_space *mapping,
default: default:
return -EBUSY; return -EBUSY;
} }
return writeout(mapping, page); return writeout(mapping, &src->page);
} }
/* /*
* 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_test_private(src) &&
!try_to_release_page(page, GFP_KERNEL)) !filemap_release_folio(src, GFP_KERNEL))
return mode == MIGRATE_SYNC ? -EAGAIN : -EBUSY; return mode == MIGRATE_SYNC ? -EAGAIN : -EBUSY;
return migrate_page(mapping, newpage, page, mode); return migrate_page(mapping, &dst->page, &src->page, mode);
} }
/* /*
...@@ -870,8 +870,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src, ...@@ -870,8 +870,7 @@ static int move_to_new_folio(struct folio *dst, struct folio *src,
rc = mapping->a_ops->migratepage(mapping, &dst->page, rc = mapping->a_ops->migratepage(mapping, &dst->page,
&src->page, mode); &src->page, mode);
else else
rc = fallback_migrate_page(mapping, &dst->page, rc = fallback_migrate_folio(mapping, dst, src, mode);
&src->page, mode);
} else { } else {
const struct movable_operations *mops; const struct movable_operations *mops;
......
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