Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Application questions and support => Topic started by: orange on September 30, 2011, 02:18:35 PM

Title: flush buffers to disk
Post by: orange on September 30, 2011, 02:18:35 PM
um, perhaps i already asked this one but can't remember the answer..
how do you make sure buffers have been written to disk before using reset or poweroff?
(with pfs3 filesystem, if that matters)
Title: Re: flush buffers to disk
Post by: olsen on October 02, 2011, 11:51:07 AM
Quote from: orange;661975
um, perhaps i already asked this one but can't remember the answer..
how do you make sure buffers have been written to disk before using reset or poweroff?
(with pfs3 filesystem, if that matters)


Unless you want to write a short program to do the job (either send an ACTION_FLUSH packet to the file system, followed by a CMD_UPDATE command to the underlying disk driver, or just send an ACTION_INHIBIT packet to the file system), the straightforward approach is to wait a little bit.

All Amiga file systems which work on removable writable media are supposed to flush all "dirty buffers" to the disk as soon as possible. This operation may be delayed if the file system still has more important work to be done. For example, while you are still reading data from a file, the file system may wait until that operation has concluded before it flushes unwritten data to disk. The original Amiga file system used to wait for about five seconds for all disk read/write activity to conclude before it would begin mopping up after the write access. During this time the floppy LED would stay lit, and once the drive light went out, it was generally safe to remove the disk. A similar timeout was used by the FFS.

That's the long and short of it: wait :)