Re: [PATCH 1/7] tracing: Introduce trace_create_cpu_file() andtracing_get_cpu()

From: Steven Rostedt
Date: Mon Jul 22 2013 - 11:23:44 EST


On Mon, 2013-07-22 at 15:43 +0200, Oleg Nesterov wrote:

Checkpatch nits...

> ---
> kernel/trace/trace.c | 46 ++++++++++++++++++++++++++++++++--------------
> 1 files changed, 32 insertions(+), 14 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 3f24777..1e0fae9 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -2843,6 +2843,13 @@ static int s_show(struct seq_file *m, void *v)
> return 0;
> }
>
> +static inline int tracing_get_cpu(struct inode *inode)
> +{
> + if (inode->i_cdev) /* See trace_create_cpu_file() */
> + return (long)inode->i_cdev - 1;
> + return RING_BUFFER_ALL_CPUS;
> +}
> +
> static const struct seq_operations tracer_seq_ops = {
> .start = s_start,
> .next = s_next,
> @@ -5529,6 +5536,17 @@ static struct dentry *tracing_dentry_percpu(struct trace_array *tr, int cpu)
> return tr->percpu_dir;
> }
>
> +static struct dentry *
> +trace_create_cpu_file(const char *name, umode_t mode, struct dentry *parent,
> + void *data, long cpu, const struct file_operations *fops)
> +{
> + struct dentry *ret = trace_create_file(name, mode, parent, data, fops);
> +
> + if (ret) /* See tracing_get_cpu() */
> + ret->d_inode->i_cdev = (void*)(cpu + 1);

(void *)(cpu + 1)
^
space needed


> + return ret;
> +}
> +
> static void
> tracing_init_debugfs_percpu(struct trace_array *tr, long cpu)
> {
> @@ -5548,28 +5566,28 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu)
> }
>
> /* per cpu trace_pipe */
> - trace_create_file("trace_pipe", 0444, d_cpu,
> - (void *)&data->trace_cpu, &tracing_pipe_fops);
> + trace_create_cpu_file("trace_pipe", 0444, d_cpu,
> + &data->trace_cpu, cpu, &tracing_pipe_fops);
>
> /* per cpu trace */
> - trace_create_file("trace", 0644, d_cpu,
> - (void *)&data->trace_cpu, &tracing_fops);
> + trace_create_cpu_file("trace", 0644, d_cpu,
> + &data->trace_cpu, cpu, &tracing_fops);
>
> - trace_create_file("trace_pipe_raw", 0444, d_cpu,
> - (void *)&data->trace_cpu, &tracing_buffers_fops);
> + trace_create_cpu_file("trace_pipe_raw", 0444, d_cpu,
> + &data->trace_cpu, cpu, &tracing_buffers_fops);
>
> - trace_create_file("stats", 0444, d_cpu,
> - (void *)&data->trace_cpu, &tracing_stats_fops);
> + trace_create_cpu_file("stats", 0444, d_cpu,
> + &data->trace_cpu, cpu, &tracing_stats_fops);
>
> - trace_create_file("buffer_size_kb", 0444, d_cpu,
> - (void *)&data->trace_cpu, &tracing_entries_fops);
> + trace_create_cpu_file("buffer_size_kb", 0444, d_cpu,
> + &data->trace_cpu, cpu, &tracing_entries_fops);
>
> #ifdef CONFIG_TRACER_SNAPSHOT
> - trace_create_file("snapshot", 0644, d_cpu,
> - (void *)&data->trace_cpu, &snapshot_fops);
> + trace_create_cpu_file("snapshot", 0644, d_cpu,
> + &data->trace_cpu, cpu, &snapshot_fops);

Whitespace damage above. There's spaces in between the tabs.

If no other changes are needed to this patchset (waiting on word from
Al), I'll fix this up. Otherwise, you might want to fix them if you need
to send a follow up patch set.

-- Steve


>
> - trace_create_file("snapshot_raw", 0444, d_cpu,
> - (void *)&data->trace_cpu, &snapshot_raw_fops);
> + trace_create_cpu_file("snapshot_raw", 0444, d_cpu,
> + &data->trace_cpu, cpu, &snapshot_raw_fops);
> #endif
> }
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/