From 03d1cdb06371a6d6e1adaacaa6c3f7d854b4b608 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Fri, 19 Jun 2020 22:34:48 -0400 Subject: [PATCH] LU-9859 libcfs: cleanup tracefile.h With many things moved into tracefile.c we can cleanup a lot of things in tracefile.h. Move some items that are only used in tracefile.c from tracefile.h into tracefile.c. In tracefile.h we have the ifdef LUSTRE_TRACEFILE_PRIVATE which has several duplicate defines. We can remove those duplicates. Test-Parameters: trivial Change-Id: Ic45c4fa6ebfb21e26c536b6ff5cda780a7ca85ac Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/39116 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin --- libcfs/libcfs/tracefile.c | 18 ++++++++++++++++-- libcfs/libcfs/tracefile.h | 34 ---------------------------------- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c index 2d0ec57..09b1c13 100644 --- a/libcfs/libcfs/tracefile.c +++ b/libcfs/libcfs/tracefile.c @@ -35,9 +35,7 @@ * Author: Phil Schwan */ - #define DEBUG_SUBSYSTEM S_LNET -#define LUSTRE_TRACEFILE_PRIVATE #include "tracefile.h" #include @@ -50,8 +48,16 @@ #include #include +#define CFS_TRACE_CONSOLE_BUFFER_SIZE 1024 #define TCD_MAX_TYPES 8 +enum cfs_trace_buf_type { + CFS_TCD_TYPE_PROC = 0, + CFS_TCD_TYPE_SOFTIRQ, + CFS_TCD_TYPE_IRQ, + CFS_TCD_TYPE_MAX +}; + 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]; @@ -122,6 +128,14 @@ enum cfs_trace_buf_type cfs_trace_buf_idx_get(void) return CFS_TCD_TYPE_PROC; } +static inline char *cfs_trace_get_console_buffer(void) +{ + unsigned int i = get_cpu(); + unsigned int j = cfs_trace_buf_idx_get(); + + return cfs_trace_console_buffers[i][j]; +} + static inline struct cfs_trace_cpu_data * cfs_trace_get_tcd(void) { diff --git a/libcfs/libcfs/tracefile.h b/libcfs/libcfs/tracefile.h index 2a7b47f..cd9a9fb 100644 --- a/libcfs/libcfs/tracefile.h +++ b/libcfs/libcfs/tracefile.h @@ -35,13 +35,6 @@ #include -enum cfs_trace_buf_type { - CFS_TCD_TYPE_PROC = 0, - CFS_TCD_TYPE_SOFTIRQ, - CFS_TCD_TYPE_IRQ, - CFS_TCD_TYPE_MAX -}; - #define TRACEFILE_NAME_SIZE 1024 extern char cfs_tracefile[TRACEFILE_NAME_SIZE]; extern long long cfs_tracefile_size; @@ -81,20 +74,6 @@ extern int libcfs_panic_in_progress; #define TCD_STOCK_PAGES (TCD_MAX_PAGES) #define CFS_TRACEFILE_SIZE (500 << 20) -#ifdef LUSTRE_TRACEFILE_PRIVATE - -/* - * Private declare for tracefile - */ -#define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT)) -#define TCD_STOCK_PAGES (TCD_MAX_PAGES) - -#define CFS_TRACEFILE_SIZE (500 << 20) - -/* Size of a buffer for sprinting console messages if we can't get a page - * from system */ -#define CFS_TRACE_CONSOLE_BUFFER_SIZE 1024 - union cfs_trace_data_union { struct cfs_trace_cpu_data { /* @@ -222,17 +201,6 @@ struct cfs_trace_page { unsigned short type; }; -extern char *cfs_trace_console_buffers[NR_CPUS][CFS_TCD_TYPE_MAX]; -extern enum cfs_trace_buf_type cfs_trace_buf_idx_get(void); - -static inline char *cfs_trace_get_console_buffer(void) -{ - unsigned int i = get_cpu(); - unsigned int j = cfs_trace_buf_idx_get(); - - return cfs_trace_console_buffers[i][j]; -} - int cfs_tcd_owns_tage(struct cfs_trace_cpu_data *tcd, struct cfs_trace_page *tage); @@ -257,6 +225,4 @@ do { \ __LASSERT(page_count(tage->page) > 0); \ } while (0) -#endif /* LUSTRE_TRACEFILE_PRIVATE */ - #endif /* __LIBCFS_TRACEFILE_H__ */ -- 1.8.3.1