diff options
author | Jan Kara <jack@suse.cz> | 2011-05-25 17:39:48 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-05-25 17:39:48 -0400 |
commit | ae24f28d39610a4810c78185cf599a771cf6ee1f (patch) | |
tree | a4969875b6345f6ee3eb8bdf3a0af823cab33e3f | |
parent | 556b27abf73833923d5cd4be80006292e1b31662 (diff) |
ext4: Convert ext4 to new truncate calling convention
Trivial conversion. Fixup one error handling case calling vmtruncate()
and remove ->truncate callback. We also fix a bug that IS_IMMUTABLE and
IS_APPEND files could not be truncated during failed writes. In fact, the
test can be completely removed as upper layers do necessary permission
checks for truncate in do_sys_[f]truncate() and may_open() anyway.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/file.c | 1 | ||||
-rw-r--r-- | fs/ext4/inode.c | 4 |
2 files changed, 1 insertions, 4 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 7b80d543b89e..2c0972322009 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -272,7 +272,6 @@ const struct file_operations ext4_file_operations = { | |||
272 | }; | 272 | }; |
273 | 273 | ||
274 | const struct inode_operations ext4_file_inode_operations = { | 274 | const struct inode_operations ext4_file_inode_operations = { |
275 | .truncate = ext4_truncate, | ||
276 | .setattr = ext4_setattr, | 275 | .setattr = ext4_setattr, |
277 | .getattr = ext4_getattr, | 276 | .getattr = ext4_getattr, |
278 | #ifdef CONFIG_EXT4_FS_XATTR | 277 | #ifdef CONFIG_EXT4_FS_XATTR |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 65576c02c6f5..50d0e9c64584 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -3511,7 +3511,7 @@ retry: | |||
3511 | loff_t end = offset + iov_length(iov, nr_segs); | 3511 | loff_t end = offset + iov_length(iov, nr_segs); |
3512 | 3512 | ||
3513 | if (end > isize) | 3513 | if (end > isize) |
3514 | vmtruncate(inode, isize); | 3514 | ext4_truncate_failed_write(inode); |
3515 | } | 3515 | } |
3516 | } | 3516 | } |
3517 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) | 3517 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |
@@ -4407,8 +4407,6 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, | |||
4407 | 4407 | ||
4408 | int ext4_can_truncate(struct inode *inode) | 4408 | int ext4_can_truncate(struct inode *inode) |
4409 | { | 4409 | { |
4410 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | ||
4411 | return 0; | ||
4412 | if (S_ISREG(inode->i_mode)) | 4410 | if (S_ISREG(inode->i_mode)) |
4413 | return 1; | 4411 | return 1; |
4414 | if (S_ISDIR(inode->i_mode)) | 4412 | if (S_ISDIR(inode->i_mode)) |