Re: adding proper O_SYNC/O_DSYNC, was Re: O_DIRECT and barriers
From: Christoph Hellwig
Date: Fri Aug 28 2009 - 12:41:19 EST
On Fri, Aug 28, 2009 at 09:33:29AM -0700, Ulrich Drepper wrote:
> On 08/28/2009 09:17 AM, Christoph Hellwig wrote:
>> I'll put it on my todo list.
>
> Any ABI change like this takes a long time to trickle down.
>
> If this is agreed to be the correct approach then adding the O_*
> definitions earlier is better. Even if it isn't yet implemented. Then,
> once the kernel side is implemented, programs are ready to use it. I
> cannot jump the gun and define the flags myself first.
Yeah. The implementation really is trivial in 2.6.32 - we basically
just need to change one function to check the new O_REALLY_SYNC flag
and pass down a 0 instead of a 1 to another routine in the generic
fs code, plus doing the same in a few filesystems opencoding it instead
of using the generic helpers.
So the logistics of doing the flags really is the biggest work here.
And I'm not entirely sure how to do it correctly. Can we just switch
the current O_SYNC defintion in the kernel headers to O_DSYNC while
adding the new O_SYNC and everything will continue to work?
>> - O_RSYNC basically means we need to commit atime updates before a
>> read returns, right?
>
> No, that's not it.
>
> O_RSYNC on its own just means the data is successfully transferred to
> the calling process (always the case).
>
> O_RSYNC|O_DSYNC means that if a read request hits data that is currently
> in a cache and not yet on the medium, then the write to medium is
> successful before the read succeeds.
That includes a write from another process? So O_RSYNC basically means
doing an range-fdatasync before the actual read request?
Again, we could implement this easily if we care enough.
--
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/