Re: [PATCH 6/8] Direct Migration V2: Avoid writeback / page_migrate() method

Nikita Danilov
2005-11-09T11:01:37Z

Christoph Lameter writes:
> Migrate a page with buffers without requiring writeback
>
> This introduces a new address space operation migrate_page() that
> may be used by a filesystem to implement its own version of page migration.
>
> A version is provided that migrates buffers attached to pages. Some
> filesystems (ext2, ext3, xfs) are modified to utilize this feature.
>
> The swapper address space operation are modified so that a regular
> migrate_pages() will occur for anonymous pages without writeback
> (migrate_pages forces every anonymous page to have a swap entry).
>
> V1->V2:
> - Fix CONFIG_MIGRATION handling
>
> Signed-off-by: Mike Kravetz <kravetz@us.ibm.com>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> Index: linux-2.6.14-mm1/include/linux/fs.h
> ===================================================================
> --- linux-2.6.14-mm1.orig/include/linux/fs.h 2005-11-07 11:48:46.000000000 -0800
> +++ linux-2.6.14-mm1/include/linux/fs.h 2005-11-08 10:18:51.000000000 -0800
> @@ -332,6 +332,8 @@ struct address_space_operations {
> loff_t offset, unsigned long nr_segs);
> struct page* (*get_xip_page)(struct address_space *, sector_t,
> int);
> + /* migrate the contents of a page to the specified target */
> + int (*migrate_page) (struct page *, struct page *);
> };
>
> struct backing_dev_info;
> @@ -1679,6 +1681,12 @@ extern void simple_release_fs(struct vfs
>
> extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t);
>
> +#ifdef CONFIG_MIGRATION
> +extern int buffer_migrate_page(struct page *, struct page *);
> +#else
> +#define buffer_migrate_page(a,b) NULL
> +#endif

Depending on the CONFIG_MIGRATION, the type of buffer_migrate_page(a,b)
expansion is either int or void *, which doesn't look right.

Moreover below you have initializations

.migrate_page = buffer_migrate_page,

that wouldn't compile when CONFIG_MIGRATION is not defined (as macro
requires two arguments).

Nikita.