From 9e83e05ebc20356d9b2c429b95ee003fb460760c Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Wed, 10 Jun 2020 17:44:08 -0400 Subject: [PATCH] LU-9859 libcfs: move cfs_trace_data data to tracefile.c The macro cfs_tcd_for_each() is only used in tracefile.c so move it from the header tracefile.h along with related material in the header file. Test-Parameters: trivial Change-Id: I024dc0a4a1f5481cf3468c35e670096f29817c23 Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/38914 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- libcfs/libcfs/tracefile.c | 9 ++++++++- libcfs/libcfs/tracefile.h | 9 --------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c index 1a3a4e5..3f9ca12 100644 --- a/libcfs/libcfs/tracefile.c +++ b/libcfs/libcfs/tracefile.c @@ -50,7 +50,8 @@ #include #include -/* XXX move things up to the top, comment */ +#define TCD_MAX_TYPES 8 + union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned; char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX]; @@ -101,6 +102,12 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking) spin_unlock(&tcd->tcd_lock); } +#define cfs_tcd_for_each(tcd, i, j) \ + for (i = 0; cfs_trace_data[i]; i++) \ + for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \ + j < num_possible_cpus(); \ + j++, (tcd) = &(*cfs_trace_data[i])[j].tcd) + #define cfs_tcd_for_each_type_lock(tcd, i, cpu) \ for (i = 0; cfs_trace_data[i] && \ (tcd = &(*cfs_trace_data[i])[cpu].tcd) && \ diff --git a/libcfs/libcfs/tracefile.h b/libcfs/libcfs/tracefile.h index 3d838cf..924e163 100644 --- a/libcfs/libcfs/tracefile.h +++ b/libcfs/libcfs/tracefile.h @@ -174,15 +174,6 @@ union cfs_trace_data_union { char __pad[L1_CACHE_ALIGN(sizeof(struct cfs_trace_cpu_data))]; }; -#define TCD_MAX_TYPES 8 -extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS]; - -#define cfs_tcd_for_each(tcd, i, j) \ - for (i = 0; cfs_trace_data[i] != NULL; i++) \ - for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \ - j < num_possible_cpus(); \ - j++, (tcd) = &(*cfs_trace_data[i])[j].tcd) - /* XXX nikita: this declaration is internal to tracefile.c and should probably * be moved there */ struct page_collection { -- 1.8.3.1