Re: [PATCH 18/16] implement posix O_SYNC and O_DSYNC semantics

Christoph Hellwig
2009-09-10T23:18:38Z

On Fri, Sep 11, 2009 at 01:07:55AM +0200, Andreas Dilger wrote:
> > + * Note: __O_SYNC must never be used directly.
>
> Doesn't it make sense that applications that actually know what they are
> doing may want to start using __O_SYNC directly at some point in the
> future? It makes sense to code the kernel to handle both of these flags
> appropriately (i.e. if __O_SYNC is set, but O_DSYNC is not then treat
> this as the proper "O_SYNC").

What would be the benefit of that? Setting two bits vs one in a data
structure is not going to make any difference, and the way it's done in
this patch is actually much easier to implement in the kernel.

> > Index: linux-2.6/arch/alpha/include/asm/fcntl.h
> > ===================================================================
> > --- linux-2.6.orig/arch/alpha/include/asm/fcntl.h 2009-09-10 16:31:47.720004025 -0300
> > +++ linux-2.6/arch/alpha/include/asm/fcntl.h 2009-09-10 16:33:55.087294444 -0300
> > #define O_CLOEXEC 010000000 /* set close_on_exec */
> > +#define __O_SYNC 010000000
>
> These two flags have the same value...

Thanks, corrected.