Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347794
b: refs/heads/master
c: cfac4b4
h: refs/heads/master
v: v3
  • Loading branch information
Marco Stornelli authored and Al Viro committed Dec 20, 2012
1 parent 10585eb commit 206e34a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa4d62ae17c7415f1ea824076870b7ad9b51fd06
refs/heads/master: cfac4b47c664e207740880d6492938761c53d74b
3 changes: 1 addition & 2 deletions trunk/fs/reiserfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int reiserfs_file_open(struct inode *inode, struct file *file)
return err;
}

static void reiserfs_vfs_truncate_file(struct inode *inode)
void reiserfs_vfs_truncate_file(struct inode *inode)
{
mutex_lock(&(REISERFS_I(inode)->tailpack));
reiserfs_truncate_file(inode, 1);
Expand Down Expand Up @@ -312,7 +312,6 @@ const struct file_operations reiserfs_file_operations = {
};

const struct inode_operations reiserfs_file_inode_operations = {
.truncate = reiserfs_vfs_truncate_file,
.setattr = reiserfs_setattr,
.setxattr = reiserfs_setxattr,
.getxattr = reiserfs_getxattr,
Expand Down
15 changes: 11 additions & 4 deletions trunk/fs/reiserfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3085,8 +3085,10 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
loff_t isize = i_size_read(inode);
loff_t end = offset + iov_length(iov, nr_segs);

if (end > isize)
vmtruncate(inode, isize);
if ((end > isize) && inode_newsize_ok(inode, isize) == 0) {
truncate_setsize(inode, isize);
reiserfs_vfs_truncate_file(inode);
}
}

return ret;
Expand Down Expand Up @@ -3200,8 +3202,13 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
*/
reiserfs_write_unlock_once(inode->i_sb, depth);
if ((attr->ia_valid & ATTR_SIZE) &&
attr->ia_size != i_size_read(inode))
error = vmtruncate(inode, attr->ia_size);
attr->ia_size != i_size_read(inode)) {
error = inode_newsize_ok(inode, attr->ia_size);
if (!error) {
truncate_setsize(inode, attr->ia_size);
reiserfs_vfs_truncate_file(inode);
}
}

if (!error) {
setattr_copy(inode, attr);
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/reiserfs/reiserfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2455,6 +2455,7 @@ struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct
*,
int count);
int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *);
void reiserfs_vfs_truncate_file(struct inode *inode);
int reiserfs_commit_page(struct inode *inode, struct page *page,
unsigned from, unsigned to);
void reiserfs_flush_old_commits(struct super_block *);
Expand Down

0 comments on commit 206e34a

Please sign in to comment.