@@ -16,6 +16,7 @@
#include <linux/export.h>
#include <linux/syscalls.h>
#include <linux/pagemap.h>
+#include <linux/sendfile.h>
#include <linux/splice.h>
#include <linux/compat.h>
#include <linux/mount.h>
@@ -1360,6 +1361,10 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
retval = rw_verify_area(WRITE, fd_file(out), &out_pos, count);
if (retval < 0)
return retval;
+
+ if (flags & SENDFILE_ZC)
+ fl |= SPLICE_F_ZC;
+
retval = do_splice_direct(fd_file(in), &pos, fd_file(out), &out_pos,
count, fl);
} else {
new file mode 100644
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef SENDFILE_H
+#define SENDFILE_H
+
+#define SENDFILE_DEFAULT (0x1) /* normal sendfile */
+#define SENDFILE_ZC (0x2) /* sendfile which generates ZC notifications */
+
+#define SENDFILE_ALL (SENDFILE_DEFAULT|SENDFILE_ZC)
+
+#endif
Add a default flag (SENDFILE_DEFAULT) and a flag for requesting zerocopy notifications (SENDFILE_ZC). do_sendfile is updated to pass through the corresponding splice flag to enable zerocopy notifications. Signed-off-by: Joe Damato <jdamato@fastly.com> --- fs/read_write.c | 5 +++++ include/linux/sendfile.h | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 include/linux/sendfile.h