diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2009-05-07 09:37:36 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-11 08:13:10 -0400 |
commit | 6818173bd658439b83896a2a7586f64ab51bf29c (patch) | |
tree | 17d25ee77485af18da1a80cb7f1d8ec581c6abfc /fs/read_write.c | |
parent | 7c77f0b3f9208c339a4b40737bb2cb0f0319bb8d (diff) |
splice: implement default splice_read method
If f_op->splice_read() is not implemented, fall back to a plain read.
Use vfs_readv() to read into previously allocated pages.
This will allow splice and functions using splice, such as the loop
device, to work on all filesystems. This includes "direct_io" files
in fuse which bypass the page cache.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 9d1e76bb9ee1..6c8c55dec2bc 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -805,12 +805,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
805 | goto out; | 805 | goto out; |
806 | if (!(in_file->f_mode & FMODE_READ)) | 806 | if (!(in_file->f_mode & FMODE_READ)) |
807 | goto fput_in; | 807 | goto fput_in; |
808 | retval = -EINVAL; | ||
809 | in_inode = in_file->f_path.dentry->d_inode; | ||
810 | if (!in_inode) | ||
811 | goto fput_in; | ||
812 | if (!in_file->f_op || !in_file->f_op->splice_read) | ||
813 | goto fput_in; | ||
814 | retval = -ESPIPE; | 808 | retval = -ESPIPE; |
815 | if (!ppos) | 809 | if (!ppos) |
816 | ppos = &in_file->f_pos; | 810 | ppos = &in_file->f_pos; |
@@ -834,6 +828,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, | |||
834 | retval = -EINVAL; | 828 | retval = -EINVAL; |
835 | if (!out_file->f_op || !out_file->f_op->sendpage) | 829 | if (!out_file->f_op || !out_file->f_op->sendpage) |
836 | goto fput_out; | 830 | goto fput_out; |
831 | in_inode = in_file->f_path.dentry->d_inode; | ||
837 | out_inode = out_file->f_path.dentry->d_inode; | 832 | out_inode = out_file->f_path.dentry->d_inode; |
838 | retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); | 833 | retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); |
839 | if (retval < 0) | 834 | if (retval < 0) |