From 70a5b6ffe2895427954fcca08cb04fb153e89044 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Thu, 21 Jul 2022 11:23:02 -0700 Subject: [PATCH] Use percpu_counter_add_batch __percpu_counter_add_batch was renamed to make it clear that the __ doesn't mean it's less safe, as it means in other calls in the API, but just that it takes an additional parameter. Signed-off-by: Zach Brown Signed-off-by: Auke Kok --- kmod/src/Makefile.kernelcompat | 9 +++++++++ kmod/src/counters.h | 8 ++++---- kmod/src/kernelcompat.h | 4 ++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/kmod/src/Makefile.kernelcompat b/kmod/src/Makefile.kernelcompat index fde9b31a..3e129eed 100644 --- a/kmod/src/Makefile.kernelcompat +++ b/kmod/src/Makefile.kernelcompat @@ -92,3 +92,12 @@ endif ifneq (,$(shell grep -s 'define _LINUX_IVERSION_H' include/linux/iversion.h)) ccflags-y += -DKC_NEED_LINUX_IVERSION_H=1 endif + +# v4.11-12447-g104b4e5139fe +# +# Renamed __percpu_counter_add to percpu_counter_add_batch to clarify +# that the __ wasn't less safe, just took an extra parameter. +# +ifneq (,$(shell grep 'percpu_counter_add_batch' include/linux/percpu_counter.h)) +ccflags-y += -DKC_PERCPU_COUNTER_ADD_BATCH +endif diff --git a/kmod/src/counters.h b/kmod/src/counters.h index e681e07a..ccfa1f6f 100644 --- a/kmod/src/counters.h +++ b/kmod/src/counters.h @@ -232,12 +232,12 @@ struct scoutfs_counters { #define SCOUTFS_PCPU_COUNTER_BATCH (1 << 30) #define scoutfs_inc_counter(sb, which) \ - __percpu_counter_add(&SCOUTFS_SB(sb)->counters->which, 1, \ - SCOUTFS_PCPU_COUNTER_BATCH) + percpu_counter_add_batch(&SCOUTFS_SB(sb)->counters->which, 1, \ + SCOUTFS_PCPU_COUNTER_BATCH) #define scoutfs_add_counter(sb, which, cnt) \ - __percpu_counter_add(&SCOUTFS_SB(sb)->counters->which, cnt, \ - SCOUTFS_PCPU_COUNTER_BATCH) + percpu_counter_add_batch(&SCOUTFS_SB(sb)->counters->which, cnt, \ + SCOUTFS_PCPU_COUNTER_BATCH) void __init scoutfs_init_counters(void); int scoutfs_setup_counters(struct super_block *sb); diff --git a/kmod/src/kernelcompat.h b/kmod/src/kernelcompat.h index 7c831648..b22b265f 100644 --- a/kmod/src/kernelcompat.h +++ b/kmod/src/kernelcompat.h @@ -113,4 +113,8 @@ static inline int dir_emit_dots(struct file *file, void *dirent, #define __posix_acl_chmod posix_acl_chmod #endif +#ifndef KC_PERCPU_COUNTER_ADD_BATCH +#define percpu_counter_add_batch __percpu_counter_add +#endif + #endif