[PATCH 1/3] splice: default to iter based versions implicitly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a file_operations instance has the read or write iter methods we should
use the iter based splice code by default.  We still allow to overide it
with explicit ->read_iter and ->write_iter methods, but few of them are
left, and there is a non-zero chance that we could get rid of them in the
future.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 drivers/staging/lustre/lustre/llite/file.c | 3 ---
 fs/adfs/file.c                             | 1 -
 fs/affs/file.c                             | 1 -
 fs/afs/file.c                              | 1 -
 fs/bfs/file.c                              | 1 -
 fs/block_dev.c                             | 2 --
 fs/btrfs/file.c                            | 1 -
 fs/ceph/file.c                             | 2 --
 fs/cifs/cifsfs.c                           | 6 ------
 fs/coda/file.c                             | 1 -
 fs/ecryptfs/file.c                         | 1 -
 fs/exofs/file.c                            | 2 --
 fs/ext2/file.c                             | 2 --
 fs/ext4/file.c                             | 2 --
 fs/f2fs/file.c                             | 2 --
 fs/fat/file.c                              | 1 -
 fs/fuse/file.c                             | 1 -
 fs/gfs2/file.c                             | 2 --
 fs/hfs/inode.c                             | 1 -
 fs/hfsplus/inode.c                         | 1 -
 fs/hostfs/hostfs_kern.c                    | 1 -
 fs/hpfs/file.c                             | 1 -
 fs/jffs2/file.c                            | 1 -
 fs/jfs/file.c                              | 2 --
 fs/minix/file.c                            | 1 -
 fs/nfs/file.c                              | 2 --
 fs/nfs/nfs4file.c                          | 2 --
 fs/nfsd/nfs4xdr.c                          | 2 +-
 fs/nfsd/vfs.c                              | 3 ++-
 fs/nilfs2/file.c                           | 1 -
 fs/ntfs/file.c                             | 1 -
 fs/ocfs2/file.c                            | 4 ----
 fs/omfs/file.c                             | 1 -
 fs/ramfs/file-mmu.c                        | 2 --
 fs/ramfs/file-nommu.c                      | 2 --
 fs/read_write.c                            | 1 -
 fs/reiserfs/file.c                         | 2 --
 fs/romfs/mmap-nommu.c                      | 1 -
 fs/splice.c                                | 9 ++++++---
 fs/sysv/file.c                             | 1 -
 fs/ubifs/file.c                            | 2 --
 fs/udf/file.c                              | 1 -
 fs/ufs/file.c                              | 1 -
 fs/xfs/xfs_file.c                          | 2 --
 include/linux/fs.h                         | 2 --
 mm/shmem.c                                 | 2 --
 46 files changed, 9 insertions(+), 75 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 67c4b9cc6e75..86044e00e00b 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3122,7 +3122,6 @@ struct file_operations ll_file_operations = {
 	.release	= ll_file_release,
 	.mmap	   = ll_file_mmap,
 	.llseek	 = ll_file_seek,
-	.splice_read    = generic_file_splice_read,
 	.fsync	  = ll_fsync,
 	.flush	  = ll_flush
 };
@@ -3135,7 +3134,6 @@ struct file_operations ll_file_operations_flock = {
 	.release	= ll_file_release,
 	.mmap	   = ll_file_mmap,
 	.llseek	 = ll_file_seek,
-	.splice_read    = generic_file_splice_read,
 	.fsync	  = ll_fsync,
 	.flush	  = ll_flush,
 	.flock	  = ll_file_flock,
@@ -3151,7 +3149,6 @@ struct file_operations ll_file_operations_noflock = {
 	.release	= ll_file_release,
 	.mmap	   = ll_file_mmap,
 	.llseek	 = ll_file_seek,
-	.splice_read    = generic_file_splice_read,
 	.fsync	  = ll_fsync,
 	.flush	  = ll_flush,
 	.flock	  = ll_file_noflock,
diff --git a/fs/adfs/file.c b/fs/adfs/file.c
index 46c0d5671cd5..2f86134e95b7 100644
--- a/fs/adfs/file.c
+++ b/fs/adfs/file.c
@@ -27,7 +27,6 @@ const struct file_operations adfs_file_operations = {
 	.mmap		= generic_file_mmap,
 	.fsync		= generic_file_fsync,
 	.write_iter	= generic_file_write_iter,
-	.splice_read	= generic_file_splice_read,
 };
 
 const struct inode_operations adfs_file_inode_operations = {
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 196ee7f6fdc4..c3498025ba8e 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -974,7 +974,6 @@ const struct file_operations affs_file_operations = {
 	.open		= affs_file_open,
 	.release	= affs_file_release,
 	.fsync		= affs_file_fsync,
-	.splice_read	= generic_file_splice_read,
 };
 
 const struct inode_operations affs_file_inode_operations = {
diff --git a/fs/afs/file.c b/fs/afs/file.c
index 0d5b8508869b..6fbfafbdebe9 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -36,7 +36,6 @@ const struct file_operations afs_file_operations = {
 	.read_iter	= generic_file_read_iter,
 	.write_iter	= afs_file_write,
 	.mmap		= generic_file_readonly_mmap,
-	.splice_read	= generic_file_splice_read,
 	.fsync		= afs_fsync,
 	.lock		= afs_lock,
 	.flock		= afs_flock,
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index 97f1b5160155..ff5994cfd769 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -26,7 +26,6 @@ const struct file_operations bfs_file_operations = {
 	.read_iter	= generic_file_read_iter,
 	.write_iter	= generic_file_write_iter,
 	.mmap		= generic_file_mmap,
-	.splice_read	= generic_file_splice_read,
 };
 
 static int bfs_move_block(unsigned long from, unsigned long to,
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 519599dddd36..53b9902140b0 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -2027,8 +2027,6 @@ const struct file_operations def_blk_fops = {
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= compat_blkdev_ioctl,
 #endif
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.fallocate	= blkdev_fallocate,
 };
 
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index da1096eb1a40..109c475729e0 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -3074,7 +3074,6 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence)
 const struct file_operations btrfs_file_operations = {
 	.llseek		= btrfs_file_llseek,
 	.read_iter      = generic_file_read_iter,
-	.splice_read	= generic_file_splice_read,
 	.write_iter	= btrfs_file_write_iter,
 	.mmap		= btrfs_file_mmap,
 	.open		= generic_file_open,
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 3fdde0b283c9..8842c869265c 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1721,8 +1721,6 @@ const struct file_operations ceph_file_fops = {
 	.fsync = ceph_fsync,
 	.lock = ceph_lock,
 	.flock = ceph_flock,
-	.splice_read = generic_file_splice_read,
-	.splice_write = iter_file_splice_write,
 	.unlocked_ioctl = ceph_ioctl,
 	.compat_ioctl	= ceph_ioctl,
 	.fallocate	= ceph_fallocate,
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 9a1667e0e8d6..9b7cf2ad302e 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -1068,7 +1068,6 @@ const struct file_operations cifs_file_ops = {
 	.fsync = cifs_fsync,
 	.flush = cifs_flush,
 	.mmap  = cifs_file_mmap,
-	.splice_read = generic_file_splice_read,
 	.llseek = cifs_llseek,
 	.unlocked_ioctl	= cifs_ioctl,
 	.copy_file_range = cifs_copy_file_range,
@@ -1086,7 +1085,6 @@ const struct file_operations cifs_file_strict_ops = {
 	.fsync = cifs_strict_fsync,
 	.flush = cifs_flush,
 	.mmap = cifs_file_strict_mmap,
-	.splice_read = generic_file_splice_read,
 	.llseek = cifs_llseek,
 	.unlocked_ioctl	= cifs_ioctl,
 	.copy_file_range = cifs_copy_file_range,
@@ -1105,7 +1103,6 @@ const struct file_operations cifs_file_direct_ops = {
 	.fsync = cifs_fsync,
 	.flush = cifs_flush,
 	.mmap = cifs_file_mmap,
-	.splice_read = generic_file_splice_read,
 	.unlocked_ioctl  = cifs_ioctl,
 	.copy_file_range = cifs_copy_file_range,
 	.clone_file_range = cifs_clone_file_range,
@@ -1122,7 +1119,6 @@ const struct file_operations cifs_file_nobrl_ops = {
 	.fsync = cifs_fsync,
 	.flush = cifs_flush,
 	.mmap  = cifs_file_mmap,
-	.splice_read = generic_file_splice_read,
 	.llseek = cifs_llseek,
 	.unlocked_ioctl	= cifs_ioctl,
 	.copy_file_range = cifs_copy_file_range,
@@ -1139,7 +1135,6 @@ const struct file_operations cifs_file_strict_nobrl_ops = {
 	.fsync = cifs_strict_fsync,
 	.flush = cifs_flush,
 	.mmap = cifs_file_strict_mmap,
-	.splice_read = generic_file_splice_read,
 	.llseek = cifs_llseek,
 	.unlocked_ioctl	= cifs_ioctl,
 	.copy_file_range = cifs_copy_file_range,
@@ -1157,7 +1152,6 @@ const struct file_operations cifs_file_direct_nobrl_ops = {
 	.fsync = cifs_fsync,
 	.flush = cifs_flush,
 	.mmap = cifs_file_mmap,
-	.splice_read = generic_file_splice_read,
 	.unlocked_ioctl  = cifs_ioctl,
 	.copy_file_range = cifs_copy_file_range,
 	.clone_file_range = cifs_clone_file_range,
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 363402fcb3ed..0297b3835f27 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -204,6 +204,5 @@ const struct file_operations coda_file_operations = {
 	.open		= coda_open,
 	.release	= coda_release,
 	.fsync		= coda_fsync,
-	.splice_read	= generic_file_splice_read,
 };
 
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index ca4e83750214..f0c1894b8301 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -422,5 +422,4 @@ const struct file_operations ecryptfs_main_fops = {
 	.release = ecryptfs_release,
 	.fsync = ecryptfs_fsync,
 	.fasync = ecryptfs_fasync,
-	.splice_read = generic_file_splice_read,
 };
diff --git a/fs/exofs/file.c b/fs/exofs/file.c
index 28645f0640f7..86fc0049cb0d 100644
--- a/fs/exofs/file.c
+++ b/fs/exofs/file.c
@@ -74,8 +74,6 @@ const struct file_operations exofs_file_operations = {
 	.release	= exofs_release_file,
 	.fsync		= exofs_file_fsync,
 	.flush		= exofs_flush,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 };
 
 const struct inode_operations exofs_file_inode_operations = {
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index b21891a6bfca..ef52e5ad2ef5 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -217,8 +217,6 @@ const struct file_operations ext2_file_operations = {
 	.release	= ext2_release_file,
 	.fsync		= ext2_fsync,
 	.get_unmapped_area = thp_get_unmapped_area,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 };
 
 const struct inode_operations ext2_file_inode_operations = {
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 831fd6beebf0..053d030deb16 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -750,8 +750,6 @@ const struct file_operations ext4_file_operations = {
 	.release	= ext4_release_file,
 	.fsync		= ext4_sync_file,
 	.get_unmapped_area = thp_get_unmapped_area,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.fallocate	= ext4_fallocate,
 };
 
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 61af721329fa..abfb9a9b23a3 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2404,6 +2404,4 @@ const struct file_operations f2fs_file_operations = {
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= f2fs_compat_ioctl,
 #endif
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 };
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 4724cc9ad650..5a879f2249af 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -180,7 +180,6 @@ const struct file_operations fat_file_operations = {
 	.compat_ioctl	= fat_generic_compat_ioctl,
 #endif
 	.fsync		= fat_file_fsync,
-	.splice_read	= generic_file_splice_read,
 	.fallocate	= fat_fallocate,
 };
 
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 3ee4fdc3da9e..ee9d1dd7eba1 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3015,7 +3015,6 @@ static const struct file_operations fuse_file_operations = {
 	.fsync		= fuse_fsync,
 	.lock		= fuse_file_lock,
 	.flock		= fuse_file_flock,
-	.splice_read	= generic_file_splice_read,
 	.unlocked_ioctl	= fuse_file_ioctl,
 	.compat_ioctl	= fuse_file_compat_ioctl,
 	.poll		= fuse_file_poll,
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index c2062a108d19..9c21a57661bf 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1120,7 +1120,6 @@ const struct file_operations gfs2_file_fops = {
 	.fsync		= gfs2_fsync,
 	.lock		= gfs2_lock,
 	.flock		= gfs2_flock,
-	.splice_read	= generic_file_splice_read,
 	.splice_write	= gfs2_file_splice_write,
 	.setlease	= simple_nosetlease,
 	.fallocate	= gfs2_fallocate,
@@ -1148,7 +1147,6 @@ const struct file_operations gfs2_file_fops_nolock = {
 	.open		= gfs2_open,
 	.release	= gfs2_release,
 	.fsync		= gfs2_fsync,
-	.splice_read	= generic_file_splice_read,
 	.splice_write	= gfs2_file_splice_write,
 	.setlease	= generic_setlease,
 	.fallocate	= gfs2_fallocate,
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index bfbba799430f..4b9e3e4fcf93 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -680,7 +680,6 @@ static const struct file_operations hfs_file_operations = {
 	.read_iter	= generic_file_read_iter,
 	.write_iter	= generic_file_write_iter,
 	.mmap		= generic_file_mmap,
-	.splice_read	= generic_file_splice_read,
 	.fsync		= hfs_file_fsync,
 	.open		= hfs_file_open,
 	.release	= hfs_file_release,
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index e8638d528195..d028d32f1c5f 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -346,7 +346,6 @@ static const struct file_operations hfsplus_file_operations = {
 	.read_iter	= generic_file_read_iter,
 	.write_iter	= generic_file_write_iter,
 	.mmap		= generic_file_mmap,
-	.splice_read	= generic_file_splice_read,
 	.fsync		= hfsplus_file_fsync,
 	.open		= hfsplus_file_open,
 	.release	= hfsplus_file_release,
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index e61261a7417e..c0f5ba4f835f 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -387,7 +387,6 @@ static int hostfs_fsync(struct file *file, loff_t start, loff_t end,
 
 static const struct file_operations hostfs_file_fops = {
 	.llseek		= generic_file_llseek,
-	.splice_read	= generic_file_splice_read,
 	.read_iter	= generic_file_read_iter,
 	.write_iter	= generic_file_write_iter,
 	.mmap		= generic_file_mmap,
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index b3be1b5a62e2..474933a15e28 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -212,7 +212,6 @@ const struct file_operations hpfs_file_ops =
 	.mmap		= generic_file_mmap,
 	.release	= hpfs_file_release,
 	.fsync		= hpfs_file_fsync,
-	.splice_read	= generic_file_splice_read,
 	.unlocked_ioctl	= hpfs_ioctl,
 };
 
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index c12476e309c6..843918d2204b 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -56,7 +56,6 @@ const struct file_operations jffs2_file_operations =
 	.unlocked_ioctl=jffs2_ioctl,
 	.mmap =		generic_file_readonly_mmap,
 	.fsync =	jffs2_fsync,
-	.splice_read =	generic_file_splice_read,
 };
 
 /* jffs2_file_inode_operations */
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index 739492c7a3fd..91d2c46c0a3e 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -154,8 +154,6 @@ const struct file_operations jfs_file_operations = {
 	.read_iter	= generic_file_read_iter,
 	.write_iter	= generic_file_write_iter,
 	.mmap		= generic_file_mmap,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.fsync		= jfs_fsync,
 	.release	= jfs_release,
 	.unlocked_ioctl = jfs_ioctl,
diff --git a/fs/minix/file.c b/fs/minix/file.c
index a6a4797aa0d4..340bbe384985 100644
--- a/fs/minix/file.c
+++ b/fs/minix/file.c
@@ -18,7 +18,6 @@ const struct file_operations minix_file_operations = {
 	.write_iter	= generic_file_write_iter,
 	.mmap		= generic_file_mmap,
 	.fsync		= generic_file_fsync,
-	.splice_read	= generic_file_splice_read,
 };
 
 static int minix_setattr(struct dentry *dentry, struct iattr *attr)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 5713eb32a45e..e262b0b4f03c 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -852,8 +852,6 @@ const struct file_operations nfs_file_operations = {
 	.fsync		= nfs_file_fsync,
 	.lock		= nfs_lock,
 	.flock		= nfs_flock,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.check_flags	= nfs_check_flags,
 	.setlease	= simple_nosetlease,
 };
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 0efba77789b9..91688552295c 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -248,8 +248,6 @@ const struct file_operations nfs4_file_operations = {
 	.fsync		= nfs_file_fsync,
 	.lock		= nfs_lock,
 	.flock		= nfs_flock,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.check_flags	= nfs_check_flags,
 	.setlease	= simple_nosetlease,
 #ifdef CONFIG_NFS_V4_2
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 26780d53a6f9..c780ce2bdf47 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3579,7 +3579,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
 	if (read->rd_tmp_file)
 		ra = nfsd_init_raparms(file);
 
-	if (file->f_op->splice_read &&
+	if ((file->f_op->read_iter || file->f_op->splice_read) &&
 	    test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags))
 		nfserr = nfsd4_encode_splice_read(resp, read, file, maxcount);
 	else
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 0d19ab1b9404..c23b3adbcff2 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1032,7 +1032,8 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp,
 
 	trace_read_opened(rqstp, fhp, offset, vlen);
 
-	if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &rqstp->rq_flags))
+	if ((file->f_op->read_iter || file->f_op->splice_read) &&
+	    test_bit(RQ_SPLICE_OK, &rqstp->rq_flags))
 		err = nfsd_splice_read(rqstp, file, offset, count);
 	else
 		err = nfsd_readv(file, offset, vec, vlen, count);
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c
index c5fa3dee72fc..e9a5507f9e70 100644
--- a/fs/nilfs2/file.c
+++ b/fs/nilfs2/file.c
@@ -149,7 +149,6 @@ const struct file_operations nilfs_file_operations = {
 	.open		= generic_file_open,
 	/* .release	= nilfs_release_file, */
 	.fsync		= nilfs_sync_file,
-	.splice_read	= generic_file_splice_read,
 };
 
 const struct inode_operations nilfs_file_inode_operations = {
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index c4f68c338735..3f842b9d7c67 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -2026,7 +2026,6 @@ const struct file_operations ntfs_file_ops = {
 #endif /* NTFS_RW */
 	.mmap		= generic_file_mmap,
 	.open		= ntfs_file_open,
-	.splice_read	= generic_file_splice_read,
 };
 
 const struct inode_operations ntfs_file_inode_ops = {
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index bfeb647459d9..a0cdb8bfdf32 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2531,8 +2531,6 @@ const struct file_operations ocfs2_fops = {
 #endif
 	.lock		= ocfs2_lock,
 	.flock		= ocfs2_flock,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.fallocate	= ocfs2_fallocate,
 	.clone_file_range = ocfs2_file_clone_range,
 	.dedupe_file_range = ocfs2_file_dedupe_range,
@@ -2578,8 +2576,6 @@ const struct file_operations ocfs2_fops_no_plocks = {
 	.compat_ioctl   = ocfs2_compat_ioctl,
 #endif
 	.flock		= ocfs2_flock,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.fallocate	= ocfs2_fallocate,
 	.clone_file_range = ocfs2_file_clone_range,
 	.dedupe_file_range = ocfs2_file_dedupe_range,
diff --git a/fs/omfs/file.c b/fs/omfs/file.c
index bf83e6644333..b67118bf1275 100644
--- a/fs/omfs/file.c
+++ b/fs/omfs/file.c
@@ -341,7 +341,6 @@ const struct file_operations omfs_file_operations = {
 	.write_iter = generic_file_write_iter,
 	.mmap = generic_file_mmap,
 	.fsync = generic_file_fsync,
-	.splice_read = generic_file_splice_read,
 };
 
 static int omfs_setattr(struct dentry *dentry, struct iattr *attr)
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c
index 12af0490322f..6c74136579d6 100644
--- a/fs/ramfs/file-mmu.c
+++ b/fs/ramfs/file-mmu.c
@@ -43,8 +43,6 @@ const struct file_operations ramfs_file_operations = {
 	.write_iter	= generic_file_write_iter,
 	.mmap		= generic_file_mmap,
 	.fsync		= noop_fsync,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.llseek		= generic_file_llseek,
 	.get_unmapped_area	= ramfs_mmu_get_unmapped_area,
 };
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 2ef7ce75c062..59cdce5bb7f7 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -47,8 +47,6 @@ const struct file_operations ramfs_file_operations = {
 	.read_iter		= generic_file_read_iter,
 	.write_iter		= generic_file_write_iter,
 	.fsync			= noop_fsync,
-	.splice_read		= generic_file_splice_read,
-	.splice_write		= iter_file_splice_write,
 	.llseek			= generic_file_llseek,
 };
 
diff --git a/fs/read_write.c b/fs/read_write.c
index acfd3dc63d57..3d76e5bff62d 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -28,7 +28,6 @@ const struct file_operations generic_ro_fops = {
 	.llseek		= generic_file_llseek,
 	.read_iter	= generic_file_read_iter,
 	.mmap		= generic_file_readonly_mmap,
-	.splice_read	= generic_file_splice_read,
 };
 
 EXPORT_SYMBOL(generic_ro_fops);
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index b396eb09f288..86dd17fced0b 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -253,8 +253,6 @@ const struct file_operations reiserfs_file_operations = {
 	.fsync = reiserfs_sync_file,
 	.read_iter = generic_file_read_iter,
 	.write_iter = generic_file_write_iter,
-	.splice_read = generic_file_splice_read,
-	.splice_write = iter_file_splice_write,
 	.llseek = generic_file_llseek,
 };
 
diff --git a/fs/romfs/mmap-nommu.c b/fs/romfs/mmap-nommu.c
index 1118a0dc6b45..3eb5014068dc 100644
--- a/fs/romfs/mmap-nommu.c
+++ b/fs/romfs/mmap-nommu.c
@@ -82,7 +82,6 @@ static unsigned romfs_mmap_capabilities(struct file *file)
 const struct file_operations romfs_ro_fops = {
 	.llseek			= generic_file_llseek,
 	.read_iter		= generic_file_read_iter,
-	.splice_read		= generic_file_splice_read,
 	.mmap			= romfs_mmap,
 	.get_unmapped_area	= romfs_get_unmapped_area,
 	.mmap_capabilities	= romfs_mmap_capabilities,
diff --git a/fs/splice.c b/fs/splice.c
index ae41201d0325..ecf8d6edbb30 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -280,7 +280,7 @@ void splice_shrink_spd(struct splice_pipe_desc *spd)
 }
 
 /**
- * generic_file_splice_read - splice data from file to a pipe
+ * iter_file_splice_read - splice data from file to a pipe
  * @in:		file to splice from
  * @ppos:	position in @in
  * @pipe:	pipe to splice to
@@ -292,7 +292,7 @@ void splice_shrink_spd(struct splice_pipe_desc *spd)
  *    used as long as it has more or less sane ->read_iter().
  *
  */
-ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
+static ssize_t iter_file_splice_read(struct file *in, loff_t *ppos,
 				 struct pipe_inode_info *pipe, size_t len,
 				 unsigned int flags)
 {
@@ -322,7 +322,6 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
 
 	return ret;
 }
-EXPORT_SYMBOL(generic_file_splice_read);
 
 const struct pipe_buf_operations default_pipe_buf_ops = {
 	.can_merge = 0,
@@ -861,6 +860,8 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
 
 	if (out->f_op->splice_write)
 		splice_write = out->f_op->splice_write;
+	else if (out->f_op->write_iter)
+		splice_write = iter_file_splice_write;
 	else
 		splice_write = default_file_splice_write;
 
@@ -890,6 +891,8 @@ static long do_splice_to(struct file *in, loff_t *ppos,
 
 	if (in->f_op->splice_read)
 		splice_read = in->f_op->splice_read;
+	else if (in->f_op->read_iter)
+		splice_read = iter_file_splice_read;
 	else
 		splice_read = default_file_splice_read;
 
diff --git a/fs/sysv/file.c b/fs/sysv/file.c
index 7ba997e31aeb..74a63fb0461e 100644
--- a/fs/sysv/file.c
+++ b/fs/sysv/file.c
@@ -25,7 +25,6 @@ const struct file_operations sysv_file_operations = {
 	.write_iter	= generic_file_write_iter,
 	.mmap		= generic_file_mmap,
 	.fsync		= generic_file_fsync,
-	.splice_read	= generic_file_splice_read,
 };
 
 static int sysv_setattr(struct dentry *dentry, struct iattr *attr)
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 2cda3d67e2d0..ba349d17cf15 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1748,8 +1748,6 @@ const struct file_operations ubifs_file_operations = {
 	.mmap           = ubifs_file_mmap,
 	.fsync          = ubifs_fsync,
 	.unlocked_ioctl = ubifs_ioctl,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.open		= ubifs_file_open,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl   = ubifs_compat_ioctl,
diff --git a/fs/udf/file.c b/fs/udf/file.c
index f5eb2d5b3bac..8eede44475be 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -244,7 +244,6 @@ const struct file_operations udf_file_operations = {
 	.write_iter		= udf_file_write_iter,
 	.release		= udf_release_file,
 	.fsync			= generic_file_fsync,
-	.splice_read		= generic_file_splice_read,
 	.llseek			= generic_file_llseek,
 };
 
diff --git a/fs/ufs/file.c b/fs/ufs/file.c
index 042ddbf110cc..28c45f4f2aae 100644
--- a/fs/ufs/file.c
+++ b/fs/ufs/file.c
@@ -40,5 +40,4 @@ const struct file_operations ufs_file_operations = {
 	.mmap		= generic_file_mmap,
 	.open           = generic_file_open,
 	.fsync		= generic_file_fsync,
-	.splice_read	= generic_file_splice_read,
 };
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 35703a801372..328d16bdfedb 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1520,8 +1520,6 @@ const struct file_operations xfs_file_operations = {
 	.llseek		= xfs_file_llseek,
 	.read_iter	= xfs_file_read_iter,
 	.write_iter	= xfs_file_write_iter,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.unlocked_ioctl	= xfs_file_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= xfs_file_compat_ioctl,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c67f1f8ee789..17955f196ad5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2802,8 +2802,6 @@ extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
 extern void block_sync_page(struct page *page);
 
 /* fs/splice.c */
-extern ssize_t generic_file_splice_read(struct file *, loff_t *,
-		struct pipe_inode_info *, size_t, unsigned int);
 extern ssize_t iter_file_splice_write(struct pipe_inode_info *,
 		struct file *, loff_t *, size_t, unsigned int);
 extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
diff --git a/mm/shmem.c b/mm/shmem.c
index e67d6ba4e98e..ba37addf6c87 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3843,8 +3843,6 @@ static const struct file_operations shmem_file_operations = {
 	.read_iter	= shmem_file_read_iter,
 	.write_iter	= generic_file_write_iter,
 	.fsync		= noop_fsync,
-	.splice_read	= generic_file_splice_read,
-	.splice_write	= iter_file_splice_write,
 	.fallocate	= shmem_fallocate,
 #endif
 };
-- 
2.11.0




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux