Messages in this thread | | | Subject | Re: [PATCH v3] trace: Add per_cpu ring buffer control files | From | Steven Rostedt <> | Date | Mon, 22 Aug 2011 20:49:00 -0400 |
| |
On Mon, 2011-08-22 at 15:09 -0700, Vaibhav Nagarnaik wrote: > > @@ -3740,10 +3757,6 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, > !cpumask_test_cpu(cpu, buffer_b->cpumask)) > goto out; > > - /* At least make sure the two buffers are somewhat the same */ > - if (buffer_a->pages != buffer_b->pages) > - goto out; > - > ret = -EAGAIN; > > if (ring_buffer_flags != RB_BUFFERS_ON) > @@ -3758,6 +3771,12 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, > cpu_buffer_a = buffer_a->buffers[cpu]; > cpu_buffer_b = buffer_b->buffers[cpu];
I would move the cpu_buffer_(ab) assignments up instead, as I want the EINVAL to have dominance. The record_disable just says that we are temporarily out of commission, when in fact it could be invalid. Thus the invalid conditions need to be treated first.
-- Steve
> > + ret = -EINVAL; > + /* At least make sure the two buffers are somewhat the same */ > + if (cpu_buffer_a->pages != cpu_buffer_b->pages) > + goto out; > + > + ret = -EAGAIN; > if (atomic_read(&cpu_buffer_a->record_disabled)) > goto out; >
| |