From 2e803b6ba4b6e8ceea261f7e89eb40f19af977f9 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 5 May 2025 15:08:50 -0400 Subject: [PATCH] Hook up buffer_migrate_folio This works together with the dropped block_write_full_page(), allowing us to drop the _writepage() method as long as we implement _writepages(). Since v5.19-rc3-395-g67235182a41c. This used to be the .migratepage() method. Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 +++++++++ kmod/src/data.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 2dd1c573..7a587ff0 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -297,6 +297,15 @@ ifneq (,$(shell grep 'const struct attribute_group ..default_groups;' include/li ccflags-y += -DKC_KOBJECT_DEFAULT_GROUPS endif +# +# v5.19-rc3-395-g67235182a41c +# +# Adds buffer_migrate_folio(), similar to other fss. Quote willy: "If the filesystem +# implements migrate_folio and writepages, there is no need for a writepage implementation." +ifneq (,$(shell grep 'int buffer_migrate_folio.struct address_space' include/linux/buffer_head.h)) +ccflags-y += -DKC_HAVE_BUFFER_MIGRATE_FOLIO +endif + # # v6.15-13744-g41cb08555c41 # diff --git a/kmod/src/data.c b/kmod/src/data.c index daef52fb..9ba3dcb9 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -2239,6 +2239,9 @@ const struct address_space_operations scoutfs_file_aops = { .dirty_folio = block_dirty_folio, .invalidate_folio = block_invalidate_folio, .read_folio = scoutfs_read_folio, +#ifdef KC_HAVE_BUFFER_MIGRATE_FOLIO + .migrate_folio = buffer_migrate_folio, +#endif #else .readpage = scoutfs_readpage, #endif