aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bfs
diff options
context:
space:
mode:
authorMarco Stornelli <marco.stornelli@gmail.com>2012-12-15 05:52:33 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 14:00:01 -0500
commit41ddaeeb9d02ca12fee80b4eb23ab388b3ebe69d (patch)
tree54092aa0ded0f0c6adf1b890b356fd21582a80a1 /fs/bfs
parent1dc1834f4292624f46da7e0309bc04a3cca1b07c (diff)
bfs: 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/bfs')
-rw-r--r--fs/bfs/file.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index f20e8a71062f..ad3ea1497cc3 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -161,6 +161,14 @@ static int bfs_readpage(struct file *file, struct page *page)
161 return block_read_full_page(page, bfs_get_block); 161 return block_read_full_page(page, bfs_get_block);
162} 162}
163 163
164static void bfs_write_failed(struct address_space *mapping, loff_t to)
165{
166 struct inode *inode = mapping->host;
167
168 if (to > inode->i_size)
169 truncate_pagecache(inode, to, inode->i_size);
170}
171
164static int bfs_write_begin(struct file *file, struct address_space *mapping, 172static int bfs_write_begin(struct file *file, struct address_space *mapping,
165 loff_t pos, unsigned len, unsigned flags, 173 loff_t pos, unsigned len, unsigned flags,
166 struct page **pagep, void **fsdata) 174 struct page **pagep, void **fsdata)
@@ -169,11 +177,8 @@ static int bfs_write_begin(struct file *file, struct address_space *mapping,
169 177
170 ret = block_write_begin(mapping, pos, len, flags, pagep, 178 ret = block_write_begin(mapping, pos, len, flags, pagep,
171 bfs_get_block); 179 bfs_get_block);
172 if (unlikely(ret)) { 180 if (unlikely(ret))
173 loff_t isize = mapping->host->i_size; 181 bfs_write_failed(mapping, pos + len);
174 if (pos + len > isize)
175 vmtruncate(mapping->host, isize);
176 }
177 182
178 return ret; 183 return ret;
179} 184}