[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <B92AEADD-B22C-4A4A-B64D-96E8869D3282@cam.ac.uk>
Date: Fri, 7 Nov 2014 08:43:00 +0200
From: Anton Altaparmakov <aia21@....ac.uk>
To: Anand Avati <avati@...ster.org>
Cc: Jeff Moyer <jmoyer@...hat.com>, linux-arch@...r.kernel.org,
linux-aio@...ck.org, linux-nfs@...r.kernel.org,
Volker Lendecke <Volker.Lendecke@...net.de>,
Theodore Ts'o <tytso@....edu>, linux-mm@...ck.org,
"fuse-devel@...ts.sourceforge.net" <fuse-devel@...ts.sourceforge.net>,
linux-api@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Christoph Hellwig <hch@...radead.org>,
Tejun Heo <tj@...nel.org>, Milosz Tanski <milosz@...in.com>,
linux-fsdevel@...r.kernel.org,
Michael Kerrisk <mtk.manpages@...il.com>,
ceph-devel@...r.kernel.org, Christoph Hellwig <hch@....de>,
ocfs2-devel@....oracle.com, Mel Gorman <mgorman@...e.de>
Subject: Re: [fuse-devel] [PATCH v5 7/7] add a flag for per-operation O_DSYNC semantics
Hi,
> On 7 Nov 2014, at 07:52, Anand Avati <avati@...ster.org> wrote:
> On Thu, Nov 6, 2014 at 8:22 PM, Anton Altaparmakov <aia21@....ac.uk> wrote:
> > On 7 Nov 2014, at 01:46, Jeff Moyer <jmoyer@...hat.com> wrote:
> > Minor nit, but I'd rather read something that looks like this:
> >
> > if (type == READ && (flags & RWF_NONBLOCK))
> > return -EAGAIN;
> > else if (type == WRITE && (flags & RWF_DSYNC))
> > return -EINVAL;
>
> But your version is less logically efficient for the case where "type == READ" is true and "flags & RWF_NONBLOCK" is false because your version then has to do the "if (type == WRITE" check before discovering it does not need to take that branch either, whilst the original version does not have to do such a test at all.
>
> Seriously?
Of course seriously.
> Just focus on the code readability/maintainability which makes the code most easily understood/obvious to a new pair of eyes, and leave such micro-optimizations to the compiler..
The original version is more readable (IMO) and this is not a micro-optimization. It is people like you who are responsible for the fact that we need faster and faster computers to cope with the inefficient/poor code being written more and more...
And I really wouldn't hedge my bets on gcc optimizing something like that. The amount of crap assembly produced from gcc that I have seen over the years suggests that it is quite likely it will make a hash of it instead...
Best regards,
Anton
> Thanks
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
University of Cambridge Information Services, Roger Needham Building
7 JJ Thomson Avenue, Cambridge, CB3 0RB, UK
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists