aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ring_buffer.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2009-02-09 01:21:14 -0500
committerSteven Rostedt <srostedt@redhat.com>2009-02-10 09:17:19 -0500
commitb85fa01ed958ca59523a2db3c2ee647b98745d6a (patch)
tree8afcb14110ff875e53a98f0df2c2f427389c2bf0 /kernel/trace/ring_buffer.c
parent34cd4998d38f9bd04f34b78a7cb0c7f1bee00bd9 (diff)
ring_buffer: fix typing mistake
Impact: Fix bug I found several very very curious line. It's so curious that it may be brought by typing mistake. When (cpu_buffer->reader_page == cpu_buffer->commit_page): 1) We haven't copied it for bpage is changed: bpage = cpu_buffer->reader_page->page; memcpy(bpage->data, cpu_buffer->reader_page->page->data + read ... ) 2) We need update cpu_buffer->reader_page->read, but "cpu_buffer->reader_page += read;" is not right. [ This bug was a typo. The commit->reader_page is a page pointer and not an index into the page. The line should have been commit->reader_page->read += read. The other changes by Lai are nice clean ups to the code. - SDR ] Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r--kernel/trace/ring_buffer.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 53ba3a6d16d0..eca282720838 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2406,7 +2406,7 @@ void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data)
2406 * to swap with a page in the ring buffer. 2406 * to swap with a page in the ring buffer.
2407 * 2407 *
2408 * for example: 2408 * for example:
2409 * rpage = ring_buffer_alloc_page(buffer); 2409 * rpage = ring_buffer_alloc_read_page(buffer);
2410 * if (!rpage) 2410 * if (!rpage)
2411 * return error; 2411 * return error;
2412 * ret = ring_buffer_read_page(buffer, &rpage, cpu, 0); 2412 * ret = ring_buffer_read_page(buffer, &rpage, cpu, 0);
@@ -2461,18 +2461,17 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
2461 */ 2461 */
2462 if (cpu_buffer->reader_page == cpu_buffer->commit_page) { 2462 if (cpu_buffer->reader_page == cpu_buffer->commit_page) {
2463 unsigned int read = cpu_buffer->reader_page->read; 2463 unsigned int read = cpu_buffer->reader_page->read;
2464 unsigned int commit = rb_page_commit(cpu_buffer->reader_page);
2464 2465
2465 if (full) 2466 if (full)
2466 goto out; 2467 goto out;
2467 /* The writer is still on the reader page, we must copy */ 2468 /* The writer is still on the reader page, we must copy */
2468 bpage = cpu_buffer->reader_page->page;
2469 memcpy(bpage->data, 2469 memcpy(bpage->data,
2470 cpu_buffer->reader_page->page->data + read, 2470 cpu_buffer->reader_page->page->data + read,
2471 local_read(&bpage->commit) - read); 2471 commit - read);
2472 2472
2473 /* consume what was read */ 2473 /* consume what was read */
2474 cpu_buffer->reader_page += read; 2474 cpu_buffer->reader_page->read = commit;
2475
2476 } else { 2475 } else {
2477 /* swap the pages */ 2476 /* swap the pages */
2478 rb_init_page(bpage); 2477 rb_init_page(bpage);