diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 31b58708..7a579e22 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -370,3 +370,11 @@ endif ifneq (,$(shell grep 'int __printf.*register_shrinker.struct shrinker .shrinker,' include/linux/shrinker.h)) ccflags-y += -DKC_SHRINKER_NAME endif + +# +# v5.18-rc5-246-gf132ab7d3ab0 +# +# mpage_readpage() is now replaced with mpage_read_folio. +ifneq (,$(shell grep 'int mpage_read_folio.struct folio .folio' include/linux/mpage.h)) +ccflags-y += -DKC_MPAGE_READ_FOLIO +endif diff --git a/kmod/src/data.c b/kmod/src/data.c index eac86c5c..6949fbea 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -680,8 +680,14 @@ int scoutfs_get_block_write(struct inode *inode, sector_t iblock, struct buffer_ * We can return errors from locking and checking offline extents. The * page is unlocked if we return an error. */ +#ifdef KC_MPAGE_READ_FOLIO +static int scoutfs_read_folio(struct file *file, struct folio *folio) +{ + struct page *page = &folio->page; +#else static int scoutfs_readpage(struct file *file, struct page *page) { +#endif struct inode *inode = file->f_inode; struct scoutfs_inode_info *si = SCOUTFS_I(inode); struct super_block *sb = inode->i_sb; @@ -728,7 +734,11 @@ static int scoutfs_readpage(struct file *file, struct page *page) return ret; } +#ifdef KC_MPAGE_READ_FOLIO + ret = mpage_read_folio(folio, scoutfs_get_block_read); +#else ret = mpage_readpage(page, scoutfs_get_block_read); +#endif scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ); scoutfs_per_task_del(&si->pt_data_lock, &pt_ent); @@ -1891,7 +1901,11 @@ int scoutfs_data_waiting(struct super_block *sb, u64 ino, u64 iblock, } const struct address_space_operations scoutfs_file_aops = { +#ifdef KC_MPAGE_READ_FOLIO + .read_folio = scoutfs_read_folio, +#else .readpage = scoutfs_readpage, +#endif #ifndef KC_FILE_AOPS_READAHEAD .readpages = scoutfs_readpages, #else