Whamcloud - gitweb
LU-9859 libcfs: cleanup tracefile.h 16/39116/2
authorMr NeilBrown <neilb@suse.de>
Sat, 20 Jun 2020 02:34:48 +0000 (22:34 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 4 Jul 2020 03:04:39 +0000 (03:04 +0000)
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 <neilb@suse.de>
Reviewed-on: https://review.whamcloud.com/39116
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/tracefile.c
libcfs/libcfs/tracefile.h

index 2d0ec57..09b1c13 100644 (file)
@@ -35,9 +35,7 @@
  * Author: Phil Schwan <phil@clusterfs.com>
  */
 
-
 #define DEBUG_SUBSYSTEM S_LNET
-#define LUSTRE_TRACEFILE_PRIVATE
 #include "tracefile.h"
 
 #include <linux/ctype.h>
 #include <libcfs/linux/linux-fs.h>
 #include <libcfs/libcfs.h>
 
+#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)
 {
index 2a7b47f..cd9a9fb 100644 (file)
 
 #include <libcfs/libcfs.h>
 
-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__ */