@@ -306,6 +306,34 @@ xfs_file_read_iter(
306
306
return ret ;
307
307
}
308
308
309
+ STATIC ssize_t
310
+ xfs_file_splice_read (
311
+ struct file * in ,
312
+ loff_t * ppos ,
313
+ struct pipe_inode_info * pipe ,
314
+ size_t len ,
315
+ unsigned int flags )
316
+ {
317
+ struct inode * inode = file_inode (in );
318
+ struct xfs_inode * ip = XFS_I (inode );
319
+ struct xfs_mount * mp = ip -> i_mount ;
320
+ ssize_t ret = 0 ;
321
+
322
+ XFS_STATS_INC (mp , xs_read_calls );
323
+
324
+ if (xfs_is_shutdown (mp ))
325
+ return - EIO ;
326
+
327
+ trace_xfs_file_splice_read (ip , * ppos , len );
328
+
329
+ xfs_ilock (ip , XFS_IOLOCK_SHARED );
330
+ ret = filemap_splice_read (in , ppos , pipe , len , flags );
331
+ xfs_iunlock (ip , XFS_IOLOCK_SHARED );
332
+ if (ret > 0 )
333
+ XFS_STATS_ADD (mp , xs_read_bytes , ret );
334
+ return ret ;
335
+ }
336
+
309
337
/*
310
338
* Common pre-write limit and setup checks.
311
339
*
@@ -1423,7 +1451,7 @@ const struct file_operations xfs_file_operations = {
1423
1451
.llseek = xfs_file_llseek ,
1424
1452
.read_iter = xfs_file_read_iter ,
1425
1453
.write_iter = xfs_file_write_iter ,
1426
- .splice_read = generic_file_splice_read ,
1454
+ .splice_read = xfs_file_splice_read ,
1427
1455
.splice_write = iter_file_splice_write ,
1428
1456
.iopoll = iocb_bio_iopoll ,
1429
1457
.unlocked_ioctl = xfs_file_ioctl ,
0 commit comments