diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 09:20:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 09:20:20 -0700 |
commit | c88bc60a3bd3c63da3960076f13a4606c76bf013 (patch) | |
tree | fcfddbb9d1a63af5c821d8711719935a57009a1a /fs | |
parent | 929cfdd5d3bdc772aff32e5a3fb4e3894394aa75 (diff) | |
parent | 825cdcb1a5aaaefd884f302b4a3a9efb672c89c1 (diff) | |
download | linux-3.10-c88bc60a3bd3c63da3960076f13a4606c76bf013.tar.gz linux-3.10-c88bc60a3bd3c63da3960076f13a4606c76bf013.tar.bz2 linux-3.10-c88bc60a3bd3c63da3960076f13a4606c76bf013.zip |
Merge branch 'for-2.6.40/splice' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.40/splice' of git://git.kernel.dk/linux-2.6-block:
splice: add wakeup_pipe_readers()
Diffstat (limited to 'fs')
-rw-r--r-- | fs/splice.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/fs/splice.c b/fs/splice.c index 50a5d978da1..aa866d30969 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -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 @@ -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++); @@ -1892,12 +1896,9 @@ retry: /* * 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); @@ -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; } |