diff options
author | Marco Stornelli <marco.stornelli@gmail.com> | 2012-12-15 11:45:58 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-20 14:00:01 -0500 |
commit | fa4d62ae17c7415f1ea824076870b7ad9b51fd06 (patch) | |
tree | cbb66b2be8f1c1a8cf8f1f89c9580af9f6056767 /fs/sysv/itree.c | |
parent | 83f6e3710a932d400100767ad445a4bd9476e083 (diff) | |
download | lwn-fa4d62ae17c7415f1ea824076870b7ad9b51fd06.tar.gz lwn-fa4d62ae17c7415f1ea824076870b7ad9b51fd06.zip |
sysv: 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/sysv/itree.c')
-rw-r--r-- | fs/sysv/itree.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/sysv/itree.c b/fs/sysv/itree.c index 90b54b438789..c1a591a4725b 100644 --- a/fs/sysv/itree.c +++ b/fs/sysv/itree.c @@ -464,6 +464,16 @@ int sysv_prepare_chunk(struct page *page, loff_t pos, unsigned len) return __block_write_begin(page, pos, len, get_block); } +static void sysv_write_failed(struct address_space *mapping, loff_t to) +{ + struct inode *inode = mapping->host; + + if (to > inode->i_size) { + truncate_pagecache(inode, to, inode->i_size); + sysv_truncate(inode); + } +} + static int sysv_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) @@ -471,11 +481,8 @@ static int sysv_write_begin(struct file *file, struct address_space *mapping, int ret; ret = block_write_begin(mapping, pos, len, flags, pagep, get_block); - if (unlikely(ret)) { - loff_t isize = mapping->host->i_size; - if (pos + len > isize) - vmtruncate(mapping->host, isize); - } + if (unlikely(ret)) + sysv_write_failed(mapping, pos + len); return ret; } |