[Interest] QFile copy and sync/fsync

Duane duane.hebert at group-upc.com
Fri Jan 4 14:00:14 CET 2013


On 01/03/2013 04:37 PM, Thiago Macieira wrote:
> On quinta-feira, 3 de janeiro de 2013 23.25.54, Nikos Chantziaras wrote:
>>> That has nothing to do with it. Unbuffered mode means that QFile will not
>>> buffer (and will not use buffered stdio either). Instead, it will use
>>> directly the low-level POSIX API like open(2) and write(2).
>>>
>>> The OS may still buffer.
>>
>> In synchronous mode?  I assume that the usual "cp -a this /mnt/there" is
>> a good test for this.  In synchronous mode, the files are written out
>> immediately.
>
> Synchronous mode is what makes the OS write immediately to disk after
> write(2).
>
> As I said, that's got nothing to do with Unbuffered mode. Since the buffer is
> just 16 kB, it will not make things faster or slower in a file copy.


What I don't understand is that if I mount the USB stick with sync, and 
I have a for loop that copies N files, after the for loop finishes, 
there is a long delay.  I can see from the led on the usb stick that 
this is when the files are being written.  Is this something that the OS 
(in this case Tiny Core Linux) decides to do or is there some way to 
change this behavior in Qt?





More information about the Interest mailing list