]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
[GFS2] Shrink gfs2_inode (3) - di_mode
authorSteven Whitehouse <swhiteho@redhat.com>
Wed, 1 Nov 2006 17:22:46 +0000 (12:22 -0500)
committerSteven Whitehouse <swhiteho@redhat.com>
Thu, 30 Nov 2006 15:34:14 +0000 (10:34 -0500)
This removes the duplicate di_mode field in favour of using the
inode->i_mode field. This saves 4 bytes.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
15 files changed:
fs/gfs2/acl.c
fs/gfs2/bmap.c
fs/gfs2/eaops.c
fs/gfs2/eattr.c
fs/gfs2/glock.c
fs/gfs2/glops.c
fs/gfs2/inode.c
fs/gfs2/inode.h
fs/gfs2/ondisk.c
fs/gfs2/ops_address.c
fs/gfs2/ops_dentry.c
fs/gfs2/ops_file.c
fs/gfs2/ops_inode.c
fs/gfs2/ops_super.c
include/linux/gfs2_ondisk.h

index 906e403b054fd590eb044434ee00e0708fb44df0..87f6304f2f54161cd30134d339145866651eb291 100644 (file)
@@ -76,9 +76,9 @@ int gfs2_acl_validate_remove(struct gfs2_inode *ip, int access)
                return -EOPNOTSUPP;
        if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER))
                return -EPERM;
-       if (S_ISLNK(ip->i_di.di_mode))
+       if (S_ISLNK(ip->i_inode.i_mode))
                return -EOPNOTSUPP;
-       if (!access && !S_ISDIR(ip->i_di.di_mode))
+       if (!access && !S_ISDIR(ip->i_inode.i_mode))
                return -EACCES;
 
        return 0;
@@ -198,8 +198,8 @@ static int munge_mode(struct gfs2_inode *ip, mode_t mode)
        error = gfs2_meta_inode_buffer(ip, &dibh);
        if (!error) {
                gfs2_assert_withdraw(sdp,
-                               (ip->i_di.di_mode & S_IFMT) == (mode & S_IFMT));
-               ip->i_di.di_mode = mode;
+                               (ip->i_inode.i_mode & S_IFMT) == (mode & S_IFMT));
+               ip->i_inode.i_mode = mode;
                gfs2_trans_add_bh(ip->i_gl, dibh, 1);
                gfs2_dinode_out(ip, dibh->b_data);
                brelse(dibh);
@@ -215,12 +215,12 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
        struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
        struct posix_acl *acl = NULL, *clone;
        struct gfs2_ea_request er;
-       mode_t mode = ip->i_di.di_mode;
+       mode_t mode = ip->i_inode.i_mode;
        int error;
 
        if (!sdp->sd_args.ar_posix_acl)
                return 0;
-       if (S_ISLNK(ip->i_di.di_mode))
+       if (S_ISLNK(ip->i_inode.i_mode))
                return 0;
 
        memset(&er, 0, sizeof(struct gfs2_ea_request));
@@ -232,7 +232,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
                return error;
        if (!acl) {
                mode &= ~current->fs->umask;
-               if (mode != ip->i_di.di_mode)
+               if (mode != ip->i_inode.i_mode)
                        error = munge_mode(ip, mode);
                return error;
        }
@@ -244,7 +244,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
        posix_acl_release(acl);
        acl = clone;
 
-       if (S_ISDIR(ip->i_di.di_mode)) {
+       if (S_ISDIR(ip->i_inode.i_mode)) {
                er.er_name = GFS2_POSIX_ACL_DEFAULT;
                er.er_name_len = GFS2_POSIX_ACL_DEFAULT_LEN;
                error = gfs2_system_eaops.eo_set(ip, &er);
index 8c092ab2b4ba77400253e6626d2940a0d28af9e9..481a068825446dfabce616ca1dafeb816518b42a 100644 (file)
@@ -1109,7 +1109,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, u64 size)
 {
        int error;
 
-       if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_di.di_mode)))
+       if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_inode.i_mode)))
                return -EINVAL;
 
        if (size > ip->i_di.di_size)
index 92c54e9b0dc3b8592cec55b33c0ba61d185ac37f..cd747c00f670363db6f2dbe41164858e56b4778f 100644 (file)
@@ -120,7 +120,7 @@ static int system_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
 
        if (GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len)) {
                if (!(er->er_flags & GFS2_ERF_MODE)) {
-                       er->er_mode = ip->i_di.di_mode;
+                       er->er_mode = ip->i_inode.i_mode;
                        er->er_flags |= GFS2_ERF_MODE;
                }
                error = gfs2_acl_validate_set(ip, 1, er,
index 9b7bb565b59d864e4d888c1c29c2521b96d82730..5208fa94aad2c201efe1680b90a58e8f214f2067 100644 (file)
@@ -711,9 +711,9 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
        if (!error) {
                if (er->er_flags & GFS2_ERF_MODE) {
                        gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
-                                           (ip->i_di.di_mode & S_IFMT) ==
+                                           (ip->i_inode.i_mode & S_IFMT) ==
                                            (er->er_mode & S_IFMT));
-                       ip->i_di.di_mode = er->er_mode;
+                       ip->i_inode.i_mode = er->er_mode;
                }
                ip->i_di.di_ctime = get_seconds();
                gfs2_trans_add_bh(ip->i_gl, dibh, 1);
@@ -847,8 +847,8 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
 
        if (er->er_flags & GFS2_ERF_MODE) {
                gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
-                       (ip->i_di.di_mode & S_IFMT) == (er->er_mode & S_IFMT));
-               ip->i_di.di_mode = er->er_mode;
+                       (ip->i_inode.i_mode & S_IFMT) == (er->er_mode & S_IFMT));
+               ip->i_inode.i_mode = er->er_mode;
        }
        ip->i_di.di_ctime = get_seconds();
        gfs2_trans_add_bh(ip->i_gl, dibh, 1);
index 78fe0fae23ff538d26af8f3d15a877dd61368e72..44633c46717a7f3ff9ec62b88da4fdff4d9149ba 100644 (file)
@@ -2078,7 +2078,7 @@ static int dump_inode(struct gfs2_inode *ip)
        printk(KERN_INFO "    num = %llu %llu\n",
                    (unsigned long long)ip->i_num.no_formal_ino,
                    (unsigned long long)ip->i_num.no_addr);
-       printk(KERN_INFO "    type = %u\n", IF2DT(ip->i_di.di_mode));
+       printk(KERN_INFO "    type = %u\n", IF2DT(ip->i_inode.i_mode));
        printk(KERN_INFO "    i_flags =");
        for (x = 0; x < 32; x++)
                if (test_bit(x, &ip->i_flags))
index 5406b193227cc19759f7b6771a10523b31b44e5c..aad45b7a927dfd4347543830d505fd496ed24a31 100644 (file)
@@ -92,7 +92,7 @@ static void gfs2_pte_inval(struct gfs2_glock *gl)
 
        ip = gl->gl_object;
        inode = &ip->i_inode;
-       if (!ip || !S_ISREG(ip->i_di.di_mode))
+       if (!ip || !S_ISREG(inode->i_mode))
                return;
 
        if (!test_bit(GIF_PAGED, &ip->i_flags))
@@ -119,7 +119,7 @@ static void gfs2_page_inval(struct gfs2_glock *gl)
 
        ip = gl->gl_object;
        inode = &ip->i_inode;
-       if (!ip || !S_ISREG(ip->i_di.di_mode))
+       if (!ip || !S_ISREG(inode->i_mode))
                return;
 
        truncate_inode_pages(inode->i_mapping, 0);
@@ -142,7 +142,7 @@ static void gfs2_page_wait(struct gfs2_glock *gl)
        struct address_space *mapping = inode->i_mapping;
        int error;
 
-       if (!S_ISREG(ip->i_di.di_mode))
+       if (!S_ISREG(inode->i_mode))
                return;
 
        error = filemap_fdatawait(mapping);
@@ -164,7 +164,7 @@ static void gfs2_page_writeback(struct gfs2_glock *gl)
        struct inode *inode = &ip->i_inode;
        struct address_space *mapping = inode->i_mapping;
 
-       if (!S_ISREG(ip->i_di.di_mode))
+       if (!S_ISREG(inode->i_mode))
                return;
 
        filemap_fdatawrite(mapping);
index a99591956544e6a87daa8d6b0793aad8713bd4b7..de466043c91a508af8953565babceff55f1bdbe2 100644 (file)
@@ -51,7 +51,6 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip)
        struct gfs2_dinode_host *di = &ip->i_di;
 
        inode->i_ino = ip->i_num.no_addr;
-       inode->i_mode = di->di_mode;
        inode->i_nlink = di->di_nlink;
        inode->i_uid = di->di_uid;
        inode->i_gid = di->di_gid;
@@ -88,9 +87,6 @@ void gfs2_inode_attr_out(struct gfs2_inode *ip)
 {
        struct inode *inode = &ip->i_inode;
        struct gfs2_dinode_host *di = &ip->i_di;
-       gfs2_assert_withdraw(GFS2_SB(inode),
-               (di->di_mode & S_IFMT) == (inode->i_mode & S_IFMT));
-       di->di_mode = inode->i_mode;
        di->di_uid = inode->i_uid;
        di->di_gid = inode->i_gid;
        di->di_atime = inode->i_atime.tv_sec;
@@ -210,9 +206,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
        if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino))
                return -ESTALE;
 
-       di->di_mode = be32_to_cpu(str->di_mode);
+       ip->i_inode.i_mode = be32_to_cpu(str->di_mode);
        ip->i_inode.i_rdev = 0;
-       switch (di->di_mode & S_IFMT) {
+       switch (ip->i_inode.i_mode & S_IFMT) {
        case S_IFBLK:
        case S_IFCHR:
                ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major),
@@ -620,7 +616,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode,
                               unsigned int *uid, unsigned int *gid)
 {
        if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
-           (dip->i_di.di_mode & S_ISUID) && dip->i_di.di_uid) {
+           (dip->i_inode.i_mode & S_ISUID) && dip->i_di.di_uid) {
                if (S_ISDIR(*mode))
                        *mode |= S_ISUID;
                else if (dip->i_di.di_uid != current->fsuid)
@@ -629,7 +625,7 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode,
        } else
                *uid = current->fsuid;
 
-       if (dip->i_di.di_mode & S_ISGID) {
+       if (dip->i_inode.i_mode & S_ISGID) {
                if (S_ISDIR(*mode))
                        *mode |= S_ISGID;
                *gid = dip->i_di.di_gid;
@@ -810,7 +806,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
                        goto fail_quota_locks;
        }
 
-       error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_di.di_mode));
+       error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_inode.i_mode));
        if (error)
                goto fail_end_trans;
 
@@ -1053,7 +1049,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
        if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
                return -EPERM;
 
-       if ((dip->i_di.di_mode & S_ISVTX) &&
+       if ((dip->i_inode.i_mode & S_ISVTX) &&
            dip->i_di.di_uid != current->fsuid &&
            ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER))
                return -EPERM;
@@ -1072,7 +1068,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
        if (!gfs2_inum_equal(&inum, &ip->i_num))
                return -ENOENT;
 
-       if (IF2DT(ip->i_di.di_mode) != type) {
+       if (IF2DT(ip->i_inode.i_mode) != type) {
                gfs2_consist_inode(dip);
                return -EIO;
        }
index 33c9ea68f7e7bc235e6c4a5b0415cd7b501f1c57..69cbf98509a9e361cb719dbd6b2b625fca02f5ad 100644 (file)
@@ -22,7 +22,7 @@ static inline int gfs2_is_jdata(struct gfs2_inode *ip)
 
 static inline int gfs2_is_dir(struct gfs2_inode *ip)
 {
-       return S_ISDIR(ip->i_di.di_mode);
+       return S_ISDIR(ip->i_inode.i_mode);
 }
 
 void gfs2_inode_attr_in(struct gfs2_inode *ip);
index 60dd943761aba15f86cd984631c7fd5593dbed28..6b50a5731a511db378808af9f0b52d85b9913290 100644 (file)
@@ -161,7 +161,7 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
 
        gfs2_inum_out(&ip->i_num, &str->di_num);
 
-       str->di_mode = cpu_to_be32(di->di_mode);
+       str->di_mode = cpu_to_be32(ip->i_inode.i_mode);
        str->di_uid = cpu_to_be32(di->di_uid);
        str->di_gid = cpu_to_be32(di->di_gid);
        str->di_nlink = cpu_to_be32(di->di_nlink);
@@ -191,7 +191,6 @@ void gfs2_dinode_print(const struct gfs2_inode *ip)
 
        gfs2_inum_print(&ip->i_num);
 
-       pv(di, di_mode, "0%o");
        pv(di, di_uid, "%u");
        pv(di, di_gid, "%u");
        pv(di, di_nlink, "%u");
index 015640b3f123fcde76a28195c1859577c38ef9b7..45a3d85b1d6837f02e557ee383182949a4550899 100644 (file)
@@ -498,7 +498,6 @@ static int gfs2_commit_write(struct file *file, struct page *page,
                di->di_size = cpu_to_be64(inode->i_size);
        }
 
-       di->di_mode = cpu_to_be32(inode->i_mode);
        di->di_atime = cpu_to_be64(inode->i_atime.tv_sec);
        di->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec);
        di->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec);
index c36f9e342e66e6e715cf45cda89eb33ae6698a47..d355899585d822b800d15f2d8826734bc2d02a6f 100644 (file)
@@ -76,7 +76,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
        if (!gfs2_inum_equal(&ip->i_num, &inum))
                goto invalid_gunlock;
 
-       if (IF2DT(ip->i_di.di_mode) != type) {
+       if (IF2DT(ip->i_inode.i_mode) != type) {
                gfs2_consist_inode(dip);
                goto fail_gunlock;
        }
index 7ea4175739030d70c364fc33d633c8748fe4e379..b52b9db1a2bdb0605bfee978ed933dd60531d163 100644 (file)
@@ -425,7 +425,7 @@ static int gfs2_open(struct inode *inode, struct file *file)
        gfs2_assert_warn(GFS2_SB(inode), !file->private_data);
        file->private_data = fp;
 
-       if (S_ISREG(ip->i_di.di_mode)) {
+       if (S_ISREG(ip->i_inode.i_mode)) {
                error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
                                           &i_gh);
                if (error)
@@ -515,7 +515,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
 
        if (!(fl->fl_flags & FL_POSIX))
                return -ENOLCK;
-       if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+       if ((ip->i_inode.i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
                return -ENOLCK;
 
        if (sdp->sd_args.ar_localflocks) {
@@ -617,7 +617,7 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
 
        if (!(fl->fl_flags & FL_FLOCK))
                return -ENOLCK;
-       if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+       if ((ip->i_inode.i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
                return -ENOLCK;
 
        if (sdp->sd_args.ar_localflocks)
index c10b914bf8cc40f979eab4961f9e54460f8cf93f..cf7a5bae3957e5458627b8e8897e209edda44ffb 100644 (file)
@@ -144,7 +144,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
        int alloc_required;
        int error;
 
-       if (S_ISDIR(ip->i_di.di_mode))
+       if (S_ISDIR(inode->i_mode))
                return -EPERM;
 
        gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
@@ -220,7 +220,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
        }
 
        error = gfs2_dir_add(dir, &dentry->d_name, &ip->i_num,
-                            IF2DT(ip->i_di.di_mode));
+                            IF2DT(inode->i_mode));
        if (error)
                goto out_end_trans;
 
@@ -564,11 +564,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
 
        /* Make sure we aren't trying to move a dirctory into it's subdir */
 
-       if (S_ISDIR(ip->i_di.di_mode) && odip != ndip) {
+       if (S_ISDIR(ip->i_inode.i_mode) && odip != ndip) {
                dir_rename = 1;
 
-               error = gfs2_glock_nq_init(sdp->sd_rename_gl,
-                                          LM_ST_EXCLUSIVE, 0,
+               error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE, 0,
                                           &r_gh);
                if (error)
                        goto out;
@@ -609,7 +608,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                if (error)
                        goto out_gunlock;
 
-               if (S_ISDIR(nip->i_di.di_mode)) {
+               if (S_ISDIR(nip->i_inode.i_mode)) {
                        if (nip->i_di.di_entries < 2) {
                                if (gfs2_consist_inode(nip))
                                        gfs2_dinode_print(nip);
@@ -646,7 +645,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                                error = -EFBIG;
                                goto out_gunlock;
                        }
-                       if (S_ISDIR(ip->i_di.di_mode) &&
+                       if (S_ISDIR(ip->i_inode.i_mode) &&
                            ndip->i_di.di_nlink == (u32)-1) {
                                error = -EMLINK;
                                goto out_gunlock;
@@ -701,7 +700,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
        /* Remove the target file, if it exists */
 
        if (nip) {
-               if (S_ISDIR(nip->i_di.di_mode))
+               if (S_ISDIR(nip->i_inode.i_mode))
                        error = gfs2_rmdiri(ndip, &ndentry->d_name, nip);
                else {
                        error = gfs2_dir_del(ndip, &ndentry->d_name);
@@ -743,7 +742,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
                goto out_end_trans;
 
        error = gfs2_dir_add(ndir, &ndentry->d_name, &ip->i_num,
-                            IF2DT(ip->i_di.di_mode));
+                            IF2DT(ip->i_inode.i_mode));
        if (error)
                goto out_end_trans;
 
index 9c786d1e702deeb950f0e4cece1ed8348282cf69..8635175692234285db5031ff317b3202a9a8a982 100644 (file)
@@ -407,7 +407,7 @@ static void gfs2_delete_inode(struct inode *inode)
        if (error)
                goto out_uninit;
 
-       if (S_ISDIR(ip->i_di.di_mode) &&
+       if (S_ISDIR(inode->i_mode) &&
            (ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
                error = gfs2_dir_exhash_dealloc(ip);
                if (error)
index 5bcf895b27310f6f79540c4149440d970835e25b..f1ea0b48060b73ab0518439ba7757b16204cb739 100644 (file)
@@ -322,7 +322,6 @@ struct gfs2_dinode {
 };
 
 struct gfs2_dinode_host {
-       __u32 di_mode;  /* mode of file */
        __u32 di_uid;   /* owner's user id */
        __u32 di_gid;   /* owner's group id */
        __u32 di_nlink; /* number of links to this file */