aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/splice.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/splice.c b/fs/splice.c
index 48b4382cc114..e50a460239dd 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -92,7 +92,7 @@ static void *page_cache_pipe_buf_map(struct file *file,
92 92
93 /* 93 /*
94 * Page got truncated/unhashed. This will cause a 0-byte 94 * Page got truncated/unhashed. This will cause a 0-byte
95 * splice, if this is the first page 95 * splice, if this is the first page.
96 */ 96 */
97 if (!page->mapping) { 97 if (!page->mapping) {
98 err = -ENODATA; 98 err = -ENODATA;
@@ -100,7 +100,7 @@ static void *page_cache_pipe_buf_map(struct file *file,
100 } 100 }
101 101
102 /* 102 /*
103 * uh oh, read-error from disk 103 * Uh oh, read-error from disk.
104 */ 104 */
105 if (!PageUptodate(page)) { 105 if (!PageUptodate(page)) {
106 err = -EIO; 106 err = -EIO;
@@ -108,7 +108,7 @@ static void *page_cache_pipe_buf_map(struct file *file,
108 } 108 }
109 109
110 /* 110 /*
111 * page is ok afterall, fall through to mapping 111 * Page is ok afterall, fall through to mapping.
112 */ 112 */
113 unlock_page(page); 113 unlock_page(page);
114 } 114 }
@@ -249,7 +249,7 @@ __generic_file_splice_read(struct file *in, struct pipe_inode_info *pipe,
249 nr_pages = PIPE_BUFFERS; 249 nr_pages = PIPE_BUFFERS;
250 250
251 /* 251 /*
252 * initiate read-ahead on this page range. however, don't call into 252 * Initiate read-ahead on this page range. however, don't call into
253 * read-ahead if this is a non-zero offset (we are likely doing small 253 * read-ahead if this is a non-zero offset (we are likely doing small
254 * chunk splice and the page is already there) for a single page. 254 * chunk splice and the page is already there) for a single page.
255 */ 255 */
@@ -257,7 +257,7 @@ __generic_file_splice_read(struct file *in, struct pipe_inode_info *pipe,
257 do_page_cache_readahead(mapping, in, index, nr_pages); 257 do_page_cache_readahead(mapping, in, index, nr_pages);
258 258
259 /* 259 /*
260 * now fill in the holes 260 * Now fill in the holes:
261 */ 261 */
262 error = 0; 262 error = 0;
263 for (i = 0; i < nr_pages; i++, index++) { 263 for (i = 0; i < nr_pages; i++, index++) {
@@ -396,10 +396,10 @@ static int pipe_to_sendpage(struct pipe_inode_info *info,
396 int more; 396 int more;
397 397
398 /* 398 /*
399 * sub-optimal, but we are limited by the pipe ->map. we don't 399 * Sub-optimal, but we are limited by the pipe ->map. We don't
400 * need a kmap'ed buffer here, we just want to make sure we 400 * need a kmap'ed buffer here, we just want to make sure we
401 * have the page pinned if the pipe page originates from the 401 * have the page pinned if the pipe page originates from the
402 * page cache 402 * page cache.
403 */ 403 */
404 ptr = buf->ops->map(file, info, buf); 404 ptr = buf->ops->map(file, info, buf);
405 if (IS_ERR(ptr)) 405 if (IS_ERR(ptr))
@@ -460,7 +460,7 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf,
460 offset = sd->pos & ~PAGE_CACHE_MASK; 460 offset = sd->pos & ~PAGE_CACHE_MASK;
461 461
462 /* 462 /*
463 * reuse buf page, if SPLICE_F_MOVE is set 463 * Reuse buf page, if SPLICE_F_MOVE is set.
464 */ 464 */
465 if (sd->flags & SPLICE_F_MOVE) { 465 if (sd->flags & SPLICE_F_MOVE) {
466 /* 466 /*
@@ -501,7 +501,7 @@ find_page:
501 501
502 if (!PageUptodate(page)) { 502 if (!PageUptodate(page)) {
503 /* 503 /*
504 * page got invalidated, repeat 504 * Page got invalidated, repeat.
505 */ 505 */
506 if (!page->mapping) { 506 if (!page->mapping) {
507 unlock_page(page); 507 unlock_page(page);
@@ -598,6 +598,7 @@ static ssize_t move_from_pipe(struct pipe_inode_info *pipe, struct file *out,
598 ret += sd.len; 598 ret += sd.len;
599 buf->offset += sd.len; 599 buf->offset += sd.len;
600 buf->len -= sd.len; 600 buf->len -= sd.len;
601
601 if (!buf->len) { 602 if (!buf->len) {
602 buf->ops = NULL; 603 buf->ops = NULL;
603 ops->release(pipe, buf); 604 ops->release(pipe, buf);
@@ -681,7 +682,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
681 ret = move_from_pipe(pipe, out, len, flags, pipe_to_file); 682 ret = move_from_pipe(pipe, out, len, flags, pipe_to_file);
682 683
683 /* 684 /*
684 * if file or inode is SYNC and we actually wrote some data, sync it 685 * If file or inode is SYNC and we actually wrote some data, sync it.
685 */ 686 */
686 if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(mapping->host)) 687 if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(mapping->host))
687 && ret > 0) { 688 && ret > 0) {
@@ -815,7 +816,7 @@ long do_splice_direct(struct file *in, struct file *out, size_t len,
815 } 816 }
816 817
817 /* 818 /*
818 * do the splice 819 * Do the splice.
819 */ 820 */
820 ret = 0; 821 ret = 0;
821 bytes = 0; 822 bytes = 0;