Skip to content

Commit 46a4075

Browse files
authored
Linux 6.16: remove writepage and readahead_page
Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #17443
1 parent 48ce292 commit 46a4075

File tree

7 files changed

+93
-4
lines changed

7 files changed

+93
-4
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
dnl #
2+
dnl # Linux 6.16 removed readahead_page
3+
dnl #
4+
AC_DEFUN([ZFS_AC_KERNEL_SRC_PAGEMAP_READAHEAD_PAGE], [
5+
ZFS_LINUX_TEST_SRC([pagemap_has_readahead_page], [
6+
#include <linux/pagemap.h>
7+
], [
8+
struct page *p __attribute__ ((unused)) = NULL;
9+
struct readahead_control *ractl __attribute__ ((unused)) = NULL;
10+
p = readahead_page(ractl);
11+
])
12+
])
13+
14+
AC_DEFUN([ZFS_AC_KERNEL_PAGEMAP_READAHEAD_PAGE], [
15+
AC_MSG_CHECKING([whether readahead_page() exists])
16+
ZFS_LINUX_TEST_RESULT([pagemap_has_readahead_page], [
17+
AC_MSG_RESULT([yes])
18+
AC_DEFINE(HAVE_PAGEMAP_READAHEAD_PAGE, 1,
19+
[readahead_page() exists])
20+
],[
21+
AC_MSG_RESULT([no])
22+
])
23+
])
File renamed without changes.

config/kernel-vfs-writepage.m4

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
dnl #
2+
dnl # Linux 6.16 removes address_space_operations ->writepage
3+
dnl #
4+
AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_WRITEPAGE], [
5+
ZFS_LINUX_TEST_SRC([vfs_has_writepage], [
6+
#include <linux/fs.h>
7+
8+
static const struct address_space_operations
9+
aops __attribute__ ((unused)) = {
10+
.writepage = NULL,
11+
};
12+
],[])
13+
])
14+
15+
AC_DEFUN([ZFS_AC_KERNEL_VFS_WRITEPAGE], [
16+
AC_MSG_CHECKING([whether aops->writepage exists])
17+
ZFS_LINUX_TEST_RESULT([vfs_has_writepage], [
18+
AC_MSG_RESULT([yes])
19+
AC_DEFINE(HAVE_VFS_WRITEPAGE, 1,
20+
[address_space_operations->writepage exists])
21+
],[
22+
AC_MSG_RESULT([no])
23+
])
24+
])

config/kernel.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
8282
ZFS_AC_KERNEL_SRC_VFS_MIGRATEPAGE
8383
ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS
8484
ZFS_AC_KERNEL_SRC_VFS_READPAGES
85+
ZFS_AC_KERNEL_SRC_VFS_WRITEPAGE
8586
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
8687
ZFS_AC_KERNEL_SRC_VFS_IOV_ITER
8788
ZFS_AC_KERNEL_SRC_VFS_GENERIC_COPY_FILE_RANGE
@@ -111,6 +112,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
111112
ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG
112113
ZFS_AC_KERNEL_SRC_STRLCPY
113114
ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT
115+
ZFS_AC_KERNEL_SRC_PAGEMAP_READAHEAD_PAGE
114116
ZFS_AC_KERNEL_SRC_ADD_DISK
115117
ZFS_AC_KERNEL_SRC_KTHREAD
116118
ZFS_AC_KERNEL_SRC_ZERO_PAGE
@@ -197,6 +199,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
197199
ZFS_AC_KERNEL_VFS_MIGRATEPAGE
198200
ZFS_AC_KERNEL_VFS_FSYNC_2ARGS
199201
ZFS_AC_KERNEL_VFS_READPAGES
202+
ZFS_AC_KERNEL_VFS_WRITEPAGE
200203
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS
201204
ZFS_AC_KERNEL_VFS_IOV_ITER
202205
ZFS_AC_KERNEL_VFS_GENERIC_COPY_FILE_RANGE
@@ -226,6 +229,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
226229
ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG
227230
ZFS_AC_KERNEL_STRLCPY
228231
ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT
232+
ZFS_AC_KERNEL_PAGEMAP_READAHEAD_PAGE
229233
ZFS_AC_KERNEL_ADD_DISK
230234
ZFS_AC_KERNEL_KTHREAD
231235
ZFS_AC_KERNEL_ZERO_PAGE

include/os/linux/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ kernel_linux_HEADERS = \
88
%D%/kernel/linux/mm_compat.h \
99
%D%/kernel/linux/mod_compat.h \
1010
%D%/kernel/linux/page_compat.h \
11+
%D%/kernel/linux/pagemap_compat.h \
1112
%D%/kernel/linux/simd.h \
1213
%D%/kernel/linux/simd_aarch64.h \
1314
%D%/kernel/linux/simd_arm.h \
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// SPDX-License-Identifier: CDDL-1.0
2+
/*
3+
* CDDL HEADER START
4+
*
5+
* The contents of this file are subject to the terms of the
6+
* Common Development and Distribution License (the "License").
7+
* You may not use this file except in compliance with the License.
8+
*
9+
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10+
* or https://opensource.org/licenses/CDDL-1.0.
11+
* See the License for the specific language governing permissions
12+
* and limitations under the License.
13+
*
14+
* When distributing Covered Code, include this CDDL HEADER in each
15+
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16+
* If applicable, add the following below this CDDL HEADER, with the
17+
* fields enclosed by brackets "[]" replaced with your own identifying
18+
* information: Portions Copyright [yyyy] [name of copyright owner]
19+
*
20+
* CDDL HEADER END
21+
*/
22+
23+
/*
24+
* Copyright (c) 2025, Rob Norris <[email protected]>
25+
*/
26+
27+
#ifndef _ZFS_PAGEMAP_COMPAT_H
28+
#define _ZFS_PAGEMAP_COMPAT_H
29+
30+
#include <linux/pagemap.h>
31+
32+
#ifndef HAVE_PAGEMAP_READAHEAD_PAGE
33+
#define readahead_page(ractl) (&(__readahead_folio(ractl)->page))
34+
#endif
35+
36+
#endif

module/os/linux/zfs/zpl_file.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
#include <sys/zfs_vfsops.h>
3737
#include <sys/zfs_vnops.h>
3838
#include <sys/zfs_project.h>
39-
#if defined(HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS) || \
40-
defined(HAVE_VFS_FILEMAP_DIRTY_FOLIO)
41-
#include <linux/pagemap.h>
42-
#endif
39+
#include <linux/pagemap_compat.h>
4340
#include <linux/fadvise.h>
4441
#ifdef HAVE_VFS_FILEMAP_DIRTY_FOLIO
4542
#include <linux/writeback.h>
@@ -555,6 +552,7 @@ zpl_writepages(struct address_space *mapping, struct writeback_control *wbc)
555552
return (result);
556553
}
557554

555+
#ifdef HAVE_VFS_WRITEPAGE
558556
/*
559557
* Write out dirty pages to the ARC, this function is only required to
560558
* support mmap(2). Mapped pages may be dirtied by memory operations
@@ -571,6 +569,7 @@ zpl_writepage(struct page *pp, struct writeback_control *wbc)
571569

572570
return (zpl_putpage(pp, wbc, &for_sync));
573571
}
572+
#endif
574573

575574
/*
576575
* The flag combination which matches the behavior of zfs_space() is
@@ -1063,7 +1062,9 @@ const struct address_space_operations zpl_address_space_operations = {
10631062
#else
10641063
.readpage = zpl_readpage,
10651064
#endif
1065+
#ifdef HAVE_VFS_WRITEPAGE
10661066
.writepage = zpl_writepage,
1067+
#endif
10671068
.writepages = zpl_writepages,
10681069
.direct_IO = zpl_direct_IO,
10691070
#ifdef HAVE_VFS_SET_PAGE_DIRTY_NOBUFFERS

0 commit comments

Comments
 (0)