[RFC PATCH 28/76] fscache, cachefiles: Fix disabled histogram warnings

From: David Howells
Date: Fri Nov 20 2020 - 10:09:41 EST


Fix variable unused warnings due to disabled histogram stuff.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
---

fs/cachefiles/internal.h | 7 +++++--
fs/fscache/internal.h | 6 ++++--
2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h
index b89f76a03546..16d15291a629 100644
--- a/fs/cachefiles/internal.h
+++ b/fs/cachefiles/internal.h
@@ -143,11 +143,11 @@ extern int cachefiles_check_in_use(struct cachefiles_cache *cache,
/*
* proc.c
*/
-#ifdef CONFIG_CACHEFILES_HISTOGRAM
extern atomic_t cachefiles_lookup_histogram[HZ];
extern atomic_t cachefiles_mkdir_histogram[HZ];
extern atomic_t cachefiles_create_histogram[HZ];

+#ifdef CONFIG_CACHEFILES_HISTOGRAM
extern int __init cachefiles_proc_init(void);
extern void cachefiles_proc_cleanup(void);
static inline
@@ -162,7 +162,10 @@ void cachefiles_hist(atomic_t histogram[], unsigned long start_jif)
#else
#define cachefiles_proc_init() (0)
#define cachefiles_proc_cleanup() do {} while (0)
-#define cachefiles_hist(hist, start_jif) do {} while (0)
+static inline
+void cachefiles_hist(atomic_t histogram[], unsigned long start_jif)
+{
+}
#endif

/*
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h
index 6c2a6ebe4f02..2c1f4151c092 100644
--- a/fs/fscache/internal.h
+++ b/fs/fscache/internal.h
@@ -109,13 +109,13 @@ extern struct fscache_cookie fscache_fsdef_index;
/*
* histogram.c
*/
-#ifdef CONFIG_FSCACHE_HISTOGRAM
extern atomic_t fscache_obj_instantiate_histogram[HZ];
extern atomic_t fscache_objs_histogram[HZ];
extern atomic_t fscache_ops_histogram[HZ];
extern atomic_t fscache_retrieval_delay_histogram[HZ];
extern atomic_t fscache_retrieval_histogram[HZ];

+#ifdef CONFIG_FSCACHE_HISTOGRAM
static inline void fscache_hist(atomic_t histogram[], unsigned long start_jif)
{
unsigned long jif = jiffies - start_jif;
@@ -127,7 +127,9 @@ static inline void fscache_hist(atomic_t histogram[], unsigned long start_jif)
extern const struct seq_operations fscache_histogram_ops;

#else
-#define fscache_hist(hist, start_jif) do {} while (0)
+static inline void fscache_hist(atomic_t histogram[], unsigned long start_jif)
+{
+}
#endif

/*