diff options
author | Marco Stornelli <marco.stornelli@gmail.com> | 2012-12-15 05:51:53 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-20 14:00:01 -0500 |
commit | 1dc1834f4292624f46da7e0309bc04a3cca1b07c (patch) | |
tree | 7598e172f5ce871436d12f0b55466a6c54bae529 /fs | |
parent | 62295183846234b423a67116c36e00bd29dfd856 (diff) |
affs: 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')
-rw-r--r-- | fs/affs/file.c | 18 | ||||
-rw-r--r-- | fs/affs/inode.c | 5 |
2 files changed, 16 insertions, 7 deletions
diff --git a/fs/affs/file.c b/fs/affs/file.c index 2f4c935cb327..af3261b78102 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -39,7 +39,6 @@ const struct file_operations affs_file_operations = { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | const struct inode_operations affs_file_inode_operations = { | 41 | const struct inode_operations affs_file_inode_operations = { |
42 | .truncate = affs_truncate, | ||
43 | .setattr = affs_notify_change, | 42 | .setattr = affs_notify_change, |
44 | }; | 43 | }; |
45 | 44 | ||
@@ -402,6 +401,16 @@ static int affs_readpage(struct file *file, struct page *page) | |||
402 | return block_read_full_page(page, affs_get_block); | 401 | return block_read_full_page(page, affs_get_block); |
403 | } | 402 | } |
404 | 403 | ||
404 | static void affs_write_failed(struct address_space *mapping, loff_t to) | ||
405 | { | ||
406 | struct inode *inode = mapping->host; | ||
407 | |||
408 | if (to > inode->i_size) { | ||
409 | truncate_pagecache(inode, to, inode->i_size); | ||
410 | affs_truncate(inode); | ||
411 | } | ||
412 | } | ||
413 | |||
405 | static int affs_write_begin(struct file *file, struct address_space *mapping, | 414 | static int affs_write_begin(struct file *file, struct address_space *mapping, |
406 | loff_t pos, unsigned len, unsigned flags, | 415 | loff_t pos, unsigned len, unsigned flags, |
407 | struct page **pagep, void **fsdata) | 416 | struct page **pagep, void **fsdata) |
@@ -412,11 +421,8 @@ static int affs_write_begin(struct file *file, struct address_space *mapping, | |||
412 | ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 421 | ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
413 | affs_get_block, | 422 | affs_get_block, |
414 | &AFFS_I(mapping->host)->mmu_private); | 423 | &AFFS_I(mapping->host)->mmu_private); |
415 | if (unlikely(ret)) { | 424 | if (unlikely(ret)) |
416 | loff_t isize = mapping->host->i_size; | 425 | affs_write_failed(mapping, pos + len); |
417 | if (pos + len > isize) | ||
418 | vmtruncate(mapping->host, isize); | ||
419 | } | ||
420 | 426 | ||
421 | return ret; | 427 | return ret; |
422 | } | 428 | } |
diff --git a/fs/affs/inode.c b/fs/affs/inode.c index 15c484268229..0e092d08680e 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c | |||
@@ -237,9 +237,12 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr) | |||
237 | 237 | ||
238 | if ((attr->ia_valid & ATTR_SIZE) && | 238 | if ((attr->ia_valid & ATTR_SIZE) && |
239 | attr->ia_size != i_size_read(inode)) { | 239 | attr->ia_size != i_size_read(inode)) { |
240 | error = vmtruncate(inode, attr->ia_size); | 240 | error = inode_newsize_ok(inode, attr->ia_size); |
241 | if (error) | 241 | if (error) |
242 | return error; | 242 | return error; |
243 | |||
244 | truncate_setsize(inode, attr->ia_size); | ||
245 | affs_truncate(inode); | ||
243 | } | 246 | } |
244 | 247 | ||
245 | setattr_copy(inode, attr); | 248 | setattr_copy(inode, attr); |