Re: ext2_discard_prealloc() called on each iput?

Jan Kara
2007-05-29T10:14:02Z

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]

On Wed 23-05-07 08:37:43, Theodore Tso wrote:
> > 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?
<snip>
> still patches to fix the comments might not be a bad idea, since it
> might save confusion by others later on.
OK, attached is a patch that fixes the comment. Andrew, please put it
into your patch queue... Thanks.

Honza
--
Jan Kara <jack@suse.cz>
SuSE CR Labs

[-- Attachment #2: ext2-2.6.21-1-comment_fix.diff --]
[-- Type: text/x-patch, Size: 881 bytes --]

Fix a comment when ext2_release_file() is called.

Signed-off-by: Jan Kara <jack@suse.cz>

diff -rupX /home/jack/.kerndiffexclude linux-2.6.21/fs/ext2/file.c linux-2.6.21-1-ext2_comment_fix/fs/ext2/file.c
--- linux-2.6.21/fs/ext2/file.c 2007-05-15 14:18:47.000000000 +0200
+++ linux-2.6.21-1-ext2_comment_fix/fs/ext2/file.c 2007-05-29 12:15:59.000000000 +0200
@@ -24,9 +24,9 @@
#include "acl.h"

/*
- * Called when an inode is released. Note that this is different
- * from ext2_open_file: open gets called at every open, but release
- * gets called only when /all/ the files are closed.
+ * Called when filp is released. This happens when all file descriptors
+ * for a single struct file are closed. Note that different open() calls
+ * for the same file yield different struct file structures.
*/
static int ext2_release_file (struct inode * inode, struct file * filp)
{