From patchwork Sat Jan 14 19:34:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Henderson X-Patchwork-Id: 136100 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 237CDB6F9B for ; Sun, 15 Jan 2012 06:29:27 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756519Ab2ANT3Y (ORCPT ); Sat, 14 Jan 2012 14:29:24 -0500 Received: from e3.ny.us.ibm.com ([32.97.182.143]:54734 "EHLO e3.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756467Ab2ANT3Y (ORCPT ); Sat, 14 Jan 2012 14:29:24 -0500 Received: from /spool/local by e3.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 14 Jan 2012 14:29:23 -0500 Received: from d01relay02.pok.ibm.com (9.56.227.234) by e3.ny.us.ibm.com (192.168.1.103) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 14 Jan 2012 14:29:18 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q0EJTHsB437450 for ; Sat, 14 Jan 2012 14:29:17 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q0EJTH6f025885 for ; Sat, 14 Jan 2012 17:29:17 -0200 Received: from elm3c80.beaverton.ibm.com (elm3c80.beaverton.ibm.com [9.47.69.80]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q0EJTGWx025855; Sat, 14 Jan 2012 17:29:17 -0200 From: Allison Henderson To: linux-ext4@vger.kernel.org Cc: Allison Henderson Subject: [PATCH 1/3] ext4: Allow punch hole beyond i_size Date: Sat, 14 Jan 2012 12:34:59 -0700 Message-Id: <1326569701-21620-2-git-send-email-achender@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1326569701-21620-1-git-send-email-achender@linux.vnet.ibm.com> References: <1326569701-21620-1-git-send-email-achender@linux.vnet.ibm.com> x-cbid: 12011419-8974-0000-0000-0000053952B0 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- :100644 100644 ad39627... 9ec6249... M fs/ext4/extents.c fs/ext4/extents.c | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-) 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);