Patchwork [1/3] ext4: Allow punch hole beyond i_size

login
register
mail settings
Submitter Allison Henderson
Date Jan. 14, 2012, 7:34 p.m.
Message ID <1326569701-21620-2-git-send-email-achender@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/136100/
State New
Headers show

Comments

Allison Henderson - Jan. 14, 2012, 7:34 p.m.
This patch allows blocks beyond i_size to be punched out.
This early return to catch this condition is simply removed
allowing punch hole to proceed beyond i_size.

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
---
:100644 100644 ad39627... 9ec6249... M	fs/ext4/extents.c
 fs/ext4/extents.c |   14 --------------
 1 files changed, 0 insertions(+), 14 deletions(-)

Patch

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index ad39627..9ec6249 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4704,20 +4704,6 @@  int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length)
 	loff_t first_page_offset, last_page_offset;
 	int ret, credits, blocks_released, err = 0;
 
-	/* No need to punch hole beyond i_size */
-	if (offset >= inode->i_size)
-		return 0;
-
-	/*
-	 * If the hole extends beyond i_size, set the hole
-	 * to end after the page that contains i_size
-	 */
-	if (offset + length > inode->i_size) {
-		length = inode->i_size +
-		   PAGE_CACHE_SIZE - (inode->i_size & (PAGE_CACHE_SIZE - 1)) -
-		   offset;
-	}
-
 	first_block = (offset + sb->s_blocksize - 1) >>
 		EXT4_BLOCK_SIZE_BITS(sb);
 	last_block = (offset + length) >> EXT4_BLOCK_SIZE_BITS(sb);