Subject: Re: Extension of fsync_range() to permit forcing disk cache flushing
To: None <>
From: J Chapman Flack <>
List: tech-kern
Date: 12/16/2004 15:40:19
Bill Studenmund writes:
> I have an application that wants to be able to know that certain writes 
> have been forced to permanent storage - that they aren't still sitting in 
> the disk's write cache. This idea is similar to the current thread about 
> After discussing this with some developers, the best solution seems to be 
> to add a flag to fsync_range() to force this behavior. Then pass a flag

What would be the performance hit in making this the /default/
behavior of fsync and fsync_range?  I ask only because I strongly
suspect that many programmers who have used these functions in their code
have done so on the belief that they do this already - a quite reasonable
belief when the man page says "causes all modified data ... to be written
to permanent storage."  It seems more conservative to make sure that code
programmers have written expecting it to be safe actually is, than to add
a flag they can edit back into their code if they really meant to say
what they thought they were already saying.  The inverse flag - "send this
as far as the disk buffer but don't sweat the cache flush" - could then be
used with deliberation by those who really understand the implications
and are willing to accept them (though I'm not completely sure what the
point of such an operation would be - it takes longer than doing nothing,
but still gives you no assurance the bits are on disk).