[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250319001521.53249-3-jdamato@fastly.com>
Date: Wed, 19 Mar 2025 00:15:13 +0000
From: Joe Damato <jdamato@...tly.com>
To: netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
asml.silence@...il.com,
linux-fsdevel@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
horms@...nel.org,
linux-api@...r.kernel.org,
linux-arch@...r.kernel.org,
viro@...iv.linux.org.uk,
jack@...e.cz,
kuba@...nel.org,
shuah@...nel.org,
sdf@...ichev.me,
mingo@...hat.com,
arnd@...db.de,
brauner@...nel.org,
akpm@...ux-foundation.org,
tglx@...utronix.de,
jolsa@...nel.org,
linux-kselftest@...r.kernel.org,
Joe Damato <jdamato@...tly.com>
Subject: [RFC -next 02/10] splice: Add helper that passes through splice_desc
Add do_splice_from_sd which takes splice_desc as an argument. This
helper is just a wrapper around splice_write but will be extended. Use
the helper from existing splice code.
Signed-off-by: Joe Damato <jdamato@...tly.com>
---
fs/splice.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/fs/splice.c b/fs/splice.c
index 2898fa1e9e63..9575074a1296 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -941,6 +941,15 @@ static ssize_t do_splice_from(struct pipe_inode_info *pipe, struct file *out,
return out->f_op->splice_write(pipe, out, ppos, len, flags);
}
+static ssize_t do_splice_from_sd(struct pipe_inode_info *pipe, struct file *out,
+ struct splice_desc *sd)
+{
+ if (unlikely(!out->f_op->splice_write))
+ return warn_unsupported(out, "write");
+ return out->f_op->splice_write(pipe, out, sd->opos, sd->total_len,
+ sd->flags);
+}
+
/*
* Indicate to the caller that there was a premature EOF when reading from the
* source and the caller didn't indicate they would be sending more data after
@@ -1161,7 +1170,7 @@ static int direct_splice_actor(struct pipe_inode_info *pipe,
long ret;
file_start_write(file);
- ret = do_splice_from(pipe, file, sd->opos, sd->total_len, sd->flags);
+ ret = do_splice_from_sd(pipe, file, sd);
file_end_write(file);
return ret;
}
@@ -1171,7 +1180,7 @@ static int splice_file_range_actor(struct pipe_inode_info *pipe,
{
struct file *file = sd->u.file;
- return do_splice_from(pipe, file, sd->opos, sd->total_len, sd->flags);
+ return do_splice_from_sd(pipe, file, sd);
}
static void direct_file_splice_eof(struct splice_desc *sd)
--
2.43.0
Powered by blists - more mailing lists