Re: [PATCH v2 1/1] ftrace: do not update max buffer with no users

From: Ingo Molnar
Date: Thu Nov 13 2008 - 08:20:26 EST



* Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> The line count is very misleading. The 83 insertions and deletions where
> moved code or indentation:

but that indentation is completely unnecessary:

> - ret = ring_buffer_resize(max_tr.buffer, val);
> - if (ret < 0) {
> - int r;
> - cnt = ret;
> - r = ring_buffer_resize(global_trace.buffer,
> - global_trace.entries);
> - if (r < 0) {
> - /* AARGH! We are left with different
> - * size max buffer!!!! */
> - WARN_ON(1);
> - tracing_disabled = 1;
> }
> - goto out;
> }
>
>
> + if (max_tr.buffer) {
> + ret = ring_buffer_resize(max_tr.buffer, val);
> + if (ret < 0) {
> + int r;
> + cnt = ret;
> + r = ring_buffer_resize(global_trace.buffer,
> + global_trace.entries);
> + if (r < 0) {
> + /* AARGH! We are left with different
> + * size max buffer!!!! */
> + WARN_ON(1);
> + tracing_disabled = 1;
> + }
> + goto out;
> }
> }

the obvious solution is to add this to ring_buffer_resize():

if (!buffer)
return size;

resizing a non-existent buffer should succeed. A two-liner patch. Not
160 lines of flux.

Really, you need to think _hard_ how to avoid invasive-looking changes
in late -rc's, because every extra line to review uses up precious
review resources.

Ingo
--
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/