]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/splice.c
writeback: Initial tracing support
[karo-tx-linux.git] / fs / splice.c
index ac22b00d86c3fab51fe3f39cc6cb50a8e7bbcc59..ec11c52d646d001b520c3a38a4e0832e58dfae5c 100644 (file)
@@ -354,7 +354,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
                                break;
 
                        error = add_to_page_cache_lru(page, mapping, index,
-                                               mapping_gfp_mask(mapping));
+                                               GFP_KERNEL);
                        if (unlikely(error)) {
                                page_cache_release(page);
                                if (error == -EEXIST)
@@ -597,7 +597,6 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
        struct page *pages[PIPE_DEF_BUFFERS];
        struct partial_page partial[PIPE_DEF_BUFFERS];
        struct iovec *vec, __vec[PIPE_DEF_BUFFERS];
-       pgoff_t index;
        ssize_t res;
        size_t this_len;
        int error;
@@ -621,7 +620,6 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
                        goto shrink_ret;
        }
 
-       index = *ppos >> PAGE_CACHE_SHIFT;
        offset = *ppos & ~PAGE_CACHE_MASK;
        nr_pages = (len + offset + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
 
@@ -1282,7 +1280,8 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
 {
        struct file *file = sd->u.file;
 
-       return do_splice_from(pipe, file, &sd->pos, sd->total_len, sd->flags);
+       return do_splice_from(pipe, file, &file->f_pos, sd->total_len,
+                             sd->flags);
 }
 
 /**
@@ -1371,8 +1370,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
                if (off_in)
                        return -ESPIPE;
                if (off_out) {
-                       if (!out->f_op || !out->f_op->llseek ||
-                           out->f_op->llseek == no_llseek)
+                       if (!(out->f_mode & FMODE_PWRITE))
                                return -EINVAL;
                        if (copy_from_user(&offset, off_out, sizeof(loff_t)))
                                return -EFAULT;
@@ -1392,8 +1390,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
                if (off_out)
                        return -ESPIPE;
                if (off_in) {
-                       if (!in->f_op || !in->f_op->llseek ||
-                           in->f_op->llseek == no_llseek)
+                       if (!(in->f_mode & FMODE_PREAD))
                                return -EINVAL;
                        if (copy_from_user(&offset, off_in, sizeof(loff_t)))
                                return -EFAULT;