diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 81d8581843..91f7e76be6 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -3589,13 +3589,23 @@ afs_linux_prepare_write(struct file *file, struct page *page, unsigned from, } #if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN) +# if defined(HAVE_LINUX_WRITE_BEGIN_END_FOLIO) static int afs_linux_write_end(struct file *file, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, - struct page *page, void *fsdata) + loff_t pos, unsigned len, unsigned copied, + struct folio *folio, void *fsdata) +# else +static int +afs_linux_write_end(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, unsigned copied, + struct page *page, void *fsdata) +# endif { int code; unsigned int from = pos & (PAGE_SIZE - 1); +# if defined(HAVE_LINUX_WRITE_BEGIN_END_FOLIO) + struct page *page = &folio->page; +# endif code = afs_linux_commit_write(file, page, from, from + copied); @@ -3604,7 +3614,12 @@ afs_linux_write_end(struct file *file, struct address_space *mapping, return code; } -# if defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS) +# if defined(HAVE_LINUX_WRITE_BEGIN_END_FOLIO) +static int +afs_linux_write_begin(struct file *file, struct address_space *mapping, + loff_t pos, unsigned len, + struct folio **foliop, void **fsdata) +# elif defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS) static int afs_linux_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, @@ -3630,7 +3645,11 @@ afs_linux_write_begin(struct file *file, struct address_space *mapping, return -ENOMEM; } +# if defined(HAVE_LINUX_WRITE_BEGIN_END_FOLIO) + *foliop = page_folio(page); +# else *pagep = page; +# endif code = afs_linux_prepare_write(file, page, from, from + len); if (code) { diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 index 539e304bb4..318e53917c 100644 --- a/src/cf/linux-kernel-func.m4 +++ b/src/cf/linux-kernel-func.m4 @@ -307,6 +307,18 @@ AC_CHECK_LINUX_FUNC([no_setpageerror], r = ClearPageError('x'); r = SetPageError('x');]]) +dnl Linux 6.12 changed the signatgure for the address_space_operations members +dnl write_begin and write_end to use a folio instead of a page. +AC_CHECK_LINUX_FUNC([write_begin_end_folio], + [[#include + static struct file *file; + static struct address_space *mapping; + static struct folio *foliop; + static void *fsdata; + static struct address_space_operations *aops;]], + [[aops->write_begin(file, mapping, 0, 0, &foliop, fsdata); + aops->write_end(file, mapping, 0, 0, 0, foliop, fsdata);]]) + dnl Consequences - things which get set as a result of the dnl above tests AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"],