diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-09-17 09:34:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-14 08:06:52 -0800 |
commit | a6c92a88b556da1073e03d6936ae70c2c045421c (patch) | |
tree | 87061c9b577fb0d476c3fef783014b80cee837ca /fs | |
parent | 1f51991dec0bd679d172b55a86d54ca3f6227c51 (diff) |
ext4: Fix the alloc on close after a truncate hueristic
(cherry picked from commit 5534fb5bb35a62a94e0bd1fa2421f7fb6e894f10)
In an attempt to avoid doing an unneeded flush after opening a
(previously non-existent) file with O_CREAT|O_TRUNC, the code only
triggered the hueristic if ei->disksize was non-zero. Turns out that
the VFS doesn't call ->truncate() if the file doesn't exist, and
ei->disksize is always zero even if the file previously existed. So
remove the test, since it isn't necessary and in fact disabled the
hueristic.
Thanks to Clemens Eisserer that he was seeing problems with files
written using kwrite and eclipse after sudden crashes caused by a
buggy Intel video driver.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/inode.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 2fe4dc97162..2ca924812cd 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3983,8 +3983,7 @@ void ext4_truncate(struct inode *inode) if (!ext4_can_truncate(inode)) return; - if (ei->i_disksize && inode->i_size == 0 && - !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC)) + if (inode->i_size == 0 && !test_opt(inode->i_sb, NO_AUTO_DA_ALLOC)) ei->i_state |= EXT4_STATE_DA_ALLOC_CLOSE; if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) { |