diff options
author | Marco Stornelli <marco.stornelli@gmail.com> | 2012-12-15 05:55:07 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-20 18:40:52 -0500 |
commit | d506848567b529e57dfbcc4e28747b9211ffb7e5 (patch) | |
tree | 7f8524976cc8ab1f04abe2701150cd3f43d81e9c /fs/hfsplus | |
parent | 86dd07d66a2f7284cfe2b771d062dd6c0e331766 (diff) |
hfsplus: 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/hfsplus')
-rw-r--r-- | fs/hfsplus/inode.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 2172aa5976f5..799b336b59f9 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -28,6 +28,16 @@ static int hfsplus_writepage(struct page *page, struct writeback_control *wbc) | |||
28 | return block_write_full_page(page, hfsplus_get_block, wbc); | 28 | return block_write_full_page(page, hfsplus_get_block, wbc); |
29 | } | 29 | } |
30 | 30 | ||
31 | static void hfsplus_write_failed(struct address_space *mapping, loff_t to) | ||
32 | { | ||
33 | struct inode *inode = mapping->host; | ||
34 | |||
35 | if (to > inode->i_size) { | ||
36 | truncate_pagecache(inode, to, inode->i_size); | ||
37 | hfsplus_file_truncate(inode); | ||
38 | } | ||
39 | } | ||
40 | |||
31 | static int hfsplus_write_begin(struct file *file, struct address_space *mapping, | 41 | static int hfsplus_write_begin(struct file *file, struct address_space *mapping, |
32 | loff_t pos, unsigned len, unsigned flags, | 42 | loff_t pos, unsigned len, unsigned flags, |
33 | struct page **pagep, void **fsdata) | 43 | struct page **pagep, void **fsdata) |
@@ -38,11 +48,8 @@ static int hfsplus_write_begin(struct file *file, struct address_space *mapping, | |||
38 | ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 48 | ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, |
39 | hfsplus_get_block, | 49 | hfsplus_get_block, |
40 | &HFSPLUS_I(mapping->host)->phys_size); | 50 | &HFSPLUS_I(mapping->host)->phys_size); |
41 | if (unlikely(ret)) { | 51 | if (unlikely(ret)) |
42 | loff_t isize = mapping->host->i_size; | 52 | hfsplus_write_failed(mapping, pos + len); |
43 | if (pos + len > isize) | ||
44 | vmtruncate(mapping->host, isize); | ||
45 | } | ||
46 | 53 | ||
47 | return ret; | 54 | return ret; |
48 | } | 55 | } |
@@ -116,6 +123,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb, | |||
116 | const struct iovec *iov, loff_t offset, unsigned long nr_segs) | 123 | const struct iovec *iov, loff_t offset, unsigned long nr_segs) |
117 | { | 124 | { |
118 | struct file *file = iocb->ki_filp; | 125 | struct file *file = iocb->ki_filp; |
126 | struct address_space *mapping = file->f_mapping; | ||
119 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; | 127 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; |
120 | ssize_t ret; | 128 | ssize_t ret; |
121 | 129 | ||
@@ -131,7 +139,7 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb, | |||
131 | loff_t end = offset + iov_length(iov, nr_segs); | 139 | loff_t end = offset + iov_length(iov, nr_segs); |
132 | 140 | ||
133 | if (end > isize) | 141 | if (end > isize) |
134 | vmtruncate(inode, isize); | 142 | hfsplus_write_failed(mapping, end); |
135 | } | 143 | } |
136 | 144 | ||
137 | return ret; | 145 | return ret; |
@@ -300,10 +308,8 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) | |||
300 | if ((attr->ia_valid & ATTR_SIZE) && | 308 | if ((attr->ia_valid & ATTR_SIZE) && |
301 | attr->ia_size != i_size_read(inode)) { | 309 | attr->ia_size != i_size_read(inode)) { |
302 | inode_dio_wait(inode); | 310 | inode_dio_wait(inode); |
303 | 311 | truncate_setsize(inode, attr->ia_size); | |
304 | error = vmtruncate(inode, attr->ia_size); | 312 | hfsplus_file_truncate(inode); |
305 | if (error) | ||
306 | return error; | ||
307 | } | 313 | } |
308 | 314 | ||
309 | setattr_copy(inode, attr); | 315 | setattr_copy(inode, attr); |
@@ -358,7 +364,6 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, | |||
358 | 364 | ||
359 | static const struct inode_operations hfsplus_file_inode_operations = { | 365 | static const struct inode_operations hfsplus_file_inode_operations = { |
360 | .lookup = hfsplus_file_lookup, | 366 | .lookup = hfsplus_file_lookup, |
361 | .truncate = hfsplus_file_truncate, | ||
362 | .setattr = hfsplus_setattr, | 367 | .setattr = hfsplus_setattr, |
363 | .setxattr = hfsplus_setxattr, | 368 | .setxattr = hfsplus_setxattr, |
364 | .getxattr = hfsplus_getxattr, | 369 | .getxattr = hfsplus_getxattr, |