Re: fsync in glib/gio



From: "Alexander Larsson", Date: 15/03/2009 04:42

>> This thread has focused on the rename() case, often used to have the
>> atomic-change-in-place effect. There are other cases that even your most
>> favourite file system mode may not "protect" you from. Most file systems
>> won't guarantee a write() order to disk, as I listed before.
> We focus on that one because its of increadible important, being the
> historical way that one implements save on unix (witness e.g. gnu sed
> using it for in-place replace), and its a pretty simple common
> operation. If you do all sorts of weird database or mmap operations
> everyone expects that you have to handle these details. Especially,
> nobody ever assumed the filesystem was a database or that it provides
> ACID guarantees. Please don't use such strawman arguments.

Personally, as a regular user of a system that runs slow enough as it is, I'd rather not see sync's going on all the time. The more caching my system does, the better.

I believe I understand the issue, but I think it's something that needs to be fixed elsewhere. Even if I were on a laptop, I'd sure as heck want it fixed in the file system rather than futzing with the caching. I do have a small ext3 partition set to fully-journalled, which I figure is safer from this problem. All my "critical" stuff (including most recent partial archives) is on there. I even leave it unmounted when I don't need it, and the auto-mounter mounts it read-only by default when needed. It's slow, but nice and safe.

In short, there are other methods of dealing with this problem that will hold until this problem is fixed at the source...


Another option, if you guys insist on trying to fix a problem that isn't really yours to begin with, is how about an environment variable to set the sync tendancy... 0,1,2... 0 = don't sync unless the program explicitly does it, 1 = sync on the rename() case, or if the program explicitly requests it, or 2 = sync all the time in case the application hasn't been updated and/or the coder was clueless. The default would be 0, allowing it to be enabled on an as-needed basis only, or thrown into a startup script to work everywhere.


Fredderic
   Nutrition Degree
Why not be a nutritionist? Get your degree fast. Click here!
Click Here For More Information
 


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