lkml.org 
[lkml]   [2009]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: 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


    \
     
     \ /
      Last update: 2009-08-30 19:51    [W:3.547 / U:0.340 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site