truncate: drop 'oldsize' truncate_pagecache() parameter
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Thu, 12 Sep 2013 22:13:56 +0000 (15:13 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Sep 2013 22:38:02 +0000 (15:38 -0700)
truncate_pagecache() doesn't care about old size since commit
cedabed49b39 ("vfs: Fix vmtruncate() regression").  Let's drop it.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
28 files changed:
fs/adfs/inode.c
fs/affs/file.c
fs/bfs/file.c
fs/btrfs/free-space-cache.c
fs/btrfs/inode.c
fs/cifs/inode.c
fs/exofs/inode.c
fs/ext2/inode.c
fs/ext4/inode.c
fs/fat/inode.c
fs/fuse/dir.c
fs/fuse/inode.c
fs/gfs2/bmap.c
fs/hfs/inode.c
fs/hfsplus/inode.c
fs/hpfs/file.c
fs/jfs/inode.c
fs/minix/inode.c
fs/nfs/inode.c
fs/nilfs2/inode.c
fs/ntfs/file.c
fs/omfs/file.c
fs/sysv/itree.c
fs/udf/inode.c
fs/ufs/inode.c
fs/xfs/xfs_aops.c
include/linux/mm.h
mm/truncate.c

index 5f95d1ed9c6dbf882e3b73e85b6cf0469f7d63af..b9acadafa4a10780d92c6d520008406fce4d5ddc 100644 (file)
@@ -50,7 +50,7 @@ static void adfs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size)
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
 }
 
 static int adfs_write_begin(struct file *file, struct address_space *mapping,
index 776e3935a758e2915b440a56b07d2478e48bc640..8669b6ecddee4cc030e21f39358ce2cf5058bddb 100644 (file)
@@ -406,7 +406,7 @@ static void affs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                affs_truncate(inode);
        }
 }
index ad3ea1497cc3825d4fdf795cd6b5735618005e0e..ae28922183357d4c0e4d491a452919e125ba8bc3 100644 (file)
@@ -166,7 +166,7 @@ static void bfs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size)
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
 }
 
 static int bfs_write_begin(struct file *file, struct address_space *mapping,
index b21a3cd667d8cc656878b8d462aa7cd45ebc8435..256d9597f0cf710501eeac4ec00be1ae3c49cb3b 100644 (file)
@@ -221,12 +221,10 @@ int btrfs_truncate_free_space_cache(struct btrfs_root *root,
                                    struct btrfs_path *path,
                                    struct inode *inode)
 {
-       loff_t oldsize;
        int ret = 0;
 
-       oldsize = i_size_read(inode);
        btrfs_i_size_write(inode, 0);
-       truncate_pagecache(inode, oldsize, 0);
+       truncate_pagecache(inode, 0);
 
        /*
         * We don't need an orphan item because truncating the free space cache
index 7bdc83d04d54ca36006ae54e221092f2d789ef0c..82fdd7059d10a2c66921a6cc3cd96309d0700fbe 100644 (file)
@@ -4409,7 +4409,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
                inode->i_ctime = inode->i_mtime = current_fs_time(inode->i_sb);
 
        if (newsize > oldsize) {
-               truncate_pagecache(inode, oldsize, newsize);
+               truncate_pagecache(inode, newsize);
                ret = btrfs_cont_expand(inode, oldsize, newsize);
                if (ret)
                        return ret;
index 449b6cf09b09dbc15e90f311e09bc011a0157b44..2a92c5c6ecfd4ec92389557e06007e739d56f6af 100644 (file)
@@ -1852,14 +1852,11 @@ static int cifs_truncate_page(struct address_space *mapping, loff_t from)
 
 static void cifs_setsize(struct inode *inode, loff_t offset)
 {
-       loff_t oldsize;
-
        spin_lock(&inode->i_lock);
-       oldsize = inode->i_size;
        i_size_write(inode, offset);
        spin_unlock(&inode->i_lock);
 
-       truncate_pagecache(inode, oldsize, offset);
+       truncate_pagecache(inode, offset);
 }
 
 static int
index 2ec8eb1ab269ae292d338d5d97ee48990af5b2c7..a52a5d23c30bcfac672df7197c51b966cc087787 100644 (file)
@@ -861,7 +861,7 @@ static int exofs_writepage(struct page *page, struct writeback_control *wbc)
 static void _write_failed(struct inode *inode, loff_t to)
 {
        if (to > inode->i_size)
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
 }
 
 int exofs_write_begin(struct file *file, struct address_space *mapping,
index 0a87bb10998dc00070bc6d05d6f536c21de44e3a..c260de6d7b6df9e5350ecfc019f41ed6def75470 100644 (file)
@@ -58,7 +58,7 @@ static void ext2_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                ext2_truncate_blocks(inode, inode->i_size);
        }
 }
index c79fd7dabe7953898f64b28101c8057fb7139119..0d424d7ac02b0a30f98e713bb10403e90ced51b5 100644 (file)
@@ -4587,7 +4587,6 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
 
        if (attr->ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) {
                handle_t *handle;
-               loff_t oldsize = inode->i_size;
 
                if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
                        struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
@@ -4650,7 +4649,7 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
                 * Truncate pagecache after we've waited for commit
                 * in data=journal mode to make pages freeable.
                 */
-               truncate_pagecache(inode, oldsize, inode->i_size);
+                       truncate_pagecache(inode, inode->i_size);
        }
        /*
         * We want to call ext4_truncate() even if attr->ia_size ==
index 11b51bb55b42b03187fc8436125e986c0cdcc047..0062da21dd8b7995aa1764bfd943cde9d2e22364 100644 (file)
@@ -147,7 +147,7 @@ static void fat_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                fat_truncate_blocks(inode, inode->i_size);
        }
 }
index 3ac91086f41f528c9e570f6925389d968a4076ff..62b43b577bfce40b116a7a8eb77a91cea1c8b7b4 100644 (file)
@@ -1678,7 +1678,7 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr,
         * FUSE_NOWRITE, otherwise fuse_launder_page() would deadlock.
         */
        if (S_ISREG(inode->i_mode) && oldsize != outarg.attr.size) {
-               truncate_pagecache(inode, oldsize, outarg.attr.size);
+               truncate_pagecache(inode, outarg.attr.size);
                invalidate_inode_pages2(inode->i_mapping);
        }
 
index 84434594e80e87d3ae000b7bdeebbc070e90a76b..a8ce6dab60a0b0e3279b6996c8462610c0cbef14 100644 (file)
@@ -218,7 +218,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
                bool inval = false;
 
                if (oldsize != attr->size) {
-                       truncate_pagecache(inode, oldsize, attr->size);
+                       truncate_pagecache(inode, attr->size);
                        inval = true;
                } else if (fc->auto_inval_data) {
                        struct timespec new_mtime = {
index 5e2f56fccf6b3dfd516c04bd01649852dd1e855d..62a65fc448dcedf5009f85a233cb43ad7cd4b442 100644 (file)
@@ -1016,7 +1016,7 @@ static int gfs2_journaled_truncate(struct inode *inode, u64 oldsize, u64 newsize
                chunk = oldsize - newsize;
                if (chunk > max_chunk)
                        chunk = max_chunk;
-               truncate_pagecache(inode, oldsize, oldsize - chunk);
+               truncate_pagecache(inode, oldsize - chunk);
                oldsize -= chunk;
                gfs2_trans_end(sdp);
                error = gfs2_trans_begin(sdp, RES_DINODE, GFS2_JTRUNC_REVOKES);
@@ -1067,7 +1067,7 @@ static int trunc_start(struct inode *inode, u64 oldsize, u64 newsize)
        if (journaled)
                error = gfs2_journaled_truncate(inode, oldsize, newsize);
        else
-               truncate_pagecache(inode, oldsize, newsize);
+               truncate_pagecache(inode, newsize);
 
        if (error) {
                brelse(dibh);
index f9299d8a64e3a2af9f6ef2aadd009a097c74ccf6..380ab31b5e0f4870ee966cbcfd5af1e805035f58 100644 (file)
@@ -41,7 +41,7 @@ static void hfs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                hfs_file_truncate(inode);
        }
 }
index 4d2edaea891c164586686c1577c87d4d14fc2f3f..37213d075f3c5c9f29029b280b093781ddb526ca 100644 (file)
@@ -36,7 +36,7 @@ static void hfsplus_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                hfsplus_file_truncate(inode);
        }
 }
index 4e9dabcf1f4cc35f8c3abd6455818f6b15c03a99..67c1a61e09558e0bb632638b0f65d8316ab9b5f2 100644 (file)
@@ -138,7 +138,7 @@ static void hpfs_write_failed(struct address_space *mapping, loff_t to)
        hpfs_lock(inode->i_sb);
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                hpfs_truncate(inode);
        }
 
index 730f24e282a652029ca14b0f5032411512914beb..f4aab719add57bf354f90536486d88182be0b1b3 100644 (file)
@@ -306,7 +306,7 @@ static void jfs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                jfs_truncate(inode);
        }
 }
index df122496f32821bd145490800467d41d02c87f63..0332109162a53f614c3c169297e25faf4bb06852 100644 (file)
@@ -400,7 +400,7 @@ static void minix_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                minix_truncate(inode);
        }
 }
index 87e7976408281f93fe350d797960617de4f33c70..eda8879171c47e3225ee6891a77aac70e1531af2 100644 (file)
@@ -541,7 +541,6 @@ EXPORT_SYMBOL_GPL(nfs_setattr);
  */
 static int nfs_vmtruncate(struct inode * inode, loff_t offset)
 {
-       loff_t oldsize;
        int err;
 
        err = inode_newsize_ok(inode, offset);
@@ -549,11 +548,10 @@ static int nfs_vmtruncate(struct inode * inode, loff_t offset)
                goto out;
 
        spin_lock(&inode->i_lock);
-       oldsize = inode->i_size;
        i_size_write(inode, offset);
        spin_unlock(&inode->i_lock);
 
-       truncate_pagecache(inode, oldsize, offset);
+       truncate_pagecache(inode, offset);
 out:
        return err;
 }
index b1a5277cfd182adcbfda860ad395e07a14f94db8..7e350c562e0ea1dd491a8ee6c72371b770666e1f 100644 (file)
@@ -254,7 +254,7 @@ void nilfs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                nilfs_truncate(inode);
        }
 }
index c5670b8d198caf5aea663b224c02e7289d572565..ea4ba9daeb472069cd9d8664b58ff363806ab4e4 100644 (file)
@@ -1768,7 +1768,7 @@ static void ntfs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                ntfs_truncate_vfs(inode);
        }
 }
index e0d9b3e722bd41f91cf4b58f76aa1f34e2684149..54d57d6ba68dd5b91df6cbc9269e1ccf3c05a950 100644 (file)
@@ -311,7 +311,7 @@ static void omfs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                omfs_truncate(inode);
        }
 }
index c1a591a4725b0ba4344862f97e7ab2c72de974f6..66bc316927e8a01f60a387aa19bac4ab81abcd87 100644 (file)
@@ -469,7 +469,7 @@ static void sysv_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size) {
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
                sysv_truncate(inode);
        }
 }
index b6d15d349810fe5ca21649208bd86d220caf338c..062b7925bca04c02949919ac37aab790d7b982a2 100644 (file)
@@ -172,7 +172,7 @@ static void udf_write_failed(struct address_space *mapping, loff_t to)
        loff_t isize = inode->i_size;
 
        if (to > isize) {
-               truncate_pagecache(inode, to, isize);
+               truncate_pagecache(inode, isize);
                if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
                        down_write(&iinfo->i_data_sem);
                        udf_clear_extent_cache(inode);
index ff24e4449ece0184436a179b1815571f2da87e10..c8ca9608678433052c5d8d13893513208db72e43 100644 (file)
@@ -531,7 +531,7 @@ static void ufs_write_failed(struct address_space *mapping, loff_t to)
        struct inode *inode = mapping->host;
 
        if (to > inode->i_size)
-               truncate_pagecache(inode, to, inode->i_size);
+               truncate_pagecache(inode, inode->i_size);
 }
 
 static int ufs_write_begin(struct file *file, struct address_space *mapping,
index 977da0ec66047eedacb3298ebec57de3a2968f0c..e51e581454e93113c7ead8d81136ab82bd29da94 100644 (file)
@@ -1582,7 +1582,7 @@ xfs_vm_write_begin(
                unlock_page(page);
 
                if (pos + len > i_size_read(inode))
-                       truncate_pagecache(inode, pos + len, i_size_read(inode));
+                       truncate_pagecache(inode, i_size_read(inode));
 
                page_cache_release(page);
                page = NULL;
@@ -1618,7 +1618,7 @@ xfs_vm_write_end(
                loff_t          to = pos + len;
 
                if (to > isize) {
-                       truncate_pagecache(inode, to, isize);
+                       truncate_pagecache(inode, isize);
                        xfs_vm_kill_delalloc_range(inode, isize, to);
                }
        }
index 3d9b503bcd00dd459afc167f1aeaf909084b2298..928df792c0052346ba38a0befef0d22a66559200 100644 (file)
@@ -985,7 +985,7 @@ static inline void unmap_shared_mapping_range(struct address_space *mapping,
        unmap_mapping_range(mapping, holebegin, holelen, 0);
 }
 
-extern void truncate_pagecache(struct inode *inode, loff_t old, loff_t new);
+extern void truncate_pagecache(struct inode *inode, loff_t new);
 extern void truncate_setsize(struct inode *inode, loff_t newsize);
 void truncate_pagecache_range(struct inode *inode, loff_t offset, loff_t end);
 int truncate_inode_page(struct address_space *mapping, struct page *page);
index e2e8a8a7eb9d8facfd7581998641e72f81b4c02d..353b683afd6ef538ab3318f5c40ad6502789227e 100644 (file)
@@ -567,7 +567,6 @@ EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
 /**
  * truncate_pagecache - unmap and remove pagecache that has been truncated
  * @inode: inode
- * @oldsize: old file size
  * @newsize: new file size
  *
  * inode's new i_size must already be written before truncate_pagecache
@@ -580,7 +579,7 @@ EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
  * situations such as writepage being called for a page that has already
  * had its underlying blocks deallocated.
  */
-void truncate_pagecache(struct inode *inode, loff_t oldsize, loff_t newsize)
+void truncate_pagecache(struct inode *inode, loff_t newsize)
 {
        struct address_space *mapping = inode->i_mapping;
        loff_t holebegin = round_up(newsize, PAGE_SIZE);
@@ -614,12 +613,8 @@ EXPORT_SYMBOL(truncate_pagecache);
  */
 void truncate_setsize(struct inode *inode, loff_t newsize)
 {
-       loff_t oldsize;
-
-       oldsize = inode->i_size;
        i_size_write(inode, newsize);
-
-       truncate_pagecache(inode, oldsize, newsize);
+       truncate_pagecache(inode, newsize);
 }
 EXPORT_SYMBOL(truncate_setsize);