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

From: Andreas Dilger
Date: Thu Sep 10 2009 - 19:08:43 EST


On Sep 10, 2009 22:25 +0200, Christoph Hellwig wrote:
> +/*
> + * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using
> + * the O_SYNC flag. We continue to use the existing numerical value
> + * for O_DSYNC semantics now, but using the correct symbolic name for it.
> + * This new value is used to request true Posix O_SYNC semantics. It is
> + * defined in this strange way to make sure applications compiled against
> + * new headers get at least O_DSYNC semantics on older kernels.
> + *
> + * This has the nice side-effect that we can simply test for O_DSYNC
> + * wherever we do not care if O_DSYNC or O_SYNC is used.
> +
> + * 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").

> 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...

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/