Garrett: ext4, application expectations and power management
Posted Mar 15, 2009 19:00 UTC (Sun) by kasperd
In reply to: Garrett: ext4, application expectations and power management
Parent article: Garrett: ext4, application expectations and power management
But renaming files should always have an fsync in it.. shouldn' it. I mean thats a point where you WANT the new data not the old data.
No, even at that point it might not be important to get the new data to disk right away. But it is still important to get either the old or the new data. However ext4 leaves the disk contents with something that didn't exist at any point during the changes the process made, this is because ext4 did the rename before writing the data.
The problem is, that there exist no API that guarantee exactly the level of integrity needed in many cases. You used to be able to create a file and then rename it on top of an existing file to get what you wanted. The change forced you to sync to get the guarantee that you needed, but it gave you more than you wanted and was slower because of that.
So there are three possibilities:
- You want to get the new data on disk as quickly as possible and wait for it to get there.
- You want some good data on disk either the old or the new, but you don't care which you get in case the system crashes in the next minute or so, as long as it doesn't take too long for the data to make it to disk.
- You don't care about the data at all, it is perfectly fine for it to get lost or corrupted.
I'd say 3 is unlikely to be desired by many applications, why would you be writing the file in the first place if you didn't care about the data? But right now there is no API to give you 2, the one that used to give you that now give you 3.
to post comments)