aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-11-01 13:23:29 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-11-30 10:34:17 -0500
commit2933f9254a6af33db25270778c998a42029da668 (patch)
tree75dc8b32c901995352b0538607f2636cd2834a1d /fs/gfs2/inode.c
parentb60623c238b6a819bd04090139704e2cb57a751f (diff)
[GFS2] Shrink gfs2_inode (4) - di_uid/di_gid
Remove duplicate di_uid/di_gid fields in favour of using inode->i_uid/inode->i_gid instead. This saves 8 bytes. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index de466043c91a..0de9b22f454b 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -52,8 +52,6 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip)
52 52
53 inode->i_ino = ip->i_num.no_addr; 53 inode->i_ino = ip->i_num.no_addr;
54 inode->i_nlink = di->di_nlink; 54 inode->i_nlink = di->di_nlink;
55 inode->i_uid = di->di_uid;
56 inode->i_gid = di->di_gid;
57 i_size_write(inode, di->di_size); 55 i_size_write(inode, di->di_size);
58 inode->i_atime.tv_sec = di->di_atime; 56 inode->i_atime.tv_sec = di->di_atime;
59 inode->i_mtime.tv_sec = di->di_mtime; 57 inode->i_mtime.tv_sec = di->di_mtime;
@@ -87,8 +85,6 @@ void gfs2_inode_attr_out(struct gfs2_inode *ip)
87{ 85{
88 struct inode *inode = &ip->i_inode; 86 struct inode *inode = &ip->i_inode;
89 struct gfs2_dinode_host *di = &ip->i_di; 87 struct gfs2_dinode_host *di = &ip->i_di;
90 di->di_uid = inode->i_uid;
91 di->di_gid = inode->i_gid;
92 di->di_atime = inode->i_atime.tv_sec; 88 di->di_atime = inode->i_atime.tv_sec;
93 di->di_mtime = inode->i_mtime.tv_sec; 89 di->di_mtime = inode->i_mtime.tv_sec;
94 di->di_ctime = inode->i_ctime.tv_sec; 90 di->di_ctime = inode->i_ctime.tv_sec;
@@ -216,8 +212,8 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
216 break; 212 break;
217 }; 213 };
218 214
219 di->di_uid = be32_to_cpu(str->di_uid); 215 ip->i_inode.i_uid = be32_to_cpu(str->di_uid);
220 di->di_gid = be32_to_cpu(str->di_gid); 216 ip->i_inode.i_gid = be32_to_cpu(str->di_gid);
221 di->di_nlink = be32_to_cpu(str->di_nlink); 217 di->di_nlink = be32_to_cpu(str->di_nlink);
222 di->di_size = be64_to_cpu(str->di_size); 218 di->di_size = be64_to_cpu(str->di_size);
223 di->di_blocks = be64_to_cpu(str->di_blocks); 219 di->di_blocks = be64_to_cpu(str->di_blocks);
@@ -616,19 +612,19 @@ static void munge_mode_uid_gid(struct gfs2_inode *dip, unsigned int *mode,
616 unsigned int *uid, unsigned int *gid) 612 unsigned int *uid, unsigned int *gid)
617{ 613{
618 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir && 614 if (GFS2_SB(&dip->i_inode)->sd_args.ar_suiddir &&
619 (dip->i_inode.i_mode & S_ISUID) && dip->i_di.di_uid) { 615 (dip->i_inode.i_mode & S_ISUID) && dip->i_inode.i_uid) {
620 if (S_ISDIR(*mode)) 616 if (S_ISDIR(*mode))
621 *mode |= S_ISUID; 617 *mode |= S_ISUID;
622 else if (dip->i_di.di_uid != current->fsuid) 618 else if (dip->i_inode.i_uid != current->fsuid)
623 *mode &= ~07111; 619 *mode &= ~07111;
624 *uid = dip->i_di.di_uid; 620 *uid = dip->i_inode.i_uid;
625 } else 621 } else
626 *uid = current->fsuid; 622 *uid = current->fsuid;
627 623
628 if (dip->i_inode.i_mode & S_ISGID) { 624 if (dip->i_inode.i_mode & S_ISGID) {
629 if (S_ISDIR(*mode)) 625 if (S_ISDIR(*mode))
630 *mode |= S_ISGID; 626 *mode |= S_ISGID;
631 *gid = dip->i_di.di_gid; 627 *gid = dip->i_inode.i_gid;
632 } else 628 } else
633 *gid = current->fsgid; 629 *gid = current->fsgid;
634} 630}
@@ -783,8 +779,7 @@ static int link_dinode(struct gfs2_inode *dip, const struct qstr *name,
783 if (alloc_required < 0) 779 if (alloc_required < 0)
784 goto fail; 780 goto fail;
785 if (alloc_required) { 781 if (alloc_required) {
786 error = gfs2_quota_check(dip, dip->i_di.di_uid, 782 error = gfs2_quota_check(dip, dip->i_inode.i_uid, dip->i_inode.i_gid);
787 dip->i_di.di_gid);
788 if (error) 783 if (error)
789 goto fail_quota_locks; 784 goto fail_quota_locks;
790 785
@@ -1050,8 +1045,8 @@ int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
1050 return -EPERM; 1045 return -EPERM;
1051 1046
1052 if ((dip->i_inode.i_mode & S_ISVTX) && 1047 if ((dip->i_inode.i_mode & S_ISVTX) &&
1053 dip->i_di.di_uid != current->fsuid && 1048 dip->i_inode.i_uid != current->fsuid &&
1054 ip->i_di.di_uid != current->fsuid && !capable(CAP_FOWNER)) 1049 ip->i_inode.i_uid != current->fsuid && !capable(CAP_FOWNER))
1055 return -EPERM; 1050 return -EPERM;
1056 1051
1057 if (IS_APPEND(&dip->i_inode)) 1052 if (IS_APPEND(&dip->i_inode))