Skip to content

Commit

Permalink
powerpc/spufs: sputrace: Don't block until the read buffer is full
Browse files Browse the repository at this point in the history
Currently, read() on the sputrace buffer will only return data when
the user buffer is exhausted. This may mean that we never see the
end of the event log, unless we read() with exactly the right-sized
buffer.

This change makes sputrace_read not block if we have data ready to
return.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
  • Loading branch information
Jeremy Kerr committed Oct 21, 2008
1 parent baf3992 commit e869446
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/powerpc/platforms/cell/spufs/sputrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ static ssize_t sputrace_read(struct file *file, char __user *buf,
char tbuf[128];
int width;

/* If we have data ready to return, don't block waiting
* for more */
if (cnt > 0 && sputrace_used() == 0)
break;

error = wait_event_interruptible(sputrace_wait,
sputrace_used() > 0);
if (error)
Expand Down

0 comments on commit e869446

Please sign in to comment.