aboutsummaryrefslogtreecommitdiffstats
path: root/fs/adfs/inode.c
diff options
context:
space:
mode:
authorMarco Stornelli <marco.stornelli@gmail.com>2012-12-15 05:51:11 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 14:00:01 -0500
commit62295183846234b423a67116c36e00bd29dfd856 (patch)
treeaab0c3c3e92e763d32898491b9f85de6b41ad5db /fs/adfs/inode.c
parenta6ff03771e9d4a2a64cd1414e32c6b369ae935ba (diff)
adfs: 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/adfs/inode.c')
-rw-r--r--fs/adfs/inode.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index e9bad5093a3f..5f95d1ed9c6d 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -45,6 +45,14 @@ static int adfs_readpage(struct file *file, struct page *page)
45 return block_read_full_page(page, adfs_get_block); 45 return block_read_full_page(page, adfs_get_block);
46} 46}
47 47
48static void adfs_write_failed(struct address_space *mapping, loff_t to)
49{
50 struct inode *inode = mapping->host;
51
52 if (to > inode->i_size)
53 truncate_pagecache(inode, to, inode->i_size);
54}
55
48static int adfs_write_begin(struct file *file, struct address_space *mapping, 56static int adfs_write_begin(struct file *file, struct address_space *mapping,
49 loff_t pos, unsigned len, unsigned flags, 57 loff_t pos, unsigned len, unsigned flags,
50 struct page **pagep, void **fsdata) 58 struct page **pagep, void **fsdata)
@@ -55,11 +63,8 @@ static int adfs_write_begin(struct file *file, struct address_space *mapping,
55 ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, 63 ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
56 adfs_get_block, 64 adfs_get_block,
57 &ADFS_I(mapping->host)->mmu_private); 65 &ADFS_I(mapping->host)->mmu_private);
58 if (unlikely(ret)) { 66 if (unlikely(ret))
59 loff_t isize = mapping->host->i_size; 67 adfs_write_failed(mapping, pos + len);
60 if (pos + len > isize)
61 vmtruncate(mapping->host, isize);
62 }
63 68
64 return ret; 69 return ret;
65} 70}