From: Theodore Tso <tytso@mit.edu>
To: Clemens Eisserer <linuxhippy@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Howto switch off ext4's delayed allocation?
Date: Thu, 17 Sep 2009 09:34:01 -0400 [thread overview]
Message-ID: <20090917133401.GC24438@mit.edu> (raw)
In-Reply-To: <194f62550909161141n5730049cra2643ce1654a7aaf@mail.gmail.com>
On Wed, Sep 16, 2009 at 02:41:09PM -0400, Clemens Eisserer wrote:
>
> > If you can run a strace on eclipse while and then arrange to edit an
> > existing file and save it, it would be interesting to see what the
> > heck it is doing.
> I'll have a look.
Thanks, but no need. I did some investigating, and when I found that
kwrite was doing a truncate-and-rewrite, I did some more digging, and
found that we had a bug in our truncate hueristics. I'll get this
fixed for 2.6.32, and it will be a candidate for the 2.6.31 stable
tree.
(This needs to get backported for ext3 as well.)
- Ted
commit dbc380bc2268bed9faa687b2ec1f98a7706b5909
Author: Theodore Ts'o <tytso@mit.edu>
Date: Thu Sep 17 09:33:32 2009 -0400
ext4: Fix the alloc on close after a truncate hueristic
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>
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9887a0c..4abd683 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3973,8 +3973,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) {
next prev parent reply other threads:[~2009-09-17 13:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-09 11:03 Howto switch off ext4's delayed allocation? Clemens Eisserer
2009-09-16 12:32 ` Clemens Eisserer
2009-09-16 16:38 ` Theodore Tso
2009-09-16 18:41 ` Clemens Eisserer
2009-09-17 13:34 ` Theodore Tso [this message]
2009-09-17 18:37 ` Clemens Eisserer
-- strict thread matches above, loose matches on Subject: below --
2009-09-16 13:29 Tomasz Chmielewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090917133401.GC24438@mit.edu \
--to=tytso@mit.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxhippy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox