aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-11-01 12:22:46 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-11-30 10:34:14 -0500
commitb60623c238b6a819bd04090139704e2cb57a751f (patch)
treefcecc0599003db66d937138be94bef4b4372f15b /fs/gfs2
parente7f14f4d094ea1a9ce1953375f5bc1500c760c79 (diff)
[GFS2] Shrink gfs2_inode (3) - di_mode
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/acl.c16
-rw-r--r--fs/gfs2/bmap.c2
-rw-r--r--fs/gfs2/eaops.c2
-rw-r--r--fs/gfs2/eattr.c8
-rw-r--r--fs/gfs2/glock.c2
-rw-r--r--fs/gfs2/glops.c8
-rw-r--r--fs/gfs2/inode.c18
-rw-r--r--fs/gfs2/inode.h2
-rw-r--r--fs/gfs2/ondisk.c3
-rw-r--r--fs/gfs2/ops_address.c1
-rw-r--r--fs/gfs2/ops_dentry.c2
-rw-r--r--fs/gfs2/ops_file.c6
-rw-r--r--fs/gfs2/ops_inode.c17
-rw-r--r--fs/gfs2/ops_super.c2
14 files changed, 41 insertions, 48 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 906e403b054f..87f6304f2f54 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -76,9 +76,9 @@ int gfs2_acl_validate_remove(struct gfs2_inode *ip, int access)
76 return -EOPNOTSUPP; 76 return -EOPNOTSUPP;
77 if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER)) 77 if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER))
78 return -EPERM; 78 return -EPERM;
79 if (S_ISLNK(ip->i_di.di_mode)) 79 if (S_ISLNK(ip->i_inode.i_mode))
80 return -EOPNOTSUPP; 80 return -EOPNOTSUPP;
81 if (!access && !S_ISDIR(ip->i_di.di_mode)) 81 if (!access && !S_ISDIR(ip->i_inode.i_mode))
82 return -EACCES; 82 return -EACCES;
83 83
84 return 0; 84 return 0;
@@ -198,8 +198,8 @@ static int munge_mode(struct gfs2_inode *ip, mode_t mode)
198 error = gfs2_meta_inode_buffer(ip, &dibh); 198 error = gfs2_meta_inode_buffer(ip, &dibh);
199 if (!error) { 199 if (!error) {
200 gfs2_assert_withdraw(sdp, 200 gfs2_assert_withdraw(sdp,
201 (ip->i_di.di_mode & S_IFMT) == (mode & S_IFMT)); 201 (ip->i_inode.i_mode & S_IFMT) == (mode & S_IFMT));
202 ip->i_di.di_mode = mode; 202 ip->i_inode.i_mode = mode;
203 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 203 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
204 gfs2_dinode_out(ip, dibh->b_data); 204 gfs2_dinode_out(ip, dibh->b_data);
205 brelse(dibh); 205 brelse(dibh);
@@ -215,12 +215,12 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
215 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); 215 struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode);
216 struct posix_acl *acl = NULL, *clone; 216 struct posix_acl *acl = NULL, *clone;
217 struct gfs2_ea_request er; 217 struct gfs2_ea_request er;
218 mode_t mode = ip->i_di.di_mode; 218 mode_t mode = ip->i_inode.i_mode;
219 int error; 219 int error;
220 220
221 if (!sdp->sd_args.ar_posix_acl) 221 if (!sdp->sd_args.ar_posix_acl)
222 return 0; 222 return 0;
223 if (S_ISLNK(ip->i_di.di_mode)) 223 if (S_ISLNK(ip->i_inode.i_mode))
224 return 0; 224 return 0;
225 225
226 memset(&er, 0, sizeof(struct gfs2_ea_request)); 226 memset(&er, 0, sizeof(struct gfs2_ea_request));
@@ -232,7 +232,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
232 return error; 232 return error;
233 if (!acl) { 233 if (!acl) {
234 mode &= ~current->fs->umask; 234 mode &= ~current->fs->umask;
235 if (mode != ip->i_di.di_mode) 235 if (mode != ip->i_inode.i_mode)
236 error = munge_mode(ip, mode); 236 error = munge_mode(ip, mode);
237 return error; 237 return error;
238 } 238 }
@@ -244,7 +244,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
244 posix_acl_release(acl); 244 posix_acl_release(acl);
245 acl = clone; 245 acl = clone;
246 246
247 if (S_ISDIR(ip->i_di.di_mode)) { 247 if (S_ISDIR(ip->i_inode.i_mode)) {
248 er.er_name = GFS2_POSIX_ACL_DEFAULT; 248 er.er_name = GFS2_POSIX_ACL_DEFAULT;
249 er.er_name_len = GFS2_POSIX_ACL_DEFAULT_LEN; 249 er.er_name_len = GFS2_POSIX_ACL_DEFAULT_LEN;
250 error = gfs2_system_eaops.eo_set(ip, &er); 250 error = gfs2_system_eaops.eo_set(ip, &er);
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 8c092ab2b4ba..481a06882544 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -1109,7 +1109,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, u64 size)
1109{ 1109{
1110 int error; 1110 int error;
1111 1111
1112 if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_di.di_mode))) 1112 if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_inode.i_mode)))
1113 return -EINVAL; 1113 return -EINVAL;
1114 1114
1115 if (size > ip->i_di.di_size) 1115 if (size > ip->i_di.di_size)
diff --git a/fs/gfs2/eaops.c b/fs/gfs2/eaops.c
index 92c54e9b0dc3..cd747c00f670 100644
--- a/fs/gfs2/eaops.c
+++ b/fs/gfs2/eaops.c
@@ -120,7 +120,7 @@ static int system_eo_set(struct gfs2_inode *ip, struct gfs2_ea_request *er)
120 120
121 if (GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len)) { 121 if (GFS2_ACL_IS_ACCESS(er->er_name, er->er_name_len)) {
122 if (!(er->er_flags & GFS2_ERF_MODE)) { 122 if (!(er->er_flags & GFS2_ERF_MODE)) {
123 er->er_mode = ip->i_di.di_mode; 123 er->er_mode = ip->i_inode.i_mode;
124 er->er_flags |= GFS2_ERF_MODE; 124 er->er_flags |= GFS2_ERF_MODE;
125 } 125 }
126 error = gfs2_acl_validate_set(ip, 1, er, 126 error = gfs2_acl_validate_set(ip, 1, er,
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 9b7bb565b59d..5208fa94aad2 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -711,9 +711,9 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
711 if (!error) { 711 if (!error) {
712 if (er->er_flags & GFS2_ERF_MODE) { 712 if (er->er_flags & GFS2_ERF_MODE) {
713 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), 713 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
714 (ip->i_di.di_mode & S_IFMT) == 714 (ip->i_inode.i_mode & S_IFMT) ==
715 (er->er_mode & S_IFMT)); 715 (er->er_mode & S_IFMT));
716 ip->i_di.di_mode = er->er_mode; 716 ip->i_inode.i_mode = er->er_mode;
717 } 717 }
718 ip->i_di.di_ctime = get_seconds(); 718 ip->i_di.di_ctime = get_seconds();
719 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 719 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,
847 847
848 if (er->er_flags & GFS2_ERF_MODE) { 848 if (er->er_flags & GFS2_ERF_MODE) {
849 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode), 849 gfs2_assert_withdraw(GFS2_SB(&ip->i_inode),
850 (ip->i_di.di_mode & S_IFMT) == (er->er_mode & S_IFMT)); 850 (ip->i_inode.i_mode & S_IFMT) == (er->er_mode & S_IFMT));
851 ip->i_di.di_mode = er->er_mode; 851 ip->i_inode.i_mode = er->er_mode;
852 } 852 }
853 ip->i_di.di_ctime = get_seconds(); 853 ip->i_di.di_ctime = get_seconds();
854 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 854 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 78fe0fae23ff..44633c46717a 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -2078,7 +2078,7 @@ static int dump_inode(struct gfs2_inode *ip)
2078 printk(KERN_INFO " num = %llu %llu\n", 2078 printk(KERN_INFO " num = %llu %llu\n",
2079 (unsigned long long)ip->i_num.no_formal_ino, 2079 (unsigned long long)ip->i_num.no_formal_ino,
2080 (unsigned long long)ip->i_num.no_addr); 2080 (unsigned long long)ip->i_num.no_addr);
2081 printk(KERN_INFO " type = %u\n", IF2DT(ip->i_di.di_mode)); 2081 printk(KERN_INFO " type = %u\n", IF2DT(ip->i_inode.i_mode));
2082 printk(KERN_INFO " i_flags ="); 2082 printk(KERN_INFO " i_flags =");
2083 for (x = 0; x < 32; x++) 2083 for (x = 0; x < 32; x++)
2084 if (test_bit(x, &ip->i_flags)) 2084 if (test_bit(x, &ip->i_flags))
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index 5406b193227c..aad45b7a927d 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -92,7 +92,7 @@ static void gfs2_pte_inval(struct gfs2_glock *gl)
92 92
93 ip = gl->gl_object; 93 ip = gl->gl_object;
94 inode = &ip->i_inode; 94 inode = &ip->i_inode;
95 if (!ip || !S_ISREG(ip->i_di.di_mode)) 95 if (!ip || !S_ISREG(inode->i_mode))
96 return; 96 return;
97 97
98 if (!test_bit(GIF_PAGED, &ip->i_flags)) 98 if (!test_bit(GIF_PAGED, &ip->i_flags))
@@ -119,7 +119,7 @@ static void gfs2_page_inval(struct gfs2_glock *gl)
119 119
120 ip = gl->gl_object; 120 ip = gl->gl_object;
121 inode = &ip->i_inode; 121 inode = &ip->i_inode;
122 if (!ip || !S_ISREG(ip->i_di.di_mode)) 122 if (!ip || !S_ISREG(inode->i_mode))
123 return; 123 return;
124 124
125 truncate_inode_pages(inode->i_mapping, 0); 125 truncate_inode_pages(inode->i_mapping, 0);
@@ -142,7 +142,7 @@ static void gfs2_page_wait(struct gfs2_glock *gl)
142 struct address_space *mapping = inode->i_mapping; 142 struct address_space *mapping = inode->i_mapping;
143 int error; 143 int error;
144 144
145 if (!S_ISREG(ip->i_di.di_mode)) 145 if (!S_ISREG(inode->i_mode))
146 return; 146 return;
147 147
148 error = filemap_fdatawait(mapping); 148 error = filemap_fdatawait(mapping);
@@ -164,7 +164,7 @@ static void gfs2_page_writeback(struct gfs2_glock *gl)
164 struct inode *inode = &ip->i_inode; 164 struct inode *inode = &ip->i_inode;
165 struct address_space *mapping = inode->i_mapping; 165 struct address_space *mapping = inode->i_mapping;
166 166
167 if (!S_ISREG(ip->i_di.di_mode)) 167 if (!S_ISREG(inode->i_mode))
168 return; 168 return;
169 169
170 filemap_fdatawrite(mapping); 170 filemap_fdatawrite(mapping);
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index a99591956544..de466043c91a 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -51,7 +51,6 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip)
51 struct gfs2_dinode_host *di = &ip->i_di; 51 struct gfs2_dinode_host *di = &ip->i_di;
52 52
53 inode->i_ino = ip->i_num.no_addr; 53 inode->i_ino = ip->i_num.no_addr;
54 inode->i_mode = di->di_mode;
55 inode->i_nlink = di->di_nlink; 54 inode->i_nlink = di->di_nlink;
56 inode->i_uid = di->di_uid; 55 inode->i_uid = di->di_uid;
57 inode->i_gid = di->di_gid; 56 inode->i_gid = di->di_gid;
@@ -88,9 +87,6 @@ void gfs2_inode_attr_out(struct gfs2_inode *ip)
88{ 87{
89 struct inode *inode = &ip->i_inode; 88 struct inode *inode = &ip->i_inode;
90 struct gfs2_dinode_host *di = &ip->i_di; 89 struct gfs2_dinode_host *di = &ip->i_di;
91 gfs2_assert_withdraw(GFS2_SB(inode),
92 (di->di_mode & S_IFMT) == (inode->i_mode & S_IFMT));
93 di->di_mode = inode->i_mode;
94 di->di_uid = inode->i_uid; 90 di->di_uid = inode->i_uid;
95 di->di_gid = inode->i_gid; 91 di->di_gid = inode->i_gid;
96 di->di_atime = inode->i_atime.tv_sec; 92 di->di_atime = inode->i_atime.tv_sec;
@@ -210,9 +206,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
210 if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino)) 206 if (ip->i_num.no_formal_ino != be64_to_cpu(str->di_num.no_formal_ino))
211 return -ESTALE; 207 return -ESTALE;
212 208
213 di->di_mode = be32_to_cpu(str->di_mode); 209 ip->i_inode.i_mode = be32_to_cpu(str->di_mode);
214 ip->i_inode.i_rdev = 0; 210 ip->i_inode.i_rdev = 0;
215 switch (di->di_mode & S_IFMT) { 211 switch (ip->i_inode.i_mode & S_IFMT) {
216 case S_IFBLK: 212 case S_IFBLK:
217 case S_IFCHR: 213 case S_IFCHR:
218 ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major), 214 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,
620 unsigned int *uid, unsigned int *gid) 616 unsigned int *uid, unsigned int *gid)
621{ 617{
622 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && 618 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
623 (dip->i_di.di_mode & S_ISUID) && dip->i_di.di_uid) { 619 (dip->i_inode.i_mode & S_ISUID) && dip->i_di.di_uid) {
624 if (S_ISDIR(*mode)) 620 if (S_ISDIR(*mode))
625 *mode |= S_ISUID; 621 *mode |= S_ISUID;
626 else if (dip->i_di.di_uid != current->fsuid) 622 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,
629 } else 625 } else
630 *uid = current->fsuid; 626 *uid = current->fsuid;
631 627
632 if (dip->i_di.di_mode & S_ISGID) { 628 if (dip->i_inode.i_mode & S_ISGID) {
633 if (S_ISDIR(*mode)) 629 if (S_ISDIR(*mode))
634 *mode |= S_ISGID; 630 *mode |= S_ISGID;
635 *gid = dip->i_di.di_gid; 631 *gid = dip->i_di.di_gid;
@@ -810,7 +806,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
810 goto fail_quota_locks; 806 goto fail_quota_locks;
811 } 807 }
812 808
813 error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_di.di_mode)); 809 error = gfs2_dir_add(&dip->i_inode, name, &ip->i_num, IF2DT(ip->i_inode.i_mode));
814 if (error) 810 if (error)
815 goto fail_end_trans; 811 goto fail_end_trans;
816 812
@@ -1053,7 +1049,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
1053 if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode)) 1049 if (IS_IMMUTABLE(&ip->i_inode) || IS_APPEND(&ip->i_inode))
1054 return -EPERM; 1050 return -EPERM;
1055 1051
1056 if ((dip->i_di.di_mode & S_ISVTX) && 1052 if ((dip->i_inode.i_mode & S_ISVTX) &&
1057 dip->i_di.di_uid != current->fsuid && 1053 dip->i_di.di_uid != current->fsuid &&
1058 ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER)) 1054 ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER))
1059 return -EPERM; 1055 return -EPERM;
@@ -1072,7 +1068,7 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
1072 if (!gfs2_inum_equal(&inum, &ip->i_num)) 1068 if (!gfs2_inum_equal(&inum, &ip->i_num))
1073 return -ENOENT; 1069 return -ENOENT;
1074 1070
1075 if (IF2DT(ip->i_di.di_mode) != type) { 1071 if (IF2DT(ip->i_inode.i_mode) != type) {
1076 gfs2_consist_inode(dip); 1072 gfs2_consist_inode(dip);
1077 return -EIO; 1073 return -EIO;
1078 } 1074 }
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h
index 33c9ea68f7e7..69cbf98509a9 100644
--- a/fs/gfs2/inode.h
+++ b/fs/gfs2/inode.h
@@ -22,7 +22,7 @@ static inline int gfs2_is_jdata(struct gfs2_inode *ip)
22 22
23static inline int gfs2_is_dir(struct gfs2_inode *ip) 23static inline int gfs2_is_dir(struct gfs2_inode *ip)
24{ 24{
25 return S_ISDIR(ip->i_di.di_mode); 25 return S_ISDIR(ip->i_inode.i_mode);
26} 26}
27 27
28void gfs2_inode_attr_in(struct gfs2_inode *ip); 28void gfs2_inode_attr_in(struct gfs2_inode *ip);
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c
index 60dd943761ab..6b50a5731a51 100644
--- a/fs/gfs2/ondisk.c
+++ b/fs/gfs2/ondisk.c
@@ -161,7 +161,7 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
161 161
162 gfs2_inum_out(&ip->i_num, &str->di_num); 162 gfs2_inum_out(&ip->i_num, &str->di_num);
163 163
164 str->di_mode = cpu_to_be32(di->di_mode); 164 str->di_mode = cpu_to_be32(ip->i_inode.i_mode);
165 str->di_uid = cpu_to_be32(di->di_uid); 165 str->di_uid = cpu_to_be32(di->di_uid);
166 str->di_gid = cpu_to_be32(di->di_gid); 166 str->di_gid = cpu_to_be32(di->di_gid);
167 str->di_nlink = cpu_to_be32(di->di_nlink); 167 str->di_nlink = cpu_to_be32(di->di_nlink);
@@ -191,7 +191,6 @@ void gfs2_dinode_print(const struct gfs2_inode *ip)
191 191
192 gfs2_inum_print(&ip->i_num); 192 gfs2_inum_print(&ip->i_num);
193 193
194 pv(di, di_mode, "0%o");
195 pv(di, di_uid, "%u"); 194 pv(di, di_uid, "%u");
196 pv(di, di_gid, "%u"); 195 pv(di, di_gid, "%u");
197 pv(di, di_nlink, "%u"); 196 pv(di, di_nlink, "%u");
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 015640b3f123..45a3d85b1d68 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -498,7 +498,6 @@ static int gfs2_commit_write(struct file *file, struct page *page,
498 di->di_size = cpu_to_be64(inode->i_size); 498 di->di_size = cpu_to_be64(inode->i_size);
499 } 499 }
500 500
501 di->di_mode = cpu_to_be32(inode->i_mode);
502 di->di_atime = cpu_to_be64(inode->i_atime.tv_sec); 501 di->di_atime = cpu_to_be64(inode->i_atime.tv_sec);
503 di->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec); 502 di->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec);
504 di->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec); 503 di->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec);
diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c
index c36f9e342e66..d355899585d8 100644
--- a/fs/gfs2/ops_dentry.c
+++ b/fs/gfs2/ops_dentry.c
@@ -76,7 +76,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd)
76 if (!gfs2_inum_equal(&ip->i_num, &inum)) 76 if (!gfs2_inum_equal(&ip->i_num, &inum))
77 goto invalid_gunlock; 77 goto invalid_gunlock;
78 78
79 if (IF2DT(ip->i_di.di_mode) != type) { 79 if (IF2DT(ip->i_inode.i_mode) != type) {
80 gfs2_consist_inode(dip); 80 gfs2_consist_inode(dip);
81 goto fail_gunlock; 81 goto fail_gunlock;
82 } 82 }
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 7ea417573903..b52b9db1a2bd 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -425,7 +425,7 @@ static int gfs2_open(struct inode *inode, struct file *file)
425 gfs2_assert_warn(GFS2_SB(inode), !file->private_data); 425 gfs2_assert_warn(GFS2_SB(inode), !file->private_data);
426 file->private_data = fp; 426 file->private_data = fp;
427 427
428 if (S_ISREG(ip->i_di.di_mode)) { 428 if (S_ISREG(ip->i_inode.i_mode)) {
429 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, 429 error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
430 &i_gh); 430 &i_gh);
431 if (error) 431 if (error)
@@ -515,7 +515,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
515 515
516 if (!(fl->fl_flags & FL_POSIX)) 516 if (!(fl->fl_flags & FL_POSIX))
517 return -ENOLCK; 517 return -ENOLCK;
518 if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) 518 if ((ip->i_inode.i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
519 return -ENOLCK; 519 return -ENOLCK;
520 520
521 if (sdp->sd_args.ar_localflocks) { 521 if (sdp->sd_args.ar_localflocks) {
@@ -617,7 +617,7 @@ static int gfs2_flock(struct file *file, int cmd, struct file_lock *fl)
617 617
618 if (!(fl->fl_flags & FL_FLOCK)) 618 if (!(fl->fl_flags & FL_FLOCK))
619 return -ENOLCK; 619 return -ENOLCK;
620 if ((ip->i_di.di_mode & (S_ISGID | S_IXGRP)) == S_ISGID) 620 if ((ip->i_inode.i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
621 return -ENOLCK; 621 return -ENOLCK;
622 622
623 if (sdp->sd_args.ar_localflocks) 623 if (sdp->sd_args.ar_localflocks)
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index c10b914bf8cc..cf7a5bae3957 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -144,7 +144,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
144 int alloc_required; 144 int alloc_required;
145 int error; 145 int error;
146 146
147 if (S_ISDIR(ip->i_di.di_mode)) 147 if (S_ISDIR(inode->i_mode))
148 return -EPERM; 148 return -EPERM;
149 149
150 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); 150 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,
220 } 220 }
221 221
222 error = gfs2_dir_add(dir, &dentry->d_name, &ip->i_num, 222 error = gfs2_dir_add(dir, &dentry->d_name, &ip->i_num,
223 IF2DT(ip->i_di.di_mode)); 223 IF2DT(inode->i_mode));
224 if (error) 224 if (error)
225 goto out_end_trans; 225 goto out_end_trans;
226 226
@@ -564,11 +564,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
564 564
565 /* Make sure we aren't trying to move a dirctory into it's subdir */ 565 /* Make sure we aren't trying to move a dirctory into it's subdir */
566 566
567 if (S_ISDIR(ip->i_di.di_mode) && odip != ndip) { 567 if (S_ISDIR(ip->i_inode.i_mode) && odip != ndip) {
568 dir_rename = 1; 568 dir_rename = 1;
569 569
570 error = gfs2_glock_nq_init(sdp->sd_rename_gl, 570 error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE, 0,
571 LM_ST_EXCLUSIVE, 0,
572 &r_gh); 571 &r_gh);
573 if (error) 572 if (error)
574 goto out; 573 goto out;
@@ -609,7 +608,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
609 if (error) 608 if (error)
610 goto out_gunlock; 609 goto out_gunlock;
611 610
612 if (S_ISDIR(nip->i_di.di_mode)) { 611 if (S_ISDIR(nip->i_inode.i_mode)) {
613 if (nip->i_di.di_entries < 2) { 612 if (nip->i_di.di_entries < 2) {
614 if (gfs2_consist_inode(nip)) 613 if (gfs2_consist_inode(nip))
615 gfs2_dinode_print(nip); 614 gfs2_dinode_print(nip);
@@ -646,7 +645,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
646 error = -EFBIG; 645 error = -EFBIG;
647 goto out_gunlock; 646 goto out_gunlock;
648 } 647 }
649 if (S_ISDIR(ip->i_di.di_mode) && 648 if (S_ISDIR(ip->i_inode.i_mode) &&
650 ndip->i_di.di_nlink == (u32)-1) { 649 ndip->i_di.di_nlink == (u32)-1) {
651 error = -EMLINK; 650 error = -EMLINK;
652 goto out_gunlock; 651 goto out_gunlock;
@@ -701,7 +700,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
701 /* Remove the target file, if it exists */ 700 /* Remove the target file, if it exists */
702 701
703 if (nip) { 702 if (nip) {
704 if (S_ISDIR(nip->i_di.di_mode)) 703 if (S_ISDIR(nip->i_inode.i_mode))
705 error = gfs2_rmdiri(ndip, &ndentry->d_name, nip); 704 error = gfs2_rmdiri(ndip, &ndentry->d_name, nip);
706 else { 705 else {
707 error = gfs2_dir_del(ndip, &ndentry->d_name); 706 error = gfs2_dir_del(ndip, &ndentry->d_name);
@@ -743,7 +742,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
743 goto out_end_trans; 742 goto out_end_trans;
744 743
745 error = gfs2_dir_add(ndir, &ndentry->d_name, &ip->i_num, 744 error = gfs2_dir_add(ndir, &ndentry->d_name, &ip->i_num,
746 IF2DT(ip->i_di.di_mode)); 745 IF2DT(ip->i_inode.i_mode));
747 if (error) 746 if (error)
748 goto out_end_trans; 747 goto out_end_trans;
749 748
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index 9c786d1e702d..863517569223 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -407,7 +407,7 @@ static void gfs2_delete_inode(struct inode *inode)
407 if (error) 407 if (error)
408 goto out_uninit; 408 goto out_uninit;
409 409
410 if (S_ISDIR(ip->i_di.di_mode) && 410 if (S_ISDIR(inode->i_mode) &&
411 (ip->i_di.di_flags & GFS2_DIF_EXHASH)) { 411 (ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
412 error = gfs2_dir_exhash_dealloc(ip); 412 error = gfs2_dir_exhash_dealloc(ip);
413 if (error) 413 if (error)