Skip to content

Commit

Permalink
Merge branch 'for-2.6.40/splice' of git://git.kernel.dk/linux-2.6-block
Browse files Browse the repository at this point in the history
* 'for-2.6.40/splice' of git://git.kernel.dk/linux-2.6-block:
  splice: add wakeup_pipe_readers()
  • Loading branch information
Linus Torvalds committed May 25, 2011
2 parents 929cfdd + 825cdcb commit c88bc60
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = {
.get = generic_pipe_buf_get,
};

static void wakeup_pipe_readers(struct pipe_inode_info *pipe)
{
smp_mb();
if (waitqueue_active(&pipe->wait))
wake_up_interruptible(&pipe->wait);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}

/**
* splice_to_pipe - fill passed data into a pipe
* @pipe: pipe to fill
Expand Down Expand Up @@ -247,12 +255,8 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,

pipe_unlock(pipe);

if (do_wakeup) {
smp_mb();
if (waitqueue_active(&pipe->wait))
wake_up_interruptible(&pipe->wait);
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
}
if (do_wakeup)
wakeup_pipe_readers(pipe);

while (page_nr < spd_pages)
spd->spd_release(spd, page_nr++);
Expand Down Expand Up @@ -1892,12 +1896,9 @@ static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe,
/*
* If we put data in the output pipe, wakeup any potential readers.
*/
if (ret > 0) {
smp_mb();
if (waitqueue_active(&opipe->wait))
wake_up_interruptible(&opipe->wait);
kill_fasync(&opipe->fasync_readers, SIGIO, POLL_IN);
}
if (ret > 0)
wakeup_pipe_readers(opipe);

if (input_wakeup)
wakeup_pipe_writers(ipipe);

Expand Down Expand Up @@ -1976,12 +1977,8 @@ static int link_pipe(struct pipe_inode_info *ipipe,
/*
* If we put data in the output pipe, wakeup any potential readers.
*/
if (ret > 0) {
smp_mb();
if (waitqueue_active(&opipe->wait))
wake_up_interruptible(&opipe->wait);
kill_fasync(&opipe->fasync_readers, SIGIO, POLL_IN);
}
if (ret > 0)
wakeup_pipe_readers(opipe);

return ret;
}
Expand Down

0 comments on commit c88bc60

Please sign in to comment.