4 ms·
Because that is not portable and/or has performance problems. I'm not kidding you. I know the conventional wisdom is that a rename is enough. It is not. Depend
by FooBarWidget 10y ago
Because that is not portable and/or has performance problems.
I'm not kidding you. I know the conventional wisdom is that a rename is enough. It is not. Depending on the filesystem, you may have to fsync() the directory entry too, or fsync the parent directory entry too. Or on other filesystems, don't do these because doing these may cause problems. And do all this in the right order, because if you get it slightly wrong then it doesn't do what you want in the event of a crash.
The problem is maddening. There is an article out there that explains all this in much more detail. I think it is this one but I don't quite remember whether it is the same as the one I read: http://blog.httrack.com/blog/2013/11/15/everything-you-always-wanted-to-know-about-fsync/ http://blog.httrack.com/blog/2013/11/15/everything-you-alway...
The performance problem comes from the fact that you need two fscyncs.