ext2_discard_prealloc() called on each iput?

Jan Kara
2007-05-22T16:00:17Z

Hello,

while fixing some problems with preallocation in UDF, I had a look how
ext2 solves similar problems. I found out that ext2_discard_prealloc() is
called on every iput() from ext2_put_inode(). Is it really appropriate? I
don't see a reason for doing so...
Also I found slightly misleading the comment at ext2_release_file().
As far as I understand the code it isn't when /all/ files are closed but
rather when all fd's for given filp are closed. I.e. if you open the same
file two times, ->release will get called once for each open. Am I right?
If so, then also calling ext2_discard_prealloc() from ext2_release_file()
is suboptimal, isn't it?
Thanks for answer