aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_stat.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-08-11 08:19:09 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-11 08:19:09 -0400
commit89034bc2c7b839702c00a704e79d112737f98be0 (patch)
treee65b1f3d4c751baa840efc81bc4734f089379eb3 /kernel/trace/trace_stat.c
parentfb82ad719831db58e9baa4c67015aae3fe27e7e3 (diff)
parent85dfd81dc57e8183a277ddd7a56aa65c96f3f487 (diff)
Merge branch 'linus' into tracing/core
Conflicts: kernel/trace/trace_events_filter.c We use the tracing/core version. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_stat.c')
-rw-r--r--kernel/trace/trace_stat.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
index f069461f10bd..07c60b09258f 100644
--- a/kernel/trace/trace_stat.c
+++ b/kernel/trace/trace_stat.c
@@ -76,7 +76,7 @@ static struct rb_node *release_next(struct tracer_stat *ts,
76 } 76 }
77} 77}
78 78
79static void reset_stat_session(struct stat_session *session) 79static void __reset_stat_session(struct stat_session *session)
80{ 80{
81 struct rb_node *node = session->stat_root.rb_node; 81 struct rb_node *node = session->stat_root.rb_node;
82 82
@@ -86,10 +86,17 @@ static void reset_stat_session(struct stat_session *session)
86 session->stat_root = RB_ROOT; 86 session->stat_root = RB_ROOT;
87} 87}
88 88
89static void reset_stat_session(struct stat_session *session)
90{
91 mutex_lock(&session->stat_mutex);
92 __reset_stat_session(session);
93 mutex_unlock(&session->stat_mutex);
94}
95
89static void destroy_session(struct stat_session *session) 96static void destroy_session(struct stat_session *session)
90{ 97{
91 debugfs_remove(session->file); 98 debugfs_remove(session->file);
92 reset_stat_session(session); 99 __reset_stat_session(session);
93 mutex_destroy(&session->stat_mutex); 100 mutex_destroy(&session->stat_mutex);
94 kfree(session); 101 kfree(session);
95} 102}
@@ -153,7 +160,7 @@ static int stat_seq_init(struct stat_session *session)
153 int i; 160 int i;
154 161
155 mutex_lock(&session->stat_mutex); 162 mutex_lock(&session->stat_mutex);
156 reset_stat_session(session); 163 __reset_stat_session(session);
157 164
158 if (!ts->stat_cmp) 165 if (!ts->stat_cmp)
159 ts->stat_cmp = dummy_cmp; 166 ts->stat_cmp = dummy_cmp;
@@ -186,7 +193,7 @@ exit:
186 return ret; 193 return ret;
187 194
188exit_free_rbtree: 195exit_free_rbtree:
189 reset_stat_session(session); 196 __reset_stat_session(session);
190 mutex_unlock(&session->stat_mutex); 197 mutex_unlock(&session->stat_mutex);
191 return ret; 198 return ret;
192} 199}
@@ -253,16 +260,21 @@ static const struct seq_operations trace_stat_seq_ops = {
253static int tracing_stat_open(struct inode *inode, struct file *file) 260static int tracing_stat_open(struct inode *inode, struct file *file)
254{ 261{
255 int ret; 262 int ret;
256 263 struct seq_file *m;
257 struct stat_session *session = inode->i_private; 264 struct stat_session *session = inode->i_private;
258 265
266 ret = stat_seq_init(session);
267 if (ret)
268 return ret;
269
259 ret = seq_open(file, &trace_stat_seq_ops); 270 ret = seq_open(file, &trace_stat_seq_ops);
260 if (!ret) { 271 if (ret) {
261 struct seq_file *m = file->private_data; 272 reset_stat_session(session);
262 m->private = session; 273 return ret;
263 ret = stat_seq_init(session);
264 } 274 }
265 275
276 m = file->private_data;
277 m->private = session;
266 return ret; 278 return ret;
267} 279}
268 280
@@ -273,11 +285,9 @@ static int tracing_stat_release(struct inode *i, struct file *f)
273{ 285{
274 struct stat_session *session = i->i_private; 286 struct stat_session *session = i->i_private;
275 287
276 mutex_lock(&session->stat_mutex);
277 reset_stat_session(session); 288 reset_stat_session(session);
278 mutex_unlock(&session->stat_mutex);
279 289
280 return 0; 290 return seq_release(i, f);
281} 291}
282 292
283static const struct file_operations tracing_stat_fops = { 293static const struct file_operations tracing_stat_fops = {