Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Marco Stornelli and committed by
Al Viro
9014da75 2d1b399b

+23 -5
+13 -3
fs/ntfs/file.c
··· 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 * ··· 2032 2022 * allocated space, which is not a disaster. 2033 2023 */ 2034 2024 i_size = i_size_read(vi); 2035 - if (pos + bytes > i_size) 2036 - vmtruncate(vi, i_size); 2025 + if (pos + bytes > i_size) { 2026 + ntfs_write_failed(mapping, pos + bytes); 2027 + } 2037 2028 break; 2038 2029 } 2039 2030 } ··· 2238 2227 2239 2228 const struct inode_operations ntfs_file_inode_ops = { 2240 2229 #ifdef NTFS_RW 2241 - .truncate = ntfs_truncate_vfs, 2242 2230 .setattr = ntfs_setattr, 2243 2231 #endif /* NTFS_RW */ 2244 2232 };
+6 -2
fs/ntfs/inode.c
··· 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 ··· 2916 2914 NInoCompressed(ni) ? 2917 2915 "compressed" : "encrypted"); 2918 2916 err = -EOPNOTSUPP; 2919 - } else 2920 - err = vmtruncate(vi, attr->ia_size); 2917 + } else { 2918 + truncate_setsize(vi, attr->ia_size); 2919 + ntfs_truncate_vfs(vi); 2920 + } 2921 2921 if (err || ia_valid == ATTR_SIZE) 2922 2922 goto out; 2923 2923 } else {
+4
fs/ntfs/inode.h
··· 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 */