diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-05 13:31:50 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-06-12 00:21:13 -0400 |
| commit | 5f073850602084fbcbb987948ff3e70ae273f7d2 (patch) | |
| tree | 081df513f752002b75a7edecaec7e4c20ee3daac | |
| parent | 3551dd79ac1d5bf525a5cd134988e8b72f03314a (diff) | |
kill generic_file_splice_write()
no callers left
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | fs/splice.c | 124 | ||||
| -rw-r--r-- | include/linux/fs.h | 2 |
2 files changed, 0 insertions, 126 deletions
diff --git a/fs/splice.c b/fs/splice.c index ab84051758a7..8e7eef755a9b 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
| @@ -718,62 +718,6 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe, | |||
| 718 | sd->len, &pos, more); | 718 | sd->len, &pos, more); |
| 719 | } | 719 | } |
| 720 | 720 | ||
| 721 | /* | ||
| 722 | * This is a little more tricky than the file -> pipe splicing. There are | ||
| 723 | * basically three cases: | ||
| 724 | * | ||
| 725 | * - Destination page already exists in the address space and there | ||
| 726 | * are users of it. For that case we have no other option that | ||
| 727 | * copying the data. Tough luck. | ||
| 728 | * - Destination page already exists in the address space, but there | ||
| 729 | * are no users of it. Make sure it's uptodate, then drop it. Fall | ||
| 730 | * through to last case. | ||
| 731 | * - Destination page does not exist, we can add the pipe page to | ||
| 732 | * the page cache and avoid the copy. | ||
| 733 | * | ||
| 734 | * If asked to move pages to the output file (SPLICE_F_MOVE is set in | ||
| 735 | * sd->flags), we attempt to migrate pages from the pipe to the output | ||
| 736 | * file address space page cache. This is possible if no one else has | ||
| 737 | * the pipe page referenced outside of the pipe and page cache. If | ||
| 738 | * SPLICE_F_MOVE isn't set, or we cannot move the page, we simply create | ||
| 739 | * a new page in the output file page cache and fill/dirty that. | ||
| 740 | */ | ||
| 741 | static int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf, | ||
| 742 | struct splice_desc *sd) | ||
| 743 | { | ||
| 744 | struct file *file = sd->u.file; | ||
| 745 | struct address_space *mapping = file->f_mapping; | ||
| 746 | unsigned int offset, this_len; | ||
| 747 | struct page *page; | ||
| 748 | void *fsdata; | ||
| 749 | int ret; | ||
| 750 | |||
| 751 | offset = sd->pos & ~PAGE_CACHE_MASK; | ||
| 752 | |||
| 753 | this_len = sd->len; | ||
| 754 | if (this_len + offset > PAGE_CACHE_SIZE) | ||
| 755 | this_len = PAGE_CACHE_SIZE - offset; | ||
| 756 | |||
| 757 | ret = pagecache_write_begin(file, mapping, sd->pos, this_len, | ||
| 758 | AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata); | ||
| 759 | if (unlikely(ret)) | ||
| 760 | goto out; | ||
| 761 | |||
| 762 | if (buf->page != page) { | ||
| 763 | char *src = kmap_atomic(buf->page); | ||
| 764 | char *dst = kmap_atomic(page); | ||
| 765 | |||
| 766 | memcpy(dst + offset, src + buf->offset, this_len); | ||
| 767 | flush_dcache_page(page); | ||
| 768 | kunmap_atomic(dst); | ||
| 769 | kunmap_atomic(src); | ||
| 770 | } | ||
| 771 | ret = pagecache_write_end(file, mapping, sd->pos, this_len, this_len, | ||
| 772 | page, fsdata); | ||
| 773 | out: | ||
| 774 | return ret; | ||
| 775 | } | ||
| 776 | |||
| 777 | static void wakeup_pipe_writers(struct pipe_inode_info *pipe) | 721 | static void wakeup_pipe_writers(struct pipe_inode_info *pipe) |
| 778 | { | 722 | { |
| 779 | smp_mb(); | 723 | smp_mb(); |
| @@ -981,74 +925,6 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out, | |||
| 981 | } | 925 | } |
| 982 | 926 | ||
| 983 | /** | 927 | /** |
| 984 | * generic_file_splice_write - splice data from a pipe to a file | ||
| 985 | * @pipe: pipe info | ||
| 986 | * @out: file to write to | ||
| 987 | * @ppos: position in @out | ||
| 988 | * @len: number of bytes to splice | ||
| 989 | * @flags: splice modifier flags | ||
| 990 | * | ||
| 991 | * Description: | ||
| 992 | * Will either move or copy pages (determined by @flags options) from | ||
| 993 | * the given pipe inode to the given file. | ||
| 994 | * | ||
| 995 | */ | ||
| 996 | ssize_t | ||
| 997 | generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | ||
| 998 | loff_t *ppos, size_t len, unsigned int flags) | ||
| 999 | { | ||
| 1000 | struct address_space *mapping = out->f_mapping; | ||
| 1001 | struct inode *inode = mapping->host; | ||
| 1002 | struct splice_desc sd = { | ||
| 1003 | .total_len = len, | ||
| 1004 | .flags = flags, | ||
| 1005 | .pos = *ppos, | ||
| 1006 | .u.file = out, | ||
| 1007 | }; | ||
| 1008 | ssize_t ret; | ||
| 1009 | |||
| 1010 | pipe_lock(pipe); | ||
| 1011 | |||
| 1012 | splice_from_pipe_begin(&sd); | ||
| 1013 | do { | ||
| 1014 | ret = splice_from_pipe_next(pipe, &sd); | ||
| 1015 | if (ret <= 0) | ||
| 1016 | break; | ||
| 1017 | |||
| 1018 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD); | ||
| 1019 | ret = file_remove_suid(out); | ||
| 1020 | if (!ret) { | ||
| 1021 | ret = file_update_time(out); | ||
| 1022 | if (!ret) | ||
| 1023 | ret = splice_from_pipe_feed(pipe, &sd, | ||
| 1024 | pipe_to_file); | ||
| 1025 | } | ||
| 1026 | mutex_unlock(&inode->i_mutex); | ||
| 1027 | } while (ret > 0); | ||
| 1028 | splice_from_pipe_end(pipe, &sd); | ||
| 1029 | |||
| 1030 | pipe_unlock(pipe); | ||
| 1031 | |||
| 1032 | if (sd.num_spliced) | ||
| 1033 | ret = sd.num_spliced; | ||
| 1034 | |||
| 1035 | if (ret > 0) { | ||
| 1036 | int err; | ||
| 1037 | |||
| 1038 | err = generic_write_sync(out, *ppos, ret); | ||
| 1039 | if (err) | ||
| 1040 | ret = err; | ||
| 1041 | else | ||
| 1042 | *ppos += ret; | ||
| 1043 | balance_dirty_pages_ratelimited(mapping); | ||
| 1044 | } | ||
| 1045 | |||
| 1046 | return ret; | ||
| 1047 | } | ||
| 1048 | |||
| 1049 | EXPORT_SYMBOL(generic_file_splice_write); | ||
| 1050 | |||
| 1051 | /** | ||
| 1052 | * iter_file_splice_write - splice data from a pipe to a file | 928 | * iter_file_splice_write - splice data from a pipe to a file |
| 1053 | * @pipe: pipe info | 929 | * @pipe: pipe info |
| 1054 | * @out: file to write to | 930 | * @out: file to write to |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 8bd8ed357c7b..4e92d551518d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -2432,8 +2432,6 @@ extern ssize_t generic_file_splice_read(struct file *, loff_t *, | |||
| 2432 | struct pipe_inode_info *, size_t, unsigned int); | 2432 | struct pipe_inode_info *, size_t, unsigned int); |
| 2433 | extern ssize_t default_file_splice_read(struct file *, loff_t *, | 2433 | extern ssize_t default_file_splice_read(struct file *, loff_t *, |
| 2434 | struct pipe_inode_info *, size_t, unsigned int); | 2434 | struct pipe_inode_info *, size_t, unsigned int); |
| 2435 | extern ssize_t generic_file_splice_write(struct pipe_inode_info *, | ||
| 2436 | struct file *, loff_t *, size_t, unsigned int); | ||
| 2437 | extern ssize_t iter_file_splice_write(struct pipe_inode_info *, | 2435 | extern ssize_t iter_file_splice_write(struct pipe_inode_info *, |
| 2438 | struct file *, loff_t *, size_t, unsigned int); | 2436 | struct file *, loff_t *, size_t, unsigned int); |
| 2439 | extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, | 2437 | extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, |
