public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] splice: direct call for default_file_splice*()
Date: Thu, 30 Jan 2020 08:54:25 -0800	[thread overview]
Message-ID: <20200130165425.GA8872@infradead.org> (raw)
In-Reply-To: <12375b7baa741f0596d54eafc6b1cfd2489dd65a.1579553271.git.asml.silence@gmail.com>

On Mon, Jan 20, 2020 at 11:49:46PM +0300, Pavel Begunkov wrote:
> Indirect calls could be very expensive nowadays, so try to use direct calls
> whenever possible.

... and independent of that your new version is much shorter and easier
to read.  But it could be improved a tiny little bit further:

>  	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);

No need for the else after an return.

>  	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);

Same here.

  reply	other threads:[~2020-01-30 16:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-20 20:49 [PATCH] splice: direct call for default_file_splice*() Pavel Begunkov
2020-01-30 16:54 ` Christoph Hellwig [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200130165425.GA8872@infradead.org \
    --to=hch@infradead.org \
    --cc=asml.silence@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox