Patchwork [3/5] ext4: No need to truncate pagecache twice in collapse range

login
register
mail settings
Submitter Lukas Czerner
Date April 16, 2014, 6:33 p.m.
Message ID <1397673182-5326-3-git-send-email-lczerner@redhat.com>
Download mbox | patch
Permalink /patch/339696/
State Accepted
Headers show

Comments

Lukas Czerner - April 16, 2014, 6:33 p.m.
We're already calling truncate_pagecache_range() before we attempt to
do any actual job so there is not need to truncate pagecache once more
using truncate_setsize() after we're finished.

Remove truncate_setsize() and replace it just with i_size_write() note
that we're holding appropriate locks.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 fs/ext4/extents.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Theodore Ts'o - April 18, 2014, 2:49 p.m.
On Wed, Apr 16, 2014 at 08:33:00PM +0200, Lukas Czerner wrote:
> We're already calling truncate_pagecache_range() before we attempt to
> do any actual job so there is not need to truncate pagecache once more
> using truncate_setsize() after we're finished.
> 
> Remove truncate_setsize() and replace it just with i_size_write() note
> that we're holding appropriate locks.
> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>

Applied, with truncate_pagecache_range() changed to be
truncate_pagecache() in the commit description.

Thanks!!

					- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 25ed60f..9cd762c 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5442,7 +5442,7 @@  int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len)
 	}
 
 	new_size = i_size_read(inode) - len;
-	truncate_setsize(inode, new_size);
+	i_size_write(inode, new_size);
 	EXT4_I(inode)->i_disksize = new_size;
 
 	ext4_discard_preallocations(inode);