Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

ntfs: drop vmtruncate

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>
  • Loading branch information...
commit 9014da7525dffef69131f717decf262e08ff3d58 1 parent 2d1b399
authored December 15, 2012 Al Viro committed December 20, 2012
16  fs/ntfs/file.c
@@ -1762,6 +1762,16 @@ static int ntfs_commit_pages_after_write(struct page **pages,
1762 1762
 	return err;
1763 1763
 }
1764 1764
 
  1765
+static void ntfs_write_failed(struct address_space *mapping, loff_t to)
  1766
+{
  1767
+	struct inode *inode = mapping->host;
  1768
+
  1769
+	if (to > inode->i_size) {
  1770
+		truncate_pagecache(inode, to, inode->i_size);
  1771
+		ntfs_truncate_vfs(inode);
  1772
+	}
  1773
+}
  1774
+
1765 1775
 /**
1766 1776
  * ntfs_file_buffered_write -
1767 1777
  *
@@ -2022,8 +2032,9 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,
2022 2032
 				 * allocated space, which is not a disaster.
2023 2033
 				 */
2024 2034
 				i_size = i_size_read(vi);
2025  
-				if (pos + bytes > i_size)
2026  
-					vmtruncate(vi, i_size);
  2035
+				if (pos + bytes > i_size) {
  2036
+					ntfs_write_failed(mapping, pos + bytes);
  2037
+				}
2027 2038
 				break;
2028 2039
 			}
2029 2040
 		}
@@ -2227,7 +2238,6 @@ const struct file_operations ntfs_file_ops = {
2227 2238
 
2228 2239
 const struct inode_operations ntfs_file_inode_ops = {
2229 2240
 #ifdef NTFS_RW
2230  
-	.truncate	= ntfs_truncate_vfs,
2231 2241
 	.setattr	= ntfs_setattr,
2232 2242
 #endif /* NTFS_RW */
2233 2243
 };
8  fs/ntfs/inode.c
@@ -2866,9 +2866,11 @@ int ntfs_truncate(struct inode *vi)
2866 2866
  *
2867 2867
  * See ntfs_truncate() description above for details.
2868 2868
  */
  2869
+#ifdef NTFS_RW
2869 2870
 void ntfs_truncate_vfs(struct inode *vi) {
2870 2871
 	ntfs_truncate(vi);
2871 2872
 }
  2873
+#endif
2872 2874
 
2873 2875
 /**
2874 2876
  * 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)
2914 2916
 						NInoCompressed(ni) ?
2915 2917
 						"compressed" : "encrypted");
2916 2918
 				err = -EOPNOTSUPP;
2917  
-			} else
2918  
-				err = vmtruncate(vi, attr->ia_size);
  2919
+			} else {
  2920
+				truncate_setsize(vi, attr->ia_size);
  2921
+				ntfs_truncate_vfs(vi);
  2922
+			}
2919 2923
 			if (err || ia_valid == ATTR_SIZE)
2920 2924
 				goto out;
2921 2925
 		} else {
4  fs/ntfs/inode.h
@@ -316,6 +316,10 @@ static inline void ntfs_commit_inode(struct inode *vi)
316 316
 	return;
317 317
 }
318 318
 
  319
+#else
  320
+
  321
+static inline void ntfs_truncate_vfs(struct inode *vi) {}
  322
+
319 323
 #endif /* NTFS_RW */
320 324
 
321 325
 #endif /* _LINUX_NTFS_INODE_H */

0 notes on commit 9014da7

Please sign in to comment.
Something went wrong with that request. Please try again.