(Fwd) Re: DOSFS bug fixes, IDE drivers and sample released

Victor V. Vengerov vvv at oktet.ru
Thu Apr 17 07:06:16 UTC 2003


Angelo Fraietta wrote:

>
> I tried fflush (using fopen), without effect. 

fflush() flushes only buffers maintained inside the libc library.

The following quote is from fflush(3) Linux man page:
***
NOTES
       Note that fflush() only flushes the user space buffers provided 
by  the
       C  library.   To  ensure that the data is physically stored on 
disk the
       kernel buffers must be flushed too, e.g. with sync(2) or fsync(2).
***
It completely in sync with newlib fflush() implementation.

I agree, it is reasonable to flush buffers when file closed. People may
expect that data synchronized when file closed. Nevertheless, Linux
man page close(3) declares that:

***
NOTES
       ...
       A  successful  close does not guarantee that the data has been 
success-
       fully saved to disk, as the kernel defers writes. It is not 
common  for
       a  filesystem  to  flush  the buffers when the stream is closed. 
If you
       need to be sure that the data is physically stored use  
fsync(2).   (It
       will depend on the disk hardware at this point.)
***

I don't think that data synchronization on close() contradict to POSIX, but
it impacts on close() performance.

Any opinions?

Victor

-- 
Victor V. Vengerov
OKTET Ltd.
Ulianovskaya st., 1, office 533, St.-Petersburg 198504 Russia
phone: +7 812 4284384 (work), +7 812 9389372 (mobile), +7 812 4281653 (home)






More information about the users mailing list