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

hfsplus: drop vmtruncate

Removed vmtruncate

Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Marco Stornelli and committed by
Al Viro
d5068485 86dd07d6

+16 -11
+16 -11
fs/hfsplus/inode.c
··· 28 28 return block_write_full_page(page, hfsplus_get_block, wbc); 29 29 } 30 30 31 + static void hfsplus_write_failed(struct address_space *mapping, loff_t to) 32 + { 33 + struct inode *inode = mapping->host; 34 + 35 + if (to > inode->i_size) { 36 + truncate_pagecache(inode, to, inode->i_size); 37 + hfsplus_file_truncate(inode); 38 + } 39 + } 40 + 31 41 static int hfsplus_write_begin(struct file *file, struct address_space *mapping, 32 42 loff_t pos, unsigned len, unsigned flags, 33 43 struct page **pagep, void **fsdata) ··· 48 38 ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, 49 39 hfsplus_get_block, 50 40 &HFSPLUS_I(mapping->host)->phys_size); 51 - if (unlikely(ret)) { 52 - loff_t isize = mapping->host->i_size; 53 - if (pos + len > isize) 54 - vmtruncate(mapping->host, isize); 55 - } 41 + if (unlikely(ret)) 42 + hfsplus_write_failed(mapping, pos + len); 56 43 57 44 return ret; 58 45 } ··· 123 116 const struct iovec *iov, loff_t offset, unsigned long nr_segs) 124 117 { 125 118 struct file *file = iocb->ki_filp; 119 + struct address_space *mapping = file->f_mapping; 126 120 struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; 127 121 ssize_t ret; 128 122 ··· 139 131 loff_t end = offset + iov_length(iov, nr_segs); 140 132 141 133 if (end > isize) 142 - vmtruncate(inode, isize); 134 + hfsplus_write_failed(mapping, end); 143 135 } 144 136 145 137 return ret; ··· 308 300 if ((attr->ia_valid & ATTR_SIZE) && 309 301 attr->ia_size != i_size_read(inode)) { 310 302 inode_dio_wait(inode); 311 - 312 - error = vmtruncate(inode, attr->ia_size); 313 - if (error) 314 - return error; 303 + truncate_setsize(inode, attr->ia_size); 304 + hfsplus_file_truncate(inode); 315 305 } 316 306 317 307 setattr_copy(inode, attr); ··· 364 358 365 359 static const struct inode_operations hfsplus_file_inode_operations = { 366 360 .lookup = hfsplus_file_lookup, 367 - .truncate = hfsplus_file_truncate, 368 361 .setattr = hfsplus_setattr, 369 362 .setxattr = hfsplus_setxattr, 370 363 .getxattr = hfsplus_getxattr,