Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Christoph Hellwig and committed by
Al Viro
ca30bc99 72e8264e

+22 -13
+1 -1
fs/hpfs/file.c
··· 143 143 const struct inode_operations hpfs_file_iops = 144 144 { 145 145 .truncate = hpfs_truncate, 146 - .setattr = hpfs_notify_change, 146 + .setattr = hpfs_setattr, 147 147 };
+1 -1
fs/hpfs/hpfs_fn.h
··· 275 275 void hpfs_read_inode(struct inode *); 276 276 void hpfs_write_inode(struct inode *); 277 277 void hpfs_write_inode_nolock(struct inode *); 278 - int hpfs_notify_change(struct dentry *, struct iattr *); 278 + int hpfs_setattr(struct dentry *, struct iattr *); 279 279 void hpfs_write_if_changed(struct inode *); 280 280 void hpfs_delete_inode(struct inode *); 281 281
+19 -10
fs/hpfs/inode.c
··· 260 260 brelse(bh); 261 261 } 262 262 263 - int hpfs_notify_change(struct dentry *dentry, struct iattr *attr) 263 + int hpfs_setattr(struct dentry *dentry, struct iattr *attr) 264 264 { 265 265 struct inode *inode = dentry->d_inode; 266 - int error=0; 266 + int error = -EINVAL; 267 + 267 268 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: 276 285 unlock_kernel(); 277 286 return error; 278 287 }
+1 -1
fs/hpfs/namei.c
··· 669 669 .rmdir = hpfs_rmdir, 670 670 .mknod = hpfs_mknod, 671 671 .rename = hpfs_rename, 672 - .setattr = hpfs_notify_change, 672 + .setattr = hpfs_setattr, 673 673 };