summaryrefslogtreecommitdiff
path: root/fs/coda
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2009-05-07 15:37:36 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 14:13:10 +0200
commit6818173bd658439b83896a2a7586f64ab51bf29c (patch)
tree17d25ee77485af18da1a80cb7f1d8ec581c6abfc /fs/coda
parent7c77f0b3f9208c339a4b40737bb2cb0f0319bb8d (diff)
downloadlinux-3.10-6818173bd658439b83896a2a7586f64ab51bf29c.tar.gz
linux-3.10-6818173bd658439b83896a2a7586f64ab51bf29c.tar.bz2
linux-3.10-6818173bd658439b83896a2a7586f64ab51bf29c.zip
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/coda')
-rw-r--r--fs/coda/file.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 6a347fbc998..ffd42815fda 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -47,6 +47,8 @@ coda_file_splice_read(struct file *coda_file, loff_t *ppos,
struct pipe_inode_info *pipe, size_t count,
unsigned int flags)
{
+ ssize_t (*splice_read)(struct file *, loff_t *,
+ struct pipe_inode_info *, size_t, unsigned int);
struct coda_file_info *cfi;
struct file *host_file;
@@ -54,10 +56,11 @@ coda_file_splice_read(struct file *coda_file, loff_t *ppos,
BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
host_file = cfi->cfi_container;
- if (!host_file->f_op || !host_file->f_op->splice_read)
- return -EINVAL;
+ splice_read = host_file->f_op->splice_read;
+ if (!splice_read)
+ splice_read = default_file_splice_read;
- return host_file->f_op->splice_read(host_file, ppos, pipe, count,flags);
+ return splice_read(host_file, ppos, pipe, count, flags);
}
static ssize_t