Skip to content

Commit ab9bb19

Browse files
authored
Linux 6.0 compat: Check for migratepage VFS (#17217)
The 6.0 kernel removes the 'migratepage' VFS op. Check for migratepage. Signed-off-by: Tony Hutter <[email protected]> Reviewed-by: Rob Norris <[email protected]> Reviewed-by: Alexander Motin <[email protected]
1 parent a497c5f commit ab9bb19

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

config/kernel-vfs-migratepage.m4

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
dnl #
2+
dnl # Linux 6.0 gets rid of address_space_operations.migratepage
3+
dnl #
4+
AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_MIGRATEPAGE], [
5+
ZFS_LINUX_TEST_SRC([vfs_has_migratepage], [
6+
#include <linux/fs.h>
7+
#include <linux/migrate.h>
8+
9+
static const struct address_space_operations
10+
aops __attribute__ ((unused)) = {
11+
.migratepage = migrate_page,
12+
};
13+
],[])
14+
])
15+
16+
AC_DEFUN([ZFS_AC_KERNEL_VFS_MIGRATEPAGE], [
17+
dnl #
18+
dnl # Linux 6.0 gets rid of address_space_operations.migratepage
19+
dnl #
20+
AC_MSG_CHECKING([whether migratepage exists])
21+
ZFS_LINUX_TEST_RESULT([vfs_has_migratepage], [
22+
AC_MSG_RESULT([yes])
23+
AC_DEFINE(HAVE_VFS_MIGRATEPAGE, 1, [migratepage exists])
24+
],[
25+
AC_MSG_RESULT([no])
26+
])
27+
])

config/kernel.m4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
7979
ZFS_AC_KERNEL_SRC_VFS_FILEMAP_DIRTY_FOLIO
8080
ZFS_AC_KERNEL_SRC_VFS_READ_FOLIO
8181
ZFS_AC_KERNEL_SRC_VFS_MIGRATE_FOLIO
82+
ZFS_AC_KERNEL_SRC_VFS_MIGRATEPAGE
8283
ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS
8384
ZFS_AC_KERNEL_SRC_VFS_READPAGES
8485
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
@@ -191,6 +192,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
191192
ZFS_AC_KERNEL_VFS_FILEMAP_DIRTY_FOLIO
192193
ZFS_AC_KERNEL_VFS_READ_FOLIO
193194
ZFS_AC_KERNEL_VFS_MIGRATE_FOLIO
195+
ZFS_AC_KERNEL_VFS_MIGRATEPAGE
194196
ZFS_AC_KERNEL_VFS_FSYNC_2ARGS
195197
ZFS_AC_KERNEL_VFS_READPAGES
196198
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS

module/os/linux/zfs/zpl_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ const struct address_space_operations zpl_address_space_operations = {
10581058
#endif
10591059
#ifdef HAVE_VFS_MIGRATE_FOLIO
10601060
.migrate_folio = migrate_folio,
1061-
#else
1061+
#elif defined(HAVE_VFS_MIGRATEPAGE)
10621062
.migratepage = migrate_page,
10631063
#endif
10641064
};

0 commit comments

Comments
 (0)