aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-10 06:46:28 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-10 06:46:51 -0400
commit1cad1252ed279ea59f3f8d3d3a5817eeb2f7a4d3 (patch)
treeec5af7a70f58ad27ad21fc27815ca164ccf92c36 /kernel/trace/trace.c
parentdcef788eb9659b61a2110284fcce3ca6e63480d2 (diff)
parent93cfb3c9fd83d877a8f1ffad9ff862b617b32828 (diff)
Merge branch 'tracing/urgent' into tracing/core
Merge reason: pick up both v2.6.30-rc1 [which includes tracing/urgent fixes] and pick up the current lineup of tracing/urgent fixes as well Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 0615751a3ed7..4865459f609f 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3268,19 +3268,13 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp)
3268 3268
3269 info->tr = &global_trace; 3269 info->tr = &global_trace;
3270 info->cpu = cpu; 3270 info->cpu = cpu;
3271 info->spare = ring_buffer_alloc_read_page(info->tr->buffer); 3271 info->spare = NULL;
3272 /* Force reading ring buffer for first read */ 3272 /* Force reading ring buffer for first read */
3273 info->read = (unsigned int)-1; 3273 info->read = (unsigned int)-1;
3274 if (!info->spare)
3275 goto out;
3276 3274
3277 filp->private_data = info; 3275 filp->private_data = info;
3278 3276
3279 return 0; 3277 return nonseekable_open(inode, filp);
3280
3281 out:
3282 kfree(info);
3283 return -ENOMEM;
3284} 3278}
3285 3279
3286static ssize_t 3280static ssize_t
@@ -3295,6 +3289,11 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
3295 if (!count) 3289 if (!count)
3296 return 0; 3290 return 0;
3297 3291
3292 if (!info->spare)
3293 info->spare = ring_buffer_alloc_read_page(info->tr->buffer);
3294 if (!info->spare)
3295 return -ENOMEM;
3296
3298 /* Do we have previous read data to read? */ 3297 /* Do we have previous read data to read? */
3299 if (info->read < PAGE_SIZE) 3298 if (info->read < PAGE_SIZE)
3300 goto read; 3299 goto read;
@@ -3333,7 +3332,8 @@ static int tracing_buffers_release(struct inode *inode, struct file *file)
3333{ 3332{
3334 struct ftrace_buffer_info *info = file->private_data; 3333 struct ftrace_buffer_info *info = file->private_data;
3335 3334
3336 ring_buffer_free_read_page(info->tr->buffer, info->spare); 3335 if (info->spare)
3336 ring_buffer_free_read_page(info->tr->buffer, info->spare);
3337 kfree(info); 3337 kfree(info);
3338 3338
3339 return 0; 3339 return 0;
@@ -3419,14 +3419,19 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
3419 int size, i; 3419 int size, i;
3420 size_t ret; 3420 size_t ret;
3421 3421
3422 /* 3422 if (*ppos & (PAGE_SIZE - 1)) {
3423 * We can't seek on a buffer input 3423 WARN_ONCE(1, "Ftrace: previous read must page-align\n");
3424 */ 3424 return -EINVAL;
3425 if (unlikely(*ppos)) 3425 }
3426 return -ESPIPE;
3427 3426
3427 if (len & (PAGE_SIZE - 1)) {
3428 WARN_ONCE(1, "Ftrace: splice_read should page-align\n");
3429 if (len < PAGE_SIZE)
3430 return -EINVAL;
3431 len &= PAGE_MASK;
3432 }
3428 3433
3429 for (i = 0; i < PIPE_BUFFERS && len; i++, len -= size) { 3434 for (i = 0; i < PIPE_BUFFERS && len; i++, len -= PAGE_SIZE) {
3430 struct page *page; 3435 struct page *page;
3431 int r; 3436 int r;
3432 3437
@@ -3465,6 +3470,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos,
3465 spd.partial[i].offset = 0; 3470 spd.partial[i].offset = 0;
3466 spd.partial[i].private = (unsigned long)ref; 3471 spd.partial[i].private = (unsigned long)ref;
3467 spd.nr_pages++; 3472 spd.nr_pages++;
3473 *ppos += PAGE_SIZE;
3468 } 3474 }
3469 3475
3470 spd.nr_pages = i; 3476 spd.nr_pages = i;