|
52 | 52 | #include "ubifs.h"
|
53 | 53 | #include <linux/mount.h>
|
54 | 54 | #include <linux/slab.h>
|
| 55 | +#include <linux/migrate.h> |
55 | 56 |
|
56 | 57 | static int read_block(struct inode *inode, void *addr, unsigned int block,
|
57 | 58 | struct ubifs_data_node *dn)
|
@@ -1452,6 +1453,26 @@ static int ubifs_set_page_dirty(struct page *page)
|
1452 | 1453 | return ret;
|
1453 | 1454 | }
|
1454 | 1455 |
|
| 1456 | +#ifdef CONFIG_MIGRATION |
| 1457 | +static int ubifs_migrate_page(struct address_space *mapping, |
| 1458 | + struct page *newpage, struct page *page, enum migrate_mode mode) |
| 1459 | +{ |
| 1460 | + int rc; |
| 1461 | + |
| 1462 | + rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0); |
| 1463 | + if (rc != MIGRATEPAGE_SUCCESS) |
| 1464 | + return rc; |
| 1465 | + |
| 1466 | + if (PagePrivate(page)) { |
| 1467 | + ClearPagePrivate(page); |
| 1468 | + SetPagePrivate(newpage); |
| 1469 | + } |
| 1470 | + |
| 1471 | + migrate_page_copy(newpage, page); |
| 1472 | + return MIGRATEPAGE_SUCCESS; |
| 1473 | +} |
| 1474 | +#endif |
| 1475 | + |
1455 | 1476 | static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)
|
1456 | 1477 | {
|
1457 | 1478 | /*
|
@@ -1591,6 +1612,9 @@ const struct address_space_operations ubifs_file_address_operations = {
|
1591 | 1612 | .write_end = ubifs_write_end,
|
1592 | 1613 | .invalidatepage = ubifs_invalidatepage,
|
1593 | 1614 | .set_page_dirty = ubifs_set_page_dirty,
|
| 1615 | +#ifdef CONFIG_MIGRATION |
| 1616 | + .migratepage = ubifs_migrate_page, |
| 1617 | +#endif |
1594 | 1618 | .releasepage = ubifs_releasepage,
|
1595 | 1619 | };
|
1596 | 1620 |
|
|
0 commit comments