diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 3e129eed..fb802bf2 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -101,3 +101,12 @@ endif ifneq (,$(shell grep 'percpu_counter_add_batch' include/linux/percpu_counter.h)) ccflags-y += -DKC_PERCPU_COUNTER_ADD_BATCH endif + +# +# v4.11-4550-g7dea19f9ee63 +# +# Introduced memalloc_nofs_{save,restore} preferred instead of _noio_. +# +ifneq (,$(shell grep 'memalloc_nofs_save' include/linux/sched/mm.h)) +ccflags-y += -DKC_MEMALLOC_NOFS_SAVE +endif diff --git a/kmod/src/block.c b/kmod/src/block.c index 89cda9c0..14686f15 100644 --- a/kmod/src/block.c +++ b/kmod/src/block.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "format.h" #include "super.h" @@ -128,7 +129,7 @@ static __le32 block_calc_crc(struct scoutfs_block_header *hdr, u32 size) static struct block_private *block_alloc(struct super_block *sb, u64 blkno) { struct block_private *bp; - unsigned int noio_flags; + unsigned int nofs_flags; /* * If we had multiple blocks per page we'd need to be a little @@ -156,9 +157,9 @@ static struct block_private *block_alloc(struct super_block *sb, u64 blkno) * spurious reclaim-on dependencies and warnings. */ lockdep_off(); - noio_flags = memalloc_noio_save(); + nofs_flags = memalloc_nofs_save(); bp->virt = __vmalloc(SCOUTFS_BLOCK_LG_SIZE, GFP_NOFS | __GFP_HIGHMEM, PAGE_KERNEL); - memalloc_noio_restore(noio_flags); + memalloc_nofs_restore(nofs_flags); lockdep_on(); if (!bp->virt) { diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index b22b265f..4923730e 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -117,4 +117,9 @@ static inline int dir_emit_dots(struct file *file, void *dirent, #define percpu_counter_add_batch __percpu_counter_add #endif +#ifndef KC_MEMALLOC_NOFS_SAVE +#define memalloc_nofs_save memalloc_noio_save +#define memalloc_nofs_restore memalloc_noio_restore +#endif + #endif