create()

Fairlight fairlite at fairlite.com
Fri Aug 30 18:50:34 PDT 2013


On Thu, Aug 29, 2013 at 09:50:53AM -0500, Mike Schwartz thus spoke:
>      Dating back to the 1980's I've had problems with hard drives and
>      hard drive controllers not completing file writes before I needed
>      to open a file.  Most likely this is due to caching problems in the
>      drive and controller firmware.  So, just closing the file doesn't
>      guarantee that it will be immediately ready to be opened.

That makes little sense as an explanation.  Here's how it goes...

High-level 4GL Language:  close()
     generally translates to:
Low-level C:  fflush(), followed by close()

Data -should- get flushed prior to close().

Once the data is flushed, the VFS layer has it, and hands it to the FS
driver.  Even if there's caching, it -should- (in a sane system) be FIFO
caching; operations take place in the same order they're requested.

Ergo, close() followed immediately by open() should always result in the
file descriptor pointing to a file with the full contents from the time of
flush/close.

If you're going to put -anything- in there, it makes sense to put:

system "sync"

...instead of sleep().  At least it would flush the disk cache pending
write operations, rather than just guessing.

But it -shouldn't- be necessary, if things are written properly.

mark->
-- 
Audio panton, cogito singularis.


More information about the Filepro-list mailing list