From patchwork Fri Jun 29 10:56:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Czerner X-Patchwork-Id: 168043 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 8B940B6F77 for ; Fri, 29 Jun 2012 20:57:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754611Ab2F2K45 (ORCPT ); Fri, 29 Jun 2012 06:56:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44771 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754188Ab2F2K42 (ORCPT ); Fri, 29 Jun 2012 06:56:28 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5TAuPvs010619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 29 Jun 2012 06:56:26 -0400 Received: from vpn-9-37.rdu.redhat.com (vpn-9-37.rdu.redhat.com [10.11.9.37]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5TAuFTB006949; Fri, 29 Jun 2012 06:56:23 -0400 From: Lukas Czerner To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, tytso@mit.edu, achender@linux.vnet.ibm.com, Lukas Czerner , Dave Chinner Subject: [PATCH 4/8] xfs: pass LLONG_MAX to truncate_inode_pages_range Date: Fri, 29 Jun 2012 12:56:06 +0200 Message-Id: <1340967370-13728-4-git-send-email-lczerner@redhat.com> In-Reply-To: <1340967370-13728-1-git-send-email-lczerner@redhat.com> References: <1340967370-13728-1-git-send-email-lczerner@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Currently we're passing -1 to truncate_inode_pages_range() which is actually really confusing since the argument is signed so we do not get "huge" number as one would expect, but rather just -1. To make things clearer and easier for truncate_inode_pages_range() just pass LLONG_MAX since it is actually what was intended anyway. It also makes thing easier for allowing truncate_inode_pages_range() to handle non page aligned regions. Moreover letting the lend argument to be negative might actually hide some bugs. Signed-off-by: Lukas Czerner Cc: Dave Chinner --- fs/xfs/xfs_fs_subr.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_fs_subr.c b/fs/xfs/xfs_fs_subr.c index 652b875..6e9b052 100644 --- a/fs/xfs/xfs_fs_subr.c +++ b/fs/xfs/xfs_fs_subr.c @@ -34,7 +34,8 @@ xfs_tosspages( { /* can't toss partial tail pages, so mask them out */ last &= ~(PAGE_SIZE - 1); - truncate_inode_pages_range(VFS_I(ip)->i_mapping, first, last - 1); + truncate_inode_pages_range(VFS_I(ip)->i_mapping, first, + last == -1 ? LLONG_MAX : last); } int @@ -53,7 +54,8 @@ xfs_flushinval_pages( ret = filemap_write_and_wait_range(mapping, first, last == -1 ? LLONG_MAX : last); if (!ret) - truncate_inode_pages_range(mapping, first, last); + truncate_inode_pages_range(mapping, first, + last == -1 ? LLONG_MAX : last); return -ret; }