linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Matthew Wilcox <willy@infradead.org>
Cc: Max Kellermann <max.kellermann@gmail.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] pipe_fs_i.h: add pipe_buf_init()
Date: Sun, 13 Mar 2022 04:34:33 +0000	[thread overview]
Message-ID: <Yi10WZi2TfyvClaG@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <Yi1bakVfs/l6CNE0@casper.infradead.org>

On Sun, Mar 13, 2022 at 02:48:10AM +0000, Matthew Wilcox wrote:

> That's not equivalent.  I think the better option here is to always
> initialise flags to 0 (and not have a parameter for it):
> 
> 			pipe_buf_init(buf, page, 0, 0, &anon_pipe_buf_ops);
> 			if (is_packetized(filp))
> 				buf->flags = PIPE_BUF_FLAG_PACKET;
> 			else
> 				buf->flags = PIPE_BUF_FLAG_CAN_MERGE;

Not equivalent in which sense?  IDGI...  Your variant is basically

	X = 0;
	if (Y == constant)
		X = 1;
	else
		X = 2;

If gcc can optimize that to 

	X = (Y == constant) ? 1 : 2;

it should be able to do the same to
	X = 1;
	if (Y != constant)
		X = 2;

	What obstacles are there, besides a (false) assumption that
X might alias Y?  Which would apply to both variants...  Granted, I'm
half-asleep right now, so I might be missing something obvious...

  reply	other threads:[~2022-03-13  4:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-25 18:54 [PATCH 1/4] include/pipe_fs_i.h: add missing #includes Max Kellermann
2022-02-25 18:54 ` [PATCH 2/4] fs/pipe: remove duplicate "offset" initializer Max Kellermann
2022-02-25 18:54 ` [PATCH 3/4] fs/pipe: remove unnecessary "buf" initializer Max Kellermann
2022-02-25 18:54 ` [PATCH 4/4] pipe_fs_i.h: add pipe_buf_init() Max Kellermann
2022-03-13  2:37   ` Al Viro
2022-03-13  2:48     ` Matthew Wilcox
2022-03-13  4:34       ` Al Viro [this message]
2022-03-13  6:47     ` Max Kellermann
2022-03-13  1:49 ` [PATCH 1/4] include/pipe_fs_i.h: add missing #includes Al Viro
2022-03-13  6:45   ` Max Kellermann

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=Yi10WZi2TfyvClaG@zeniv-ca.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.kellermann@gmail.com \
    --cc=willy@infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).