From 981250ca89261f98bdfd2d6be1fcccb96cbbc00d Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 12 Jun 2013 11:48:29 -0400 Subject: ext4: don't use EXT4_FREE_BLOCKS_FORGET unnecessarily Commit 18888cf0883c: "ext4: speed up truncate/unlink by not using bforget() unless needed" removed the use of EXT4_FREE_BLOCKS_FORGET in the most important codepath for file systems using extents, but a similar optimization also can be done for file systems using indirect blocks, and for the two special cases in the ext4 extents code. Cc: Andrey Sidorov Signed-off-by: "Theodore Ts'o" --- fs/ext4/indirect.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fs/ext4/indirect.c') diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 2a1f8a577e08..963d23dc1028 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c @@ -926,11 +926,13 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode, __le32 *last) { __le32 *p; - int flags = EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_VALIDATED; + int flags = EXT4_FREE_BLOCKS_VALIDATED; int err; if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) - flags |= EXT4_FREE_BLOCKS_METADATA; + flags |= EXT4_FREE_BLOCKS_FORGET | EXT4_FREE_BLOCKS_METADATA; + else if (ext4_should_journal_data(inode)) + flags |= EXT4_FREE_BLOCKS_FORGET; if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), block_to_free, count)) { -- cgit v1.2.3-59-g8ed1b