> > Then, no matter which one of the above two situations happens, the data is > > not yet written to the physical storage at that time, right? Should I need > > to call fsync() each time after calling write()? Thanks a lot! > > Yes, at each point where you want to ensure the data is written (not > necessarily after each write). > > fsync() (and also fdatasync()?) will cause the local kernel to write any > modified pages, and for smbfs it also sends a "SMBflush" that tells the > other end to sync it to disk. > > For mmap()'ed data you can use msync(). > > Haven't tested if open(..., O_SYNC) works. > > /Urban
Thanks for your reply. How about to disable the local kernel cache if the local system is running in the RAM disk so that we may have more memory to use and no need to worry about all of this? Regards, Kevin