]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
ntfs: drop vmtruncate
authorMarco Stornelli <marco.stornelli@gmail.com>
Sat, 15 Dec 2012 10:58:36 +0000 (11:58 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 20 Dec 2012 23:40:55 +0000 (18:40 -0500)
Removed vmtruncate

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
Reviewed-by: Anton Altaparmakov <anton@tuxera.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ntfs/file.c
fs/ntfs/inode.c
fs/ntfs/inode.h

index 1ecf46448f858d477c040e313989cc9116315124..5b2d4f0853acfad180c03d9c10764b3199e31089 100644 (file)
@@ -1762,6 +1762,16 @@ err_out:
        return err;
 }
 
+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);
+               ntfs_truncate_vfs(inode);
+       }
+}
+
 /**
  * ntfs_file_buffered_write -
  *
@@ -2022,8 +2032,9 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,
                                 * allocated space, which is not a disaster.
                                 */
                                i_size = i_size_read(vi);
-                               if (pos + bytes > i_size)
-                                       vmtruncate(vi, i_size);
+                               if (pos + bytes > i_size) {
+                                       ntfs_write_failed(mapping, pos + bytes);
+                               }
                                break;
                        }
                }
@@ -2227,7 +2238,6 @@ const struct file_operations ntfs_file_ops = {
 
 const struct inode_operations ntfs_file_inode_ops = {
 #ifdef NTFS_RW
-       .truncate       = ntfs_truncate_vfs,
        .setattr        = ntfs_setattr,
 #endif /* NTFS_RW */
 };
index 1d27331e6fc945ee1ddba591d47ddf1ef1bafbd1..d3e118cc6ffa8f0016c5eb93e246aded38a1cc14 100644 (file)
@@ -2866,9 +2866,11 @@ conv_err_out:
  *
  * See ntfs_truncate() description above for details.
  */
+#ifdef NTFS_RW
 void ntfs_truncate_vfs(struct inode *vi) {
        ntfs_truncate(vi);
 }
+#endif
 
 /**
  * ntfs_setattr - called from notify_change() when an attribute is being changed
@@ -2914,8 +2916,10 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
                                                NInoCompressed(ni) ?
                                                "compressed" : "encrypted");
                                err = -EOPNOTSUPP;
-                       } else
-                               err = vmtruncate(vi, attr->ia_size);
+                       } else {
+                               truncate_setsize(vi, attr->ia_size);
+                               ntfs_truncate_vfs(vi);
+                       }
                        if (err || ia_valid == ATTR_SIZE)
                                goto out;
                } else {
index db29695f845ce6d448aa44308c487342a4356142..76b6cfb579d73944fff234df3999a19a9e002e51 100644 (file)
@@ -316,6 +316,10 @@ static inline void ntfs_commit_inode(struct inode *vi)
        return;
 }
 
+#else
+
+static inline void ntfs_truncate_vfs(struct inode *vi) {}
+
 #endif /* NTFS_RW */
 
 #endif /* _LINUX_NTFS_INODE_H */