From patchwork Fri Jun 29 10:56:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4/8] xfs: pass LLONG_MAX to truncate_inode_pages_range Date: Fri, 29 Jun 2012 00:56:06 -0000 From: Lukas Czerner X-Patchwork-Id: 168043 Message-Id: <1340967370-13728-4-git-send-email-lczerner@redhat.com> To: linux-ext4@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, tytso@mit.edu, achender@linux.vnet.ibm.com, Lukas Czerner , Dave Chinner 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; }