[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090830174852.GF7129@shareable.org>
Date: Sun, 30 Aug 2009 18:48:52 +0100
From: Jamie Lokier <jamie@...reable.org>
To: Ulrich Drepper <drepper@...hat.com>
Cc: Christoph Hellwig <hch@...radead.org>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: adding proper O_SYNC/O_DSYNC, was Re: O_DIRECT and barriers
Ulrich Drepper wrote:
> On 08/28/2009 09:44 AM, Jamie Lokier wrote:
> >Although libc's __new_open() could have this:
> >
> > /* Old kernels only look at O_DSYNC. It's better than nothing. */
> > if (flags& O_SYNC)
> > flags |= O_DSYNC;
> >
> >Imho, it's better to not do that, and instead have
> >
> > #define O_SYNC (O_DSYNC|__O_SYNC_KERNEL)
>
> Why should it be better? You're replacing something the compiler can do
> with zero cost with active code.
You misread; I said the zero cost thing is better.
The only reason you might use the active code is this:
/* Upgrade O_DSYNC to O_SYNC. */
flags = fcntl(fd, F_GETFL, 0);
flags = (flags | O_SYNC) & ~O_DSYNC;
fcntl(fd, F_SETFL, flags);
I'm not sure if that should work in POSIX.
-- Jamie
--
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