diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 12:20:20 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 12:20:20 -0400 |
| commit | c88bc60a3bd3c63da3960076f13a4606c76bf013 (patch) | |
| tree | fcfddbb9d1a63af5c821d8711719935a57009a1a | |
| parent | 929cfdd5d3bdc772aff32e5a3fb4e3894394aa75 (diff) | |
| parent | 825cdcb1a5aaaefd884f302b4a3a9efb672c89c1 (diff) | |
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()
| -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 50a5d978da16..aa866d309695 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
| @@ -162,6 +162,14 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = { | |||
| 162 | .get = generic_pipe_buf_get, | 162 | .get = generic_pipe_buf_get, |
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| 165 | static void wakeup_pipe_readers(struct pipe_inode_info *pipe) | ||
| 166 | { | ||
| 167 | smp_mb(); | ||
| 168 | if (waitqueue_active(&pipe->wait)) | ||
| 169 | wake_up_interruptible(&pipe->wait); | ||
| 170 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); | ||
| 171 | } | ||
| 172 | |||
| 165 | /** | 173 | /** |
| 166 | * splice_to_pipe - fill passed data into a pipe | 174 | * splice_to_pipe - fill passed data into a pipe |
| 167 | * @pipe: pipe to fill | 175 | * @pipe: pipe to fill |
| @@ -247,12 +255,8 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe, | |||
| 247 | 255 | ||
| 248 | pipe_unlock(pipe); | 256 | pipe_unlock(pipe); |
| 249 | 257 | ||
| 250 | if (do_wakeup) { | 258 | if (do_wakeup) |
| 251 | smp_mb(); | 259 | wakeup_pipe_readers(pipe); |
| 252 | if (waitqueue_active(&pipe->wait)) | ||
| 253 | wake_up_interruptible(&pipe->wait); | ||
| 254 | kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); | ||
| 255 | } | ||
| 256 | 260 | ||
| 257 | while (page_nr < spd_pages) | 261 | while (page_nr < spd_pages) |
| 258 | spd->spd_release(spd, page_nr++); | 262 | spd->spd_release(spd, page_nr++); |
| @@ -1892,12 +1896,9 @@ retry: | |||
| 1892 | /* | 1896 | /* |
| 1893 | * If we put data in the output pipe, wakeup any potential readers. | 1897 | * If we put data in the output pipe, wakeup any potential readers. |
| 1894 | */ | 1898 | */ |
| 1895 | if (ret > 0) { | 1899 | if (ret > 0) |
| 1896 | smp_mb(); | 1900 | wakeup_pipe_readers(opipe); |
| 1897 | if (waitqueue_active(&opipe->wait)) | 1901 | |
| 1898 | wake_up_interruptible(&opipe->wait); | ||
| 1899 | kill_fasync(&opipe->fasync_readers, SIGIO, POLL_IN); | ||
| 1900 | } | ||
| 1901 | if (input_wakeup) | 1902 | if (input_wakeup) |
| 1902 | wakeup_pipe_writers(ipipe); | 1903 | wakeup_pipe_writers(ipipe); |
| 1903 | 1904 | ||
| @@ -1976,12 +1977,8 @@ static int link_pipe(struct pipe_inode_info *ipipe, | |||
| 1976 | /* | 1977 | /* |
| 1977 | * If we put data in the output pipe, wakeup any potential readers. | 1978 | * If we put data in the output pipe, wakeup any potential readers. |
| 1978 | */ | 1979 | */ |
| 1979 | if (ret > 0) { | 1980 | if (ret > 0) |
| 1980 | smp_mb(); | 1981 | wakeup_pipe_readers(opipe); |
| 1981 | if (waitqueue_active(&opipe->wait)) | ||
| 1982 | wake_up_interruptible(&opipe->wait); | ||
| 1983 | kill_fasync(&opipe->fasync_readers, SIGIO, POLL_IN); | ||
| 1984 | } | ||
| 1985 | 1982 | ||
| 1986 | return ret; | 1983 | return ret; |
| 1987 | } | 1984 | } |
