aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2010-06-04 05:30:02 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-08-09 16:47:37 -0400
commit1025774ce411f2bd4b059ad7b53f0003569b74fa (patch)
tree2be221c205cb5579652a6063e8ee27d1c72d1bbd /fs/nilfs2/inode.c
parenteef2380c187890816b73b1a4cb89a09203759469 (diff)
remove inode_setattr
Replace inode_setattr with opencoded variants of it in all callers. This moves the remaining call to vmtruncate into the filesystem methods where it can be replaced with the proper truncate sequence. In a few cases it was obvious that we would never end up calling vmtruncate so it was left out in the opencoded variant: spufs: explicitly checks for ATTR_SIZE earlier btrfs,hugetlbfs,logfs,dlmfs: explicitly clears ATTR_SIZE earlier ufs: contains an opencoded simple_seattr + truncate that sets the filesize just above In addition to that ncpfs called inode_setattr with handcrafted iattrs, which allowed to trim down the opencoded variant. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/nilfs2/inode.c')
-rw-r--r--fs/nilfs2/inode.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 5c694ece172e..051d279abb37 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -656,14 +656,27 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr)
656 err = nilfs_transaction_begin(sb, &ti, 0); 656 err = nilfs_transaction_begin(sb, &ti, 0);
657 if (unlikely(err)) 657 if (unlikely(err))
658 return err; 658 return err;
659 err = inode_setattr(inode, iattr); 659
660 if (!err && (iattr->ia_valid & ATTR_MODE)) 660 if ((iattr->ia_valid & ATTR_SIZE) &&
661 iattr->ia_size != i_size_read(inode)) {
662 err = vmtruncate(inode, iattr->ia_size);
663 if (unlikely(err))
664 goto out_err;
665 }
666
667 setattr_copy(inode, iattr);
668 mark_inode_dirty(inode);
669
670 if (iattr->ia_valid & ATTR_MODE) {
661 err = nilfs_acl_chmod(inode); 671 err = nilfs_acl_chmod(inode);
662 if (likely(!err)) 672 if (unlikely(err))
663 err = nilfs_transaction_commit(sb); 673 goto out_err;
664 else 674 }
665 nilfs_transaction_abort(sb); 675
676 return nilfs_transaction_commit(sb);
666 677
678out_err:
679 nilfs_transaction_abort(sb);
667 return err; 680 return err;
668} 681}
669 682