Merge branch 'we21-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/linville...
[powerpc.git] / fs / gfs2 / ops_inode.c
index 8fb7c5c..ef6e5ed 100644 (file)
@@ -4,7 +4,7 @@
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License v.2.
+ * of the GNU General Public License version 2.
  */
 
 #include <linux/sched.h>
 #include <linux/posix_acl.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
+#include <linux/lm_interface.h>
 #include <asm/uaccess.h>
 
 #include "gfs2.h"
-#include "lm_interface.h"
 #include "incore.h"
 #include "acl.h"
 #include "bmap.h"
@@ -172,7 +172,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
        if (!dip->i_di.di_nlink)
                goto out_gunlock;
        error = -EFBIG;
-       if (dip->i_di.di_entries == (uint32_t)-1)
+       if (dip->i_di.di_entries == (u32)-1)
                goto out_gunlock;
        error = -EPERM;
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
@@ -181,7 +181,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
        if (!ip->i_di.di_nlink)
                goto out_gunlock;
        error = -EMLINK;
-       if (ip->i_di.di_nlink == (uint32_t)-1)
+       if (ip->i_di.di_nlink == (u32)-1)
                goto out_gunlock;
 
        alloc_required = error = gfs2_diradd_alloc_required(dir, &dentry->d_name);
@@ -228,32 +228,25 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
 
 out_end_trans:
        gfs2_trans_end(sdp);
-
 out_ipres:
        if (alloc_required)
                gfs2_inplace_release(dip);
-
 out_gunlock_q:
        if (alloc_required)
                gfs2_quota_unlock(dip);
-
 out_alloc:
        if (alloc_required)
                gfs2_alloc_put(dip);
-
 out_gunlock:
        gfs2_glock_dq_m(2, ghs);
-
 out:
        gfs2_holder_uninit(ghs);
        gfs2_holder_uninit(ghs + 1);
-
        if (!error) {
                atomic_inc(&inode->i_count);
                d_instantiate(dentry, inode);
                mark_inode_dirty(inode);
        }
-
        return error;
 }
 
@@ -411,17 +404,17 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
                gfs2_trans_add_bh(ip->i_gl, dibh, 1);
                gfs2_qstr2dirent(&str, GFS2_DIRENT_SIZE(str.len), dent);
                dent->de_inum = di->di_num; /* already GFS2 endian */
-               dent->de_type = DT_DIR;
+               dent->de_type = cpu_to_be16(DT_DIR);
                di->di_entries = cpu_to_be32(1);
 
                gfs2_str2qstr(&str, "..");
                dent = (struct gfs2_dirent *)((char*)dent + GFS2_DIRENT_SIZE(1));
                gfs2_qstr2dirent(&str, dibh->b_size - GFS2_DIRENT_SIZE(1) - sizeof(struct gfs2_dinode), dent);
 
-               gfs2_inum_out(&dip->i_num, (char *) &dent->de_inum);
-               dent->de_type = DT_DIR;
+               gfs2_inum_out(&dip->i_num, &dent->de_inum);
+               dent->de_type = cpu_to_be16(DT_DIR);
 
-               gfs2_dinode_out(&ip->i_di, (char *)di);
+               gfs2_dinode_out(&ip->i_di, di);
 
                brelse(dibh);
        }
@@ -491,13 +484,11 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
 
        gfs2_trans_end(sdp);
 
- out_gunlock:
+out_gunlock:
        gfs2_glock_dq_m(2, ghs);
-
- out:
+out:
        gfs2_holder_uninit(ghs);
        gfs2_holder_uninit(ghs + 1);
-
        return error;
 }
 
@@ -518,7 +509,7 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
        struct gfs2_holder ghs[2];
        struct inode *inode;
        struct buffer_head *dibh;
-       uint32_t major = 0, minor = 0;
+       u32 major = 0, minor = 0;
        int error;
 
        switch (mode & S_IFMT) {
@@ -531,7 +522,7 @@ static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
        case S_IFSOCK:
                break;
        default:
-               return -EOPNOTSUPP;             
+               return -EOPNOTSUPP;
        };
 
        gfs2_holder_init(dip->i_gl, 0, 0, ghs);
@@ -679,12 +670,12 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                                error = -EINVAL;
                                goto out_gunlock;
                        }
-                       if (ndip->i_di.di_entries == (uint32_t)-1) {
+                       if (ndip->i_di.di_entries == (u32)-1) {
                                error = -EFBIG;
                                goto out_gunlock;
                        }
                        if (S_ISDIR(ip->i_di.di_mode) &&
-                           ndip->i_di.di_nlink == (uint32_t)-1) {
+                           ndip->i_di.di_nlink == (u32)-1) {
                                error = -EMLINK;
                                goto out_gunlock;
                        }
@@ -920,7 +911,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct buffer_head *dibh;
-       uint32_t ouid, ogid, nuid, ngid;
+       u32 ouid, ogid, nuid, ngid;
        int error;
 
        ouid = ip->i_di.di_uid;
@@ -966,15 +957,12 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
                gfs2_quota_change(ip, ip->i_di.di_blocks, nuid, ngid);
        }
 
- out_end_trans:
+out_end_trans:
        gfs2_trans_end(sdp);
-
- out_gunlock_q:
+out_gunlock_q:
        gfs2_quota_unlock(ip);
-
- out_alloc:
+out_alloc:
        gfs2_alloc_put(ip);
-
        return error;
 }
 
@@ -1017,18 +1005,16 @@ static int gfs2_setattr(struct dentry *dentry, struct iattr *attr)
        else
                error = gfs2_setattr_simple(ip, attr);
 
- out:
+out:
        gfs2_glock_dq_uninit(&i_gh);
-
        if (!error)
                mark_inode_dirty(inode);
-
        return error;
 }
 
 /**
  * gfs2_getattr - Read out an inode's attributes
- * @mnt: ?
+ * @mnt: The vfsmount the inode is being accessed from
  * @dentry: The dentry to stat
  * @stat: The inode's stats
  *