diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index 346a8249..17be9619 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -194,3 +194,13 @@ endif ifneq (,$(shell grep 'extern struct timespec64 current_time' include/linux/fs.h)) ccflags-y += -DKC_CURRENT_TIME_INODE=1 endif + +# +# v4.9-12228-g530e9b76ae8f +# +# register_cpu_notifier and family were all removed and to be +# replaced with cpuhp_* API calls. +# +ifneq (,$(shell grep 'define register_hotcpu_notifier' include/linux/cpu.h)) +ccflags-y += -DKC_CPU_NOTIFIER +endif diff --git a/kmod/src/item.c b/kmod/src/item.c index 6d7bd376..673797ef 100644 --- a/kmod/src/item.c +++ b/kmod/src/item.c @@ -78,7 +78,9 @@ struct item_cache_info { struct super_block *sb; struct item_percpu_pages __percpu *pcpu_pages; KC_DEFINE_SHRINKER(shrinker); +#ifdef KC_CPU_NOTIFIER struct notifier_block notifier; +#endif /* often walked, but per-cpu refs are fast path */ rwlock_t rwlock; @@ -2605,6 +2607,7 @@ static unsigned long item_cache_scan_objects(struct shrinker *shrink, return freed; } +#ifdef KC_CPU_NOTIFIER static int item_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) { @@ -2619,6 +2622,7 @@ static int item_cpu_callback(struct notifier_block *nfb, return NOTIFY_OK; } +#endif int scoutfs_item_setup(struct super_block *sb) { @@ -2651,8 +2655,10 @@ int scoutfs_item_setup(struct super_block *sb) KC_INIT_SHRINKER_FUNCS(&cinf->shrinker, item_cache_count_objects, item_cache_scan_objects); KC_REGISTER_SHRINKER(&cinf->shrinker); +#ifdef KC_CPU_NOTIFIER cinf->notifier.notifier_call = item_cpu_callback; register_hotcpu_notifier(&cinf->notifier); +#endif sbi->item_cache_info = cinf; return 0; @@ -2672,7 +2678,9 @@ void scoutfs_item_destroy(struct super_block *sb) if (cinf) { BUG_ON(!list_empty(&cinf->active_list)); +#ifdef KC_CPU_NOTIFIER unregister_hotcpu_notifier(&cinf->notifier); +#endif KC_UNREGISTER_SHRINKER(&cinf->shrinker); for_each_possible_cpu(cpu)