Carlos E. R. wrote:
On 2013-06-13 08:02, Roger Oberholtzer wrote:
Linda idea of using "posix_fadvise" and opening the file for write only seems to me a very good one. But she also said "the calls are advisory".
On Thu, 2013-06-13 at 06:24 +0200, Carlos E. R. wrote: posix_fadvise(POSIX_FADV_DONTNEED) seems not to be advisory. It clears info for the specified file from the cache when it is called. So it needs to do this regularly. Which is no problem. I just need to figure out the 'start' and 'stop' parameters.
That it works does not deny being advisory :-)
Maybe it means that it has been implemented and works.
Exactly. Remember that this is a POSIX call. There are many other operating systems than Linux that accept this call. Some of them may not follow the instruction it provides. Hence it is advisory. It is not a requirement on an operating system to obey this instruction in order to conform to POSIX. But apparently Linux does, at least in these circumstances.
By the way, try not to use "fsync". It forces the kernel to write to disk even if not convenient.
I think this is misguided advice. It is very important to use use fsync to ensure that the data makes it onto the disk in order to ensure data or whole files don't disappear. On a rename for example, it is necessary to fsync the directory as well as the file. The point is that application correctness is more important than kernel or filesystem convenience. But clearly, fsync checkpoints should be chosen wisely, on transaction boundaries, perhaps, not on every write. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org