]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/splice.c
Merge tag 'drm-fixes-for-v4.9-rc8' of git://people.freedesktop.org/~airlied/linux
[karo-tx-linux.git] / fs / splice.c
index 153d4f3bd441febd7004b1862cd218afc0ee6252..5a7750bd2eea765d06f5e8b76687701b24867c7b 100644 (file)
@@ -299,13 +299,8 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
 {
        struct iov_iter to;
        struct kiocb kiocb;
-       loff_t isize;
        int idx, ret;
 
-       isize = i_size_read(in->f_mapping->host);
-       if (unlikely(*ppos >= isize))
-               return 0;
-
        iov_iter_pipe(&to, ITER_PIPE | READ, pipe, len);
        idx = to.idx;
        init_sync_kiocb(&kiocb, in);
@@ -413,7 +408,8 @@ static ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
        if (res <= 0)
                return -ENOMEM;
 
-       nr_pages = res / PAGE_SIZE;
+       BUG_ON(dummy);
+       nr_pages = DIV_ROUND_UP(res, PAGE_SIZE);
 
        vec = __vec;
        if (nr_pages > PIPE_DEF_BUFFERS) {