Re: fsync in glib/gio


On Fri, 2009-03-13 at 08:38 +0100, Alexander Larsson wrote:

> If you want to you can make all i/o sync by mounting it as such. But
> thats of course really slow. Generally the gio file write operations are
> used for saving files, and people sort of expect that when save returns
> the file is ok on disk. 

Do they?? Doing file I/O asynchronously is a feature, in particular for
laptop users. It improves I/O performance and it saves power. Of course
it's a risk and may result in data loss under certain rare
circumstances. But it's a risk that people are willing to take. Please
do not ruin this by implicitly enforcing fsync.

IMO the correct way to deal with this would be to add a flag that allows
application developers that deal with important data to request
synchronous I/O in he gio file saving code and in g_file_set_contents().
So instead of defaulting to this and adding a G_FILE_CREATE_ASYNC_WRITE
flag, we could keep the default behavior and add


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]