Wishful thinking
Wishful thinking
Posted Mar 16, 2009 3:39 UTC (Mon) by bojan (subscriber, #14302)Parent article: Garrett: ext4, application expectations and power management
> It's simple. open(),write(),close(),rename() and open(),write(),fsync(),close(),rename(), are not semantically equivalent. One is "give me either the original data or the new data"[2]. The other is "always give me the new data". This is an important distinction. fsync() means that we've sent the data to the disk[3]. And, in general, that means that we've had to spin the disk up.
Yeah, it would be nice if the semantics of rename were defined that way, wouldn't it? Alas, they are not.
I vote for having rename2(), which would do exactly that. Easy to detect in configure, so if the system has it, use it. Otherwise, fsync() and then rename().
