From 79d68b7978090eb24bb75ed885dbb63ede88fcc3 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 6efcb1a6..ad08fcf7 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -580,6 +580,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 3674e80d..03125b69 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -2310,6 +2310,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