diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-06-01 14:54:11 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-06-08 08:32:38 +0200 |
commit | d366d39885b4a56eb90c7670deb46d82501579ad (patch) | |
tree | 1b12e45f308ef4f24cb90dda8bd679ec058dc980 /fs | |
parent | RAMFS NOMMU: missed POSIX UID/GID inode attribute checking (diff) | |
download | linux-d366d39885b4a56eb90c7670deb46d82501579ad.tar.xz linux-d366d39885b4a56eb90c7670deb46d82501579ad.zip |
splice: move inode size check into generic_file_splice_read()
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/splice.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/splice.c b/fs/splice.c index 12f28281d2b1..228a48799d11 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -478,10 +478,18 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, { ssize_t spliced; int ret; + loff_t isize, left; + + isize = i_size_read(in->f_mapping->host); + if (unlikely(*ppos >= isize)) + return 0; + + left = isize - *ppos; + if (unlikely(left < len)) + len = left; ret = 0; spliced = 0; - while (len) { ret = __generic_file_splice_read(in, ppos, pipe, len, flags); @@ -922,7 +930,6 @@ static long do_splice_to(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags) { - loff_t isize, left; int ret; if (unlikely(!in->f_op || !in->f_op->splice_read)) @@ -935,14 +942,6 @@ static long do_splice_to(struct file *in, loff_t *ppos, if (unlikely(ret < 0)) return ret; - isize = i_size_read(in->f_mapping->host); - if (unlikely(*ppos >= isize)) - return 0; - - left = isize - *ppos; - if (unlikely(left < len)) - len = left; - return in->f_op->splice_read(in, ppos, pipe, len, flags); } |