lkml.org 
[lkml]   [2014]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 3/4] tracing: Improve message of empty set_ftrace_notrace file
On Fri, 13 Jun 2014 01:23:52 +0900
Namhyung Kim <namhyung@kernel.org> wrote:

> When there's no entry in set_ftrace_notrace, it'll print nothing, but
> it's better to print something like below like set_graph_notrace does:
>
> #### no functions disabled ####
>
> Reported-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
> kernel/trace/ftrace.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index b375cf2cd786..566ffa0f3442 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2603,6 +2603,16 @@ static void *t_start(struct seq_file *m, loff_t *pos)
> return iter;
> }
>
> + if (iter->flags & FTRACE_ITER_NOTRACE &&
> + ftrace_hash_empty(ops->notrace_hash)) {
> + if (*pos > 0)
> + return t_hash_start(m, pos);
> + iter->flags |= FTRACE_ITER_PRINTALL;
> + /* reset in case of seek/pread */
> + iter->flags &= ~FTRACE_ITER_HASH;
> + return iter;
> + }

This contains the exact if block as the condition before it. Why not
join the two:

if ((iter->flags & FTRACE_ITER_FILTER &&
ftrace_hash_empty(ops->filter_hash))
||
(iter->flags & FTRACE_ITER_NOTRACE &&
ftrace_hash_empty(ops->notrace_hash))) {

-- Steve

> +
> if (iter->flags & FTRACE_ITER_HASH)
> return t_hash_start(m, pos);
>
> @@ -2639,7 +2649,10 @@ static int t_show(struct seq_file *m, void *v)
> return t_hash_show(m, iter);
>
> if (iter->flags & FTRACE_ITER_PRINTALL) {
> - seq_printf(m, "#### all functions enabled ####\n");
> + if (iter->flags & FTRACE_ITER_NOTRACE)
> + seq_printf(m, "#### no functions disabled ####\n");
> + else
> + seq_printf(m, "#### all functions enabled ####\n");
> return 0;
> }
>



\
 
 \ /
  Last update: 2014-06-12 21:41    [W:0.047 / U:14.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site