@@ -374,6 +374,28 @@ v9fs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
374
374
return ret ;
375
375
}
376
376
377
+ /*
378
+ * v9fs_file_splice_read - splice-read from a file
379
+ * @in: The 9p file to read from
380
+ * @ppos: Where to find/update the file position
381
+ * @pipe: The pipe to splice into
382
+ * @len: The maximum amount of data to splice
383
+ * @flags: SPLICE_F_* flags
384
+ */
385
+ static ssize_t v9fs_file_splice_read (struct file * in , loff_t * ppos ,
386
+ struct pipe_inode_info * pipe ,
387
+ size_t len , unsigned int flags )
388
+ {
389
+ struct p9_fid * fid = in -> private_data ;
390
+
391
+ p9_debug (P9_DEBUG_VFS , "fid %d count %zu offset %lld\n" ,
392
+ fid -> fid , len , * ppos );
393
+
394
+ if (fid -> mode & P9L_DIRECT )
395
+ return copy_splice_read (in , ppos , pipe , len , flags );
396
+ return filemap_splice_read (in , ppos , pipe , len , flags );
397
+ }
398
+
377
399
/**
378
400
* v9fs_file_write_iter - write to a file
379
401
* @iocb: The operation parameters
@@ -569,7 +591,7 @@ const struct file_operations v9fs_file_operations = {
569
591
.release = v9fs_dir_release ,
570
592
.lock = v9fs_file_lock ,
571
593
.mmap = generic_file_readonly_mmap ,
572
- .splice_read = generic_file_splice_read ,
594
+ .splice_read = v9fs_file_splice_read ,
573
595
.splice_write = iter_file_splice_write ,
574
596
.fsync = v9fs_file_fsync ,
575
597
};
@@ -583,7 +605,7 @@ const struct file_operations v9fs_file_operations_dotl = {
583
605
.lock = v9fs_file_lock_dotl ,
584
606
.flock = v9fs_file_flock_dotl ,
585
607
.mmap = v9fs_file_mmap ,
586
- .splice_read = generic_file_splice_read ,
608
+ .splice_read = v9fs_file_splice_read ,
587
609
.splice_write = iter_file_splice_write ,
588
610
.fsync = v9fs_file_fsync_dotl ,
589
611
};
0 commit comments