@@ -2552,7 +2552,7 @@ static ssize_t ocfs2_file_read_iter(struct kiocb *iocb,
2552
2552
*
2553
2553
* Take and drop the meta data lock to update inode fields
2554
2554
* like i_size. This allows the checks down below
2555
- * generic_file_read_iter () a chance of actually working.
2555
+ * copy_splice_read () a chance of actually working.
2556
2556
*/
2557
2557
ret = ocfs2_inode_lock_atime (inode , filp -> f_path .mnt , & lock_level ,
2558
2558
!nowait );
@@ -2581,6 +2581,43 @@ static ssize_t ocfs2_file_read_iter(struct kiocb *iocb,
2581
2581
return ret ;
2582
2582
}
2583
2583
2584
+ static ssize_t ocfs2_file_splice_read (struct file * in , loff_t * ppos ,
2585
+ struct pipe_inode_info * pipe ,
2586
+ size_t len , unsigned int flags )
2587
+ {
2588
+ struct inode * inode = file_inode (in );
2589
+ ssize_t ret = 0 ;
2590
+ int lock_level = 0 ;
2591
+
2592
+ trace_ocfs2_file_splice_read (inode , in , in -> f_path .dentry ,
2593
+ (unsigned long long )OCFS2_I (inode )-> ip_blkno ,
2594
+ in -> f_path .dentry -> d_name .len ,
2595
+ in -> f_path .dentry -> d_name .name ,
2596
+ flags );
2597
+
2598
+ /*
2599
+ * We're fine letting folks race truncates and extending writes with
2600
+ * read across the cluster, just like they can locally. Hence no
2601
+ * rw_lock during read.
2602
+ *
2603
+ * Take and drop the meta data lock to update inode fields like i_size.
2604
+ * This allows the checks down below filemap_splice_read() a chance of
2605
+ * actually working.
2606
+ */
2607
+ ret = ocfs2_inode_lock_atime (inode , in -> f_path .mnt , & lock_level , 1 );
2608
+ if (ret < 0 ) {
2609
+ if (ret != - EAGAIN )
2610
+ mlog_errno (ret );
2611
+ goto bail ;
2612
+ }
2613
+ ocfs2_inode_unlock (inode , lock_level );
2614
+
2615
+ ret = filemap_splice_read (in , ppos , pipe , len , flags );
2616
+ trace_filemap_splice_read_ret (ret );
2617
+ bail :
2618
+ return ret ;
2619
+ }
2620
+
2584
2621
/* Refer generic_file_llseek_unlocked() */
2585
2622
static loff_t ocfs2_file_llseek (struct file * file , loff_t offset , int whence )
2586
2623
{
@@ -2744,7 +2781,7 @@ const struct file_operations ocfs2_fops = {
2744
2781
#endif
2745
2782
.lock = ocfs2_lock ,
2746
2783
.flock = ocfs2_flock ,
2747
- .splice_read = generic_file_splice_read ,
2784
+ .splice_read = ocfs2_file_splice_read ,
2748
2785
.splice_write = iter_file_splice_write ,
2749
2786
.fallocate = ocfs2_fallocate ,
2750
2787
.remap_file_range = ocfs2_remap_file_range ,
0 commit comments