aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/inode.c
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/inode.c
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/inode.c')
-rw-r--r--fs/jfs/inode.c20
1 files changed, 14 insertions, 6 deletions
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;