Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 143109
b: refs/heads/master
c: ddd538f
h: refs/heads/master
i:
  143107: ec8c246
v: v3
  • Loading branch information
Lai Jiangshan authored and Ingo Molnar committed Apr 10, 2009
1 parent 85f15fe commit 0076d71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d1e7e02f30be672c6f6ee40908be83877a0d49d1
refs/heads/master: ddd538f3e6a1a4bec2f6942f83a753263e6577b4
16 changes: 8 additions & 8 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3277,19 +3277,13 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp)

info->tr = &global_trace;
info->cpu = cpu;
info->spare = ring_buffer_alloc_read_page(info->tr->buffer);
info->spare = NULL;
/* Force reading ring buffer for first read */
info->read = (unsigned int)-1;
if (!info->spare)
goto out;

filp->private_data = info;

return nonseekable_open(inode, filp);

out:
kfree(info);
return -ENOMEM;
}

static ssize_t
Expand All @@ -3304,6 +3298,11 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
if (!count)
return 0;

if (!info->spare)
info->spare = ring_buffer_alloc_read_page(info->tr->buffer);
if (!info->spare)
return -ENOMEM;

/* Do we have previous read data to read? */
if (info->read < PAGE_SIZE)
goto read;
Expand Down Expand Up @@ -3342,7 +3341,8 @@ static int tracing_buffers_release(struct inode *inode, struct file *file)
{
struct ftrace_buffer_info *info = file->private_data;

ring_buffer_free_read_page(info->tr->buffer, info->spare);
if (info->spare)
ring_buffer_free_read_page(info->tr->buffer, info->spare);
kfree(info);

return 0;
Expand Down

0 comments on commit 0076d71

Please sign in to comment.