public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* How to flush data to disk reliably?
@ 2005-05-02 13:23 Grzegorz Kulewski
  2005-05-02 17:52 ` Alan Cox
  0 siblings, 1 reply; 6+ messages in thread
From: Grzegorz Kulewski @ 2005-05-02 13:23 UTC (permalink / raw)
  To: linux-kernel

Hi,

I am writing an app that has log files. These log files must be reliably 
and permanently flushed to disk on some points. These log files can be:
a. normal files on some (local) filesytem,
b. some block device (disk/partition).

I am asking how to flush the data from these logs to disk. I know of 
several methods:
1. open with O_SYNC,
2. sync(2),
3. fsync,
4. fdatasync,
5. msync (if they are mmaped).

Which of these are best and most reliable for (a/b) and for (IDE/SCSI)? 
What are differences between them? Maybe some other method? Are there any 
other precautions that I should be aware of? What about write caches? Are 
write barriers implemented (on IDE and SATA/SCSI) or should I turn caches 
off?

I am using Linux 2.6. (But I will be glad to hear about differences 
between 2.4 and 2.6 in this aspect if there are any.)


Thanks in advance,

Grzegorz Kulewski

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-02 23:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-02 13:23 How to flush data to disk reliably? Grzegorz Kulewski
2005-05-02 17:52 ` Alan Cox
2005-05-02 19:18   ` Grzegorz Kulewski
2005-05-02 21:41     ` Alan Cox
2005-05-02 22:30       ` Bill Davidsen
2005-05-02 23:17         ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox