From patchwork Fri Apr 18 11:22:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Czerner X-Patchwork-Id: 340276 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 713691400E0 for ; Fri, 18 Apr 2014 21:22:15 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751370AbaDRLWN (ORCPT ); Fri, 18 Apr 2014 07:22:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8548 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751185AbaDRLWM (ORCPT ); Fri, 18 Apr 2014 07:22:12 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3IBM9eO003774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Apr 2014 07:22:10 -0400 Received: from localhost.localdomain.com (dhcp-1-205.brq.redhat.com [10.34.1.205]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s3IBM7NV006281; Fri, 18 Apr 2014 07:22:07 -0400 From: Lukas Czerner To: linux-ext4@vger.kernel.org Cc: namjae.jeon@samsung.com, Lukas Czerner Subject: [PATCH] ext4: Use truncate_pagecache() in collapse range Date: Fri, 18 Apr 2014 13:22:04 +0200 Message-Id: <1397820124-16885-1-git-send-email-lczerner@redhat.com> In-Reply-To: <002101cf5ac76d97bf048c73d0samsung.com> References: <002101cf5ac76d97bf048c73d0samsung.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org We should be using truncate_pagecache() instead of truncate_pagecache_range() in the collapse range because we're truncating page cache from offset to the end of file. truncate_pagecache() also get rid of the private COWed pages from the range because we're going to shift the end of the file. Signed-off-by: Lukas Czerner --- fs/ext4/extents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 5fa31cb..3a6e40c 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -5406,7 +5406,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) goto out_mutex; } - truncate_pagecache_range(inode, offset, -1); + truncate_pagecache(inode, offset); /* Wait for existing dio to complete */ ext4_inode_block_unlocked_dio(inode);