Wishful thinking
Wishful thinking
Posted Mar 16, 2009 21:57 UTC (Mon) by quotemstr (subscriber, #45331)In reply to: Wishful thinking by bojan
Parent article: Garrett: ext4, application expectations and power management
Yes, the kernel has the freedom to do what's appropriate, but uses that freedom to do mind-numbingly stupid things.
You're grasping at straws. First of all, you're most likely never going to see gigabytes of dirty blocks for a single file. They'll have been flushed well before your rename! Second, even if we do end up in your scenario, that file's blocks will be flushed in very short order anyway, so you're going to incur the penalty for that IO whether you do it before or after the rename.
As for the case of immediately unlinking the file --- that's a rather unlikely scenario. Can you give me one non-contrived real-life example where this would actually happen?
Remember:
- You have a large temporary file with many unflushed data blocks
- This temporary file has just been renamed
- This temporary file is about to be unlinked
- Between the rename of the large temporary file and its unlinking, fsync must be called on the directory
