Welcome, Guest. Please login or register.

Author Topic: flush buffers to disk  (Read 2454 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline orangeTopic starter

  • Hero Member
  • *****
  • Join Date: Dec 2003
  • Posts: 2794
    • Show only replies by 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 :)