linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] splice: direct call for default_file_splice*()
@ 2020-01-20 20:49 Pavel Begunkov
  2020-01-30 16:54 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Pavel Begunkov @ 2020-01-20 20:49 UTC (permalink / raw)
  To: Alexander Viro, linux-fsdevel, linux-kernel

Indirect calls could be very expensive nowadays, so try to use direct calls
whenever possible.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/splice.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index 6a6f30432688..91448d855ff0 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -852,15 +852,10 @@ EXPORT_SYMBOL(generic_splice_sendpage);
 static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
 			   loff_t *ppos, size_t len, unsigned int flags)
 {
-	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *,
-				loff_t *, size_t, unsigned int);
-
 	if (out->f_op->splice_write)
-		splice_write = out->f_op->splice_write;
+		return out->f_op->splice_write(pipe, out, ppos, len, flags);
 	else
-		splice_write = default_file_splice_write;
-
-	return splice_write(pipe, out, ppos, len, flags);
+		return default_file_splice_write(pipe, out, ppos, len, flags);
 }
 
 /*
@@ -870,8 +865,6 @@ static long do_splice_to(struct file *in, loff_t *ppos,
 			 struct pipe_inode_info *pipe, size_t len,
 			 unsigned int flags)
 {
-	ssize_t (*splice_read)(struct file *, loff_t *,
-			       struct pipe_inode_info *, size_t, unsigned int);
 	int ret;
 
 	if (unlikely(!(in->f_mode & FMODE_READ)))
@@ -885,11 +878,9 @@ static long do_splice_to(struct file *in, loff_t *ppos,
 		len = MAX_RW_COUNT;
 
 	if (in->f_op->splice_read)
-		splice_read = in->f_op->splice_read;
+		return in->f_op->splice_read(in, ppos, pipe, len, flags);
 	else
-		splice_read = default_file_splice_read;
-
-	return splice_read(in, ppos, pipe, len, flags);
+		return default_file_splice_read(in, ppos, pipe, len, flags);
 }
 
 /**
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-08-02  8:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 20:49 [PATCH] splice: direct call for default_file_splice*() Pavel Begunkov
2020-01-30 16:54 ` Christoph Hellwig
2020-01-31  9:52   ` Pavel Begunkov
2020-08-01 10:12   ` Pavel Begunkov
2020-08-01 17:41     ` Christoph Hellwig
2020-08-02  8:49       ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).