Ts'o: Delayed allocation and the zero-length file problem
Ts'o: Delayed allocation and the zero-length file problem
Posted Mar 14, 2009 0:38 UTC (Sat) by drag (guest, #31333)In reply to: Ts'o: Delayed allocation and the zero-length file problem by drag
Parent article: Ts'o: Delayed allocation and the zero-length file problem
I've been reading what has been written and I think I am understanding what is going on better now.
But here is my new thought on the subject:
The reason why they are going:
create file 1
write file 1
.... (time passes)
create file 2
write file 2
rename file 2 over file 1
Is because they are trying to get a 'atomic' instruction, right?
They are making a few assumptions about the file system that:
A. the file system does not operate in atomic operations and thus they have to do this song and dance to do the file system's work for them... (protect their data)
B. that while the file system is going to fail them otherwise, it is still able to do rename in one single operation.
C. That by renaming the file they are actually telling the file to commit it to disk.
So in effect they are trying to outguess or outthink the operating system. But their assumptions, in the case of Ext4 and most others, are not correct and their software is doing what they told it do, but what they told it to do is not what they think its doing.
You see they are putting extra effort into compinsating for the file system already. So if they are putting the extra effort into out thinking the OS, then why don't they at least do it correctly?
Instead of writing out hundreds of files and trying the rename atomic trick, which isn't really right anyways, there are a half a dozen different design approaches that would yeild better results.
Or am I completely off-base here?
I understand the need for the file system to protect a user's data despite what the application developers actually wrote. Really I do.
