Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Iridium Banner AMIStore App Store A1200/A600 4xIDE Interface

AuthorTopic: flush buffers to disk  (Read 1291 times)

0 Members and 1 Guest are viewing this topic.

Offline orange

flush buffers to disk
« 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)
Better sorry than worry.
 

Offline olsen

Re: flush buffers to disk
« Reply #1 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 :)