Skip to content

Commit a1be293

Browse files
dhowellsaxboe
authored andcommitted
coda: Implement splice-read
Implement splice-read for coda by passing the request down a layer rather than going through generic_file_splice_read() which is going to be changed to assume that ->read_folio() is present on buffered files. Signed-off-by: David Howells <[email protected]> Acked-by: Jan Harkes <[email protected]> cc: Christoph Hellwig <[email protected]> cc: Jens Axboe <[email protected]> cc: Al Viro <[email protected]> cc: John Hubbard <[email protected]> cc: David Hildenbrand <[email protected]> cc: Matthew Wilcox <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent d4120d8 commit a1be293

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

fs/coda/file.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/slab.h>
2424
#include <linux/uaccess.h>
2525
#include <linux/uio.h>
26+
#include <linux/splice.h>
2627

2728
#include <linux/coda.h>
2829
#include "coda_psdev.h"
@@ -94,6 +95,32 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to)
9495
return ret;
9596
}
9697

98+
static ssize_t
99+
coda_file_splice_read(struct file *coda_file, loff_t *ppos,
100+
struct pipe_inode_info *pipe,
101+
size_t len, unsigned int flags)
102+
{
103+
struct inode *coda_inode = file_inode(coda_file);
104+
struct coda_file_info *cfi = coda_ftoc(coda_file);
105+
struct file *in = cfi->cfi_container;
106+
loff_t ki_pos = *ppos;
107+
ssize_t ret;
108+
109+
ret = venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode),
110+
&cfi->cfi_access_intent,
111+
len, ki_pos, CODA_ACCESS_TYPE_READ);
112+
if (ret)
113+
goto finish_read;
114+
115+
ret = vfs_splice_read(in, ppos, pipe, len, flags);
116+
117+
finish_read:
118+
venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode),
119+
&cfi->cfi_access_intent,
120+
len, ki_pos, CODA_ACCESS_TYPE_READ_FINISH);
121+
return ret;
122+
}
123+
97124
static void
98125
coda_vm_open(struct vm_area_struct *vma)
99126
{
@@ -302,5 +329,5 @@ const struct file_operations coda_file_operations = {
302329
.open = coda_open,
303330
.release = coda_release,
304331
.fsync = coda_fsync,
305-
.splice_read = generic_file_splice_read,
332+
.splice_read = coda_file_splice_read,
306333
};

0 commit comments

Comments
 (0)