diff options
| author | Marco Stornelli <marco.stornelli@gmail.com> | 2012-12-15 05:57:37 -0500 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-12-20 18:40:54 -0500 |
| commit | 2d1b399b22a8042edbaf41b1f2086d4183422ce4 (patch) | |
| tree | e8d0b0799ae88766a41f27eb9ce0de5664b381bd /fs/nilfs2 | |
| parent | 3e7a806928ac2dcae1423d6879e4f7e86e59bb9e (diff) | |
nilfs2: 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/nilfs2')
| -rw-r--r-- | fs/nilfs2/file.c | 1 | ||||
| -rw-r--r-- | fs/nilfs2/inode.c | 24 | ||||
| -rw-r--r-- | fs/nilfs2/nilfs.h | 1 | ||||
| -rw-r--r-- | fs/nilfs2/recovery.c | 3 |
4 files changed, 18 insertions, 11 deletions
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c index 16f35f7423c5..61946883025c 100644 --- a/fs/nilfs2/file.c +++ b/fs/nilfs2/file.c | |||
| @@ -167,7 +167,6 @@ const struct file_operations nilfs_file_operations = { | |||
| 167 | }; | 167 | }; |
| 168 | 168 | ||
| 169 | const struct inode_operations nilfs_file_inode_operations = { | 169 | const struct inode_operations nilfs_file_inode_operations = { |
| 170 | .truncate = nilfs_truncate, | ||
| 171 | .setattr = nilfs_setattr, | 170 | .setattr = nilfs_setattr, |
| 172 | .permission = nilfs_permission, | 171 | .permission = nilfs_permission, |
| 173 | .fiemap = nilfs_fiemap, | 172 | .fiemap = nilfs_fiemap, |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 4d31d2cca7fd..6b49f14eac8c 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
| @@ -213,6 +213,16 @@ static int nilfs_set_page_dirty(struct page *page) | |||
| 213 | return ret; | 213 | return ret; |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | void nilfs_write_failed(struct address_space *mapping, loff_t to) | ||
| 217 | { | ||
| 218 | struct inode *inode = mapping->host; | ||
| 219 | |||
| 220 | if (to > inode->i_size) { | ||
| 221 | truncate_pagecache(inode, to, inode->i_size); | ||
| 222 | nilfs_truncate(inode); | ||
| 223 | } | ||
| 224 | } | ||
| 225 | |||
| 216 | static int nilfs_write_begin(struct file *file, struct address_space *mapping, | 226 | static int nilfs_write_begin(struct file *file, struct address_space *mapping, |
| 217 | loff_t pos, unsigned len, unsigned flags, | 227 | loff_t pos, unsigned len, unsigned flags, |
| 218 | struct page **pagep, void **fsdata) | 228 | struct page **pagep, void **fsdata) |
| @@ -227,10 +237,7 @@ static int nilfs_write_begin(struct file *file, struct address_space *mapping, | |||
| 227 | err = block_write_begin(mapping, pos, len, flags, pagep, | 237 | err = block_write_begin(mapping, pos, len, flags, pagep, |
| 228 | nilfs_get_block); | 238 | nilfs_get_block); |
| 229 | if (unlikely(err)) { | 239 | if (unlikely(err)) { |
| 230 | loff_t isize = mapping->host->i_size; | 240 | nilfs_write_failed(mapping, pos + len); |
| 231 | if (pos + len > isize) | ||
| 232 | vmtruncate(mapping->host, isize); | ||
| 233 | |||
| 234 | nilfs_transaction_abort(inode->i_sb); | 241 | nilfs_transaction_abort(inode->i_sb); |
| 235 | } | 242 | } |
| 236 | return err; | 243 | return err; |
| @@ -259,6 +266,7 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
| 259 | loff_t offset, unsigned long nr_segs) | 266 | loff_t offset, unsigned long nr_segs) |
| 260 | { | 267 | { |
| 261 | struct file *file = iocb->ki_filp; | 268 | struct file *file = iocb->ki_filp; |
| 269 | struct address_space *mapping = file->f_mapping; | ||
| 262 | struct inode *inode = file->f_mapping->host; | 270 | struct inode *inode = file->f_mapping->host; |
| 263 | ssize_t size; | 271 | ssize_t size; |
| 264 | 272 | ||
| @@ -278,7 +286,7 @@ nilfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
| 278 | loff_t end = offset + iov_length(iov, nr_segs); | 286 | loff_t end = offset + iov_length(iov, nr_segs); |
| 279 | 287 | ||
| 280 | if (end > isize) | 288 | if (end > isize) |
| 281 | vmtruncate(inode, isize); | 289 | nilfs_write_failed(mapping, end); |
| 282 | } | 290 | } |
| 283 | 291 | ||
| 284 | return size; | 292 | return size; |
| @@ -786,10 +794,8 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
| 786 | if ((iattr->ia_valid & ATTR_SIZE) && | 794 | if ((iattr->ia_valid & ATTR_SIZE) && |
| 787 | iattr->ia_size != i_size_read(inode)) { | 795 | iattr->ia_size != i_size_read(inode)) { |
| 788 | inode_dio_wait(inode); | 796 | inode_dio_wait(inode); |
| 789 | 797 | truncate_setsize(inode, iattr->ia_size); | |
| 790 | err = vmtruncate(inode, iattr->ia_size); | 798 | nilfs_truncate(inode); |
| 791 | if (unlikely(err)) | ||
| 792 | goto out_err; | ||
| 793 | } | 799 | } |
| 794 | 800 | ||
| 795 | setattr_copy(inode, iattr); | 801 | setattr_copy(inode, iattr); |
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 74cece80e9a3..9bc72dec3fa6 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
| @@ -277,6 +277,7 @@ extern void nilfs_update_inode(struct inode *, struct buffer_head *); | |||
| 277 | extern void nilfs_truncate(struct inode *); | 277 | extern void nilfs_truncate(struct inode *); |
| 278 | extern void nilfs_evict_inode(struct inode *); | 278 | extern void nilfs_evict_inode(struct inode *); |
| 279 | extern int nilfs_setattr(struct dentry *, struct iattr *); | 279 | extern int nilfs_setattr(struct dentry *, struct iattr *); |
| 280 | extern void nilfs_write_failed(struct address_space *mapping, loff_t to); | ||
| 280 | int nilfs_permission(struct inode *inode, int mask); | 281 | int nilfs_permission(struct inode *inode, int mask); |
| 281 | int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh); | 282 | int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh); |
| 282 | extern int nilfs_inode_dirty(struct inode *); | 283 | extern int nilfs_inode_dirty(struct inode *); |
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index f1626f5011c5..ff00a0b7acb9 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c | |||
| @@ -527,7 +527,8 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, | |||
| 527 | if (unlikely(err)) { | 527 | if (unlikely(err)) { |
| 528 | loff_t isize = inode->i_size; | 528 | loff_t isize = inode->i_size; |
| 529 | if (pos + blocksize > isize) | 529 | if (pos + blocksize > isize) |
| 530 | vmtruncate(inode, isize); | 530 | nilfs_write_failed(inode->i_mapping, |
| 531 | pos + blocksize); | ||
| 531 | goto failed_inode; | 532 | goto failed_inode; |
| 532 | } | 533 | } |
| 533 | 534 | ||
