1 #ifndef __LIBCFS_TRACEFILE_H__
2 #define __LIBCFS_TRACEFILE_H__
4 #include <libcfs/libcfs.h>
6 int tracefile_dump_all_pages(char *filename);
7 void trace_debug_print(void);
8 void trace_flush_pages(void);
9 int trace_start_thread(void);
10 void trace_stop_thread(void);
11 int tracefile_init(void);
12 void tracefile_exit(void);
13 int trace_write_daemon_file(struct file *file, const char *buffer,
14 unsigned long count, void *data);
15 int trace_read_daemon_file(char *page, char **start, off_t off, int count,
16 int *eof, void *data);
17 int trace_write_debug_mb(struct file *file, const char *buffer,
18 unsigned long count, void *data);
19 int trace_read_debug_mb(char *page, char **start, off_t off, int count,
20 int *eof, void *data);
21 int trace_dk(struct file *file, const char *buffer, unsigned long count,
24 #ifdef LUSTRE_TRACEFILE_PRIVATE
26 * Private declare for tracefile
28 #define TCD_MAX_PAGES (5 << (20 - PAGE_SHIFT))
30 #define TRACEFILE_SIZE (500 << 20)
32 union trace_data_union {
33 struct trace_cpu_data {
34 struct list_head tcd_pages;
35 unsigned long tcd_cur_pages;
37 struct list_head tcd_daemon_pages;
38 unsigned long tcd_cur_daemon_pages;
40 unsigned long tcd_max_pages;
41 int tcd_shutting_down;
43 char __pad[SMP_CACHE_BYTES];
46 struct page_collection {
47 struct list_head pc_pages;
49 int pc_want_daemon_pages;
52 struct tracefiled_ctl {
53 struct completion tctl_start;
54 struct completion tctl_stop;
55 cfs_waitq_t tctl_waitq;
57 atomic_t tctl_shutdown;
61 * small data-structure for each page owned by tracefiled.
69 * linkage into one of the lists in trace_data_union or
72 struct list_head linkage;
74 * number of bytes used within this page
78 * cpu that owns this page
83 extern void set_ptldebug_header(struct ptldebug_header *header,
84 int subsys, int mask, const int line,
86 extern void print_to_console(struct ptldebug_header *hdr, int mask,
87 char *buf, int len, char *file, const char *fn);
88 extern struct trace_cpu_data * __trace_get_tcd (unsigned long *flags);
89 extern void __trace_put_tcd (struct trace_cpu_data *tcd, unsigned long flags);
91 #define trace_get_tcd(f) __trace_get_tcd(&(f))
92 #define trace_put_tcd(t, f) __trace_put_tcd(t, f)
94 #endif /* LUSTRE_TRACEFILE_PRIVATE */
96 #endif /* __PORTALS_TRACEFILE_H */