diff options
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/splice.c b/fs/splice.c index cb211360273a..12d247f6ece5 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -811,7 +811,10 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out, | |||
811 | 811 | ||
812 | ret = __splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); | 812 | ret = __splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); |
813 | if (ret > 0) { | 813 | if (ret > 0) { |
814 | unsigned long nr_pages; | ||
815 | |||
814 | *ppos += ret; | 816 | *ppos += ret; |
817 | nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | ||
815 | 818 | ||
816 | /* | 819 | /* |
817 | * If file or inode is SYNC and we actually wrote some data, | 820 | * If file or inode is SYNC and we actually wrote some data, |
@@ -824,7 +827,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out, | |||
824 | if (err) | 827 | if (err) |
825 | ret = err; | 828 | ret = err; |
826 | } | 829 | } |
827 | balance_dirty_pages_ratelimited(mapping); | 830 | balance_dirty_pages_ratelimited_nr(mapping, nr_pages); |
828 | } | 831 | } |
829 | 832 | ||
830 | return ret; | 833 | return ret; |
@@ -863,7 +866,10 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
863 | 866 | ||
864 | ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); | 867 | ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file); |
865 | if (ret > 0) { | 868 | if (ret > 0) { |
869 | unsigned long nr_pages; | ||
870 | |||
866 | *ppos += ret; | 871 | *ppos += ret; |
872 | nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | ||
867 | 873 | ||
868 | /* | 874 | /* |
869 | * If file or inode is SYNC and we actually wrote some data, | 875 | * If file or inode is SYNC and we actually wrote some data, |
@@ -878,7 +884,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
878 | if (err) | 884 | if (err) |
879 | ret = err; | 885 | ret = err; |
880 | } | 886 | } |
881 | balance_dirty_pages_ratelimited(mapping); | 887 | balance_dirty_pages_ratelimited_nr(mapping, nr_pages); |
882 | } | 888 | } |
883 | 889 | ||
884 | return ret; | 890 | return ret; |