aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/read_write.c26
-rw-r--r--include/linux/fs.h3
2 files changed, 12 insertions, 17 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 2527cf035b0e..507ddff48a9a 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -724,8 +724,7 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
724 in_inode = in_file->f_path.dentry->d_inode; 724 in_inode = in_file->f_path.dentry->d_inode;
725 if (!in_inode) 725 if (!in_inode)
726 goto fput_in; 726 goto fput_in;
727 if (!in_file->f_op || (!in_file->f_op->sendfile && 727 if (!in_file->f_op || !in_file->f_op->splice_read)
728 !in_file->f_op->splice_read))
729 goto fput_in; 728 goto fput_in;
730 retval = -ESPIPE; 729 retval = -ESPIPE;
731 if (!ppos) 730 if (!ppos)
@@ -778,21 +777,18 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
778 count = max - pos; 777 count = max - pos;
779 } 778 }
780 779
781 if (in_file->f_op->splice_read) { 780 fl = 0;
782 fl = 0;
783#if 0 781#if 0
784 /* 782 /*
785 * We need to debate whether we can enable this or not. The 783 * We need to debate whether we can enable this or not. The
786 * man page documents EAGAIN return for the output at least, 784 * man page documents EAGAIN return for the output at least,
787 * and the application is arguably buggy if it doesn't expect 785 * and the application is arguably buggy if it doesn't expect
788 * EAGAIN on a non-blocking file descriptor. 786 * EAGAIN on a non-blocking file descriptor.
789 */ 787 */
790 if (in_file->f_flags & O_NONBLOCK) 788 if (in_file->f_flags & O_NONBLOCK)
791 fl = SPLICE_F_NONBLOCK; 789 fl = SPLICE_F_NONBLOCK;
792#endif 790#endif
793 retval = do_splice_direct(in_file, ppos, out_file, count, fl); 791 retval = do_splice_direct(in_file, ppos, out_file, count, fl);
794 } else
795 retval = in_file->f_op->sendfile(in_file, ppos, count, file_send_actor, out_file);
796 792
797 if (retval > 0) { 793 if (retval > 0) {
798 add_rchar(current, retval); 794 add_rchar(current, retval);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 894620e9402c..4f0b3bf5983c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1054,7 +1054,7 @@ struct block_device_operations {
1054}; 1054};
1055 1055
1056/* 1056/*
1057 * "descriptor" for what we're up to with a read for sendfile(). 1057 * "descriptor" for what we're up to with a read.
1058 * This allows us to use the same read code yet 1058 * This allows us to use the same read code yet
1059 * have multiple different users of the data that 1059 * have multiple different users of the data that
1060 * we read from a file. 1060 * we read from a file.
@@ -1105,7 +1105,6 @@ struct file_operations {
1105 int (*aio_fsync) (struct kiocb *, int datasync); 1105 int (*aio_fsync) (struct kiocb *, int datasync);
1106 int (*fasync) (int, struct file *, int); 1106 int (*fasync) (int, struct file *, int);
1107 int (*lock) (struct file *, int, struct file_lock *); 1107 int (*lock) (struct file *, int, struct file_lock *);
1108 ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);
1109 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); 1108 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
1110 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); 1109 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
1111 int (*check_flags)(int); 1110 int (*check_flags)(int);