arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names
[platform/kernel/linux-starfive.git] / fs / 9p / vfs_file.c
index 6c31b8c..11cd8d2 100644 (file)
@@ -374,6 +374,28 @@ v9fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
        return ret;
 }
 
+/*
+ * v9fs_file_splice_read - splice-read from a file
+ * @in: The 9p file to read from
+ * @ppos: Where to find/update the file position
+ * @pipe: The pipe to splice into
+ * @len: The maximum amount of data to splice
+ * @flags: SPLICE_F_* flags
+ */
+static ssize_t v9fs_file_splice_read(struct file *in, loff_t *ppos,
+                                    struct pipe_inode_info *pipe,
+                                    size_t len, unsigned int flags)
+{
+       struct p9_fid *fid = in->private_data;
+
+       p9_debug(P9_DEBUG_VFS, "fid %d count %zu offset %lld\n",
+                fid->fid, len, *ppos);
+
+       if (fid->mode & P9L_DIRECT)
+               return copy_splice_read(in, ppos, pipe, len, flags);
+       return filemap_splice_read(in, ppos, pipe, len, flags);
+}
+
 /**
  * v9fs_file_write_iter - write to a file
  * @iocb: The operation parameters
@@ -483,10 +505,7 @@ v9fs_file_mmap(struct file *filp, struct vm_area_struct *vma)
        p9_debug(P9_DEBUG_MMAP, "filp :%p\n", filp);
 
        if (!(v9ses->cache & CACHE_WRITEBACK)) {
-               p9_debug(P9_DEBUG_CACHE, "(no mmap mode)");
-               if (vma->vm_flags & VM_MAYSHARE)
-                       return -ENODEV;
-               invalidate_inode_pages2(filp->f_mapping);
+               p9_debug(P9_DEBUG_CACHE, "(read-only mmap mode)");
                return generic_file_readonly_mmap(filp, vma);
        }
 
@@ -569,7 +588,7 @@ const struct file_operations v9fs_file_operations = {
        .release = v9fs_dir_release,
        .lock = v9fs_file_lock,
        .mmap = generic_file_readonly_mmap,
-       .splice_read = generic_file_splice_read,
+       .splice_read = v9fs_file_splice_read,
        .splice_write = iter_file_splice_write,
        .fsync = v9fs_file_fsync,
 };
@@ -583,7 +602,7 @@ const struct file_operations v9fs_file_operations_dotl = {
        .lock = v9fs_file_lock_dotl,
        .flock = v9fs_file_flock_dotl,
        .mmap = v9fs_file_mmap,
-       .splice_read = generic_file_splice_read,
+       .splice_read = v9fs_file_splice_read,
        .splice_write = iter_file_splice_write,
        .fsync = v9fs_file_fsync_dotl,
 };