Skip to content

Commit ca30bc9

Browse files
Christoph HellwigAl Viro
authored andcommitted
[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>
1 parent 72e8264 commit ca30bc9

4 files changed

Lines changed: 22 additions & 13 deletions

File tree

‎fs/hpfs/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,5 @@ const struct file_operations hpfs_file_ops =
143143
const struct inode_operations hpfs_file_iops =
144144
{
145145
.truncate = hpfs_truncate,
146-
.setattr = hpfs_notify_change,
146+
.setattr = hpfs_setattr,
147147
};

‎fs/hpfs/hpfs_fn.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ void hpfs_init_inode(struct inode *);
275275
void hpfs_read_inode(struct inode *);
276276
void hpfs_write_inode(struct inode *);
277277
void hpfs_write_inode_nolock(struct inode *);
278-
int hpfs_notify_change(struct dentry *, struct iattr *);
278+
int hpfs_setattr(struct dentry *, struct iattr *);
279279
void hpfs_write_if_changed(struct inode *);
280280
void hpfs_delete_inode(struct inode *);
281281

‎fs/hpfs/inode.c‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,19 +260,28 @@ void hpfs_write_inode_nolock(struct inode *i)
260260
brelse(bh);
261261
}
262262

263-
int hpfs_notify_change(struct dentry *dentry, struct iattr *attr)
263+
int hpfs_setattr(struct dentry *dentry, struct iattr *attr)
264264
{
265265
struct inode *inode = dentry->d_inode;
266-
int error=0;
266+
int error = -EINVAL;
267+
267268
lock_kernel();
268-
if ( ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size) ||
269-
(hpfs_sb(inode->i_sb)->sb_root == inode->i_ino) ) {
270-
error = -EINVAL;
271-
} else if ((error = inode_change_ok(inode, attr))) {
272-
} else if ((error = inode_setattr(inode, attr))) {
273-
} else {
274-
hpfs_write_inode(inode);
275-
}
269+
if (inode->i_ino == hpfs_sb(inode->i_sb)->sb_root)
270+
goto out_unlock;
271+
if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size > inode->i_size)
272+
goto out_unlock;
273+
274+
error = inode_change_ok(inode, attr);
275+
if (error)
276+
goto out_unlock;
277+
278+
error = inode_setattr(inode, attr);
279+
if (error)
280+
goto out_unlock;
281+
282+
hpfs_write_inode(inode);
283+
284+
out_unlock:
276285
unlock_kernel();
277286
return error;
278287
}

‎fs/hpfs/namei.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,5 +669,5 @@ const struct inode_operations hpfs_dir_iops =
669669
.rmdir = hpfs_rmdir,
670670
.mknod = hpfs_mknod,
671671
.rename = hpfs_rename,
672-
.setattr = hpfs_notify_change,
672+
.setattr = hpfs_setattr,
673673
};

0 commit comments

Comments
 (0)