summaryrefslogtreecommitdiffstats
path: root/fs/hpfs/inode.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2008-08-11 00:27:59 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-23 05:12:58 -0400
commitca30bc99527ab968707bafc09e38807de7e70c4a (patch)
tree3d4ea649fb23c0a8e9075855e90f4824042ca305 /fs/hpfs/inode.c
parent72e8264eda02b6ba85a222b9620802ebf23c6a10 (diff)
[PATCH] hpfs: cleanup ->setattr
Reformat hpfs_notify_change to standard kernel style to make it readable and rename it to hpfs_setattr as that's what the method is called. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hpfs/inode.c')
-rw-r--r--fs/hpfs/inode.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index 85d3e1d9ac0..39a1bfbea31 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -260,19 +260,28 @@ void hpfs_write_inode_nolock(struct inode *i)
brelse(bh);
}
-int hpfs_notify_change(struct dentry *dentry, struct iattr *attr)
+int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
{
struct inode *inode = dentry->d_inode;
- int error=0;
+ int error = -EINVAL;
+
lock_kernel();
- if ( ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) ||
- (hpfs_sb(inode->i_sb)->sb_root == inode->i_ino) ) {
- error = -EINVAL;
- } else if ((error = inode_change_ok(inode, attr))) {
- } else if ((error = inode_setattr(inode, attr))) {
- } else {
- hpfs_write_inode(inode);
- }
+ if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root)
+ goto out_unlock;
+ if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size)
+ goto out_unlock;
+
+ error = inode_change_ok(inode, attr);
+ if (error)
+ goto out_unlock;
+
+ error = inode_setattr(inode, attr);
+ if (error)
+ goto out_unlock;
+
+ hpfs_write_inode(inode);
+
+ out_unlock:
unlock_kernel();
return error;
}