drm/radeon: fix PM on non-vram cards.
[safe/jmp/linux-2.6] / fs / hpfs / inode.c
index 85d3e1d..1042a9b 100644 (file)
@@ -6,6 +6,8 @@
  *  inode VFS functions
  */
 
+#include <linux/smp_lock.h>
+#include <linux/slab.h>
 #include "hpfs_fn.h"
 
 void hpfs_init_inode(struct inode *i)
@@ -45,7 +47,7 @@ void hpfs_read_inode(struct inode *i)
        struct fnode *fnode;
        struct super_block *sb = i->i_sb;
        struct hpfs_inode_info *hpfs_inode = hpfs_i(i);
-       unsigned char *ea;
+       void *ea;
        int ea_size;
 
        if (!(fnode = hpfs_map_fnode(sb, i->i_ino, &bh))) {
@@ -111,7 +113,7 @@ void hpfs_read_inode(struct inode *i)
                }
        }
        if (fnode->dirflag) {
-               unsigned n_dnodes, n_subdirs;
+               int n_dnodes, n_subdirs;
                i->i_mode |= S_IFDIR;
                i->i_op = &hpfs_dir_iops;
                i->i_fop = &hpfs_dir_ops;
@@ -260,19 +262,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;
 }