aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
authorMarco Stornelli <marco.stornelli@gmail.com>2012-12-15 05:54:25 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 18:40:52 -0500
commit86dd07d66a2f7284cfe2b771d062dd6c0e331766 (patch)
treeb374b01c76d21e9fc620b26ce8dfec5c1aa980f6 /fs/jfs
parent70b31c4c88e253f4c2066367401118edab957614 (diff)
jfs: drop vmtruncate
Removed vmtruncate Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/file.c6
-rw-r--r--fs/jfs/inode.c20
2 files changed, 18 insertions, 8 deletions
diff --git a/fs/jfs/file.c b/fs/jfs/file.c
index 9d3afd157f99..dd7442c58358 100644
--- a/fs/jfs/file.c
+++ b/fs/jfs/file.c
@@ -119,9 +119,12 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
119 iattr->ia_size != i_size_read(inode)) { 119 iattr->ia_size != i_size_read(inode)) {
120 inode_dio_wait(inode); 120 inode_dio_wait(inode);
121 121
122 rc = vmtruncate(inode, iattr->ia_size); 122 rc = inode_newsize_ok(inode, iattr->ia_size);
123 if (rc) 123 if (rc)
124 return rc; 124 return rc;
125
126 truncate_setsize(inode, iattr->ia_size);
127 jfs_truncate(inode);
125 } 128 }
126 129
127 setattr_copy(inode, iattr); 130 setattr_copy(inode, iattr);
@@ -133,7 +136,6 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr)
133} 136}
134 137
135const struct inode_operations jfs_file_inode_operations = { 138const struct inode_operations jfs_file_inode_operations = {
136 .truncate = jfs_truncate,
137 .setxattr = jfs_setxattr, 139 .setxattr = jfs_setxattr,
138 .getxattr = jfs_getxattr, 140 .getxattr = jfs_getxattr,
139 .listxattr = jfs_listxattr, 141 .listxattr = jfs_listxattr,
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index 4692bf3ca8cb..b7dc47ba675e 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -300,6 +300,16 @@ static int jfs_readpages(struct file *file, struct address_space *mapping,
300 return mpage_readpages(mapping, pages, nr_pages, jfs_get_block); 300 return mpage_readpages(mapping, pages, nr_pages, jfs_get_block);
301} 301}
302 302
303static void jfs_write_failed(struct address_space *mapping, loff_t to)
304{
305 struct inode *inode = mapping->host;
306
307 if (to > inode->i_size) {
308 truncate_pagecache(inode, to, inode->i_size);
309 jfs_truncate(inode);
310 }
311}
312
303static int jfs_write_begin(struct file *file, struct address_space *mapping, 313static int jfs_write_begin(struct file *file, struct address_space *mapping,
304 loff_t pos, unsigned len, unsigned flags, 314 loff_t pos, unsigned len, unsigned flags,
305 struct page **pagep, void **fsdata) 315 struct page **pagep, void **fsdata)
@@ -308,11 +318,8 @@ static int jfs_write_begin(struct file *file, struct address_space *mapping,
308 318
309 ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata, 319 ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata,
310 jfs_get_block); 320 jfs_get_block);
311 if (unlikely(ret)) { 321 if (unlikely(ret))
312 loff_t isize = mapping->host->i_size; 322 jfs_write_failed(mapping, pos + len);
313 if (pos + len > isize)
314 vmtruncate(mapping->host, isize);
315 }
316 323
317 return ret; 324 return ret;
318} 325}
@@ -326,6 +333,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
326 const struct iovec *iov, loff_t offset, unsigned long nr_segs) 333 const struct iovec *iov, loff_t offset, unsigned long nr_segs)
327{ 334{
328 struct file *file = iocb->ki_filp; 335 struct file *file = iocb->ki_filp;
336 struct address_space *mapping = file->f_mapping;
329 struct inode *inode = file->f_mapping->host; 337 struct inode *inode = file->f_mapping->host;
330 ssize_t ret; 338 ssize_t ret;
331 339
@@ -341,7 +349,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
341 loff_t end = offset + iov_length(iov, nr_segs); 349 loff_t end = offset + iov_length(iov, nr_segs);
342 350
343 if (end > isize) 351 if (end > isize)
344 vmtruncate(inode, isize); 352 jfs_write_failed(mapping, end);
345 } 353 }
346 354
347 return ret; 355 return ret;