aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
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
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')
-rw-r--r--fs/gfs2/acl.c2
-rw-r--r--fs/gfs2/bmap.c2
-rw-r--r--fs/gfs2/eattr.c2
-rw-r--r--fs/gfs2/inode.c23
-rw-r--r--fs/gfs2/ondisk.c6
-rw-r--r--fs/gfs2/ops_address.c2
-rw-r--r--fs/gfs2/ops_inode.c10
-rw-r--r--fs/gfs2/ops_vm.c2
-rw-r--r--fs/gfs2/quota.c8
-rw-r--r--fs/gfs2/rgrp.c11
10 files changed, 29 insertions, 39 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 87f6304f2f5..3908992b27a 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -74,7 +74,7 @@ int gfs2_acl_validate_remove(struct gfs2_inode *ip, int access)
74{ 74{
75 if (!GFS2_SB(&ip->i_inode)->sd_args.ar_posix_acl) 75 if (!GFS2_SB(&ip->i_inode)->sd_args.ar_posix_acl)
76 return -EOPNOTSUPP; 76 return -EOPNOTSUPP;
77 if (current->fsuid != ip->i_di.di_uid && !capable(CAP_FOWNER)) 77 if (current->fsuid != ip->i_inode.i_uid && !capable(CAP_FOWNER))
78 return -EPERM; 78 return -EPERM;
79 if (S_ISLNK(ip->i_inode.i_mode)) 79 if (S_ISLNK(ip->i_inode.i_mode))
80 return -EOPNOTSUPP; 80 return -EOPNOTSUPP;
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 481a0688254..0c913eecf88 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -819,7 +819,7 @@ static int do_grow(struct gfs2_inode *ip, u64 size)
819 if (error) 819 if (error)
820 goto out; 820 goto out;
821 821
822 error = gfs2_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid); 822 error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
823 if (error) 823 if (error)
824 goto out_gunlock_q; 824 goto out_gunlock_q;
825 825
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index 5208fa94aad..935cc9a5716 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -687,7 +687,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
687 if (error) 687 if (error)
688 goto out; 688 goto out;
689 689
690 error = gfs2_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid); 690 error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
691 if (error) 691 if (error)
692 goto out_gunlock_q; 692 goto out_gunlock_q;
693 693
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index de466043c91..0de9b22f454 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))
diff --git a/fs/gfs2/ondisk.c b/fs/gfs2/ondisk.c
index 6b50a5731a5..e224f6a2264 100644
--- a/fs/gfs2/ondisk.c
+++ b/fs/gfs2/ondisk.c
@@ -162,8 +162,8 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
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(ip->i_inode.i_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(ip->i_inode.i_uid);
166 str->di_gid = cpu_to_be32(di->di_gid); 166 str->di_gid = cpu_to_be32(ip->i_inode.i_gid);
167 str->di_nlink = cpu_to_be32(di->di_nlink); 167 str->di_nlink = cpu_to_be32(di->di_nlink);
168 str->di_size = cpu_to_be64(di->di_size); 168 str->di_size = cpu_to_be64(di->di_size);
169 str->di_blocks = cpu_to_be64(di->di_blocks); 169 str->di_blocks = cpu_to_be64(di->di_blocks);
@@ -191,8 +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_uid, "%u");
195 pv(di, di_gid, "%u");
196 pv(di, di_nlink, "%u"); 194 pv(di, di_nlink, "%u");
197 printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size); 195 printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size);
198 printk(KERN_INFO " di_blocks = %llu\n", (unsigned long long)di->di_blocks); 196 printk(KERN_INFO " di_blocks = %llu\n", (unsigned long long)di->di_blocks);
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 45a3d85b1d6..38b702a1824 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -386,7 +386,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
386 if (error) 386 if (error)
387 goto out_alloc_put; 387 goto out_alloc_put;
388 388
389 error = gfs2_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid); 389 error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
390 if (error) 390 if (error)
391 goto out_qunlock; 391 goto out_qunlock;
392 392
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index cf7a5bae395..efbcec3311b 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -196,8 +196,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
196 if (error) 196 if (error)
197 goto out_alloc; 197 goto out_alloc;
198 198
199 error = gfs2_quota_check(dip, dip->i_di.di_uid, 199 error = gfs2_quota_check(dip, dip->i_inode.i_uid, dip->i_inode.i_gid);
200 dip->i_di.di_gid);
201 if (error) 200 if (error)
202 goto out_gunlock_q; 201 goto out_gunlock_q;
203 202
@@ -673,8 +672,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
673 if (error) 672 if (error)
674 goto out_alloc; 673 goto out_alloc;
675 674
676 error = gfs2_quota_check(ndip, ndip->i_di.di_uid, 675 error = gfs2_quota_check(ndip, ndip->i_inode.i_uid, ndip->i_inode.i_gid);
677 ndip->i_di.di_gid);
678 if (error) 676 if (error)
679 goto out_gunlock_q; 677 goto out_gunlock_q;
680 678
@@ -885,8 +883,8 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
885 u32 ouid, ogid, nuid, ngid; 883 u32 ouid, ogid, nuid, ngid;
886 int error; 884 int error;
887 885
888 ouid = ip->i_di.di_uid; 886 ouid = inode->i_uid;
889 ogid = ip->i_di.di_gid; 887 ogid = inode->i_gid;
890 nuid = attr->ia_uid; 888 nuid = attr->ia_uid;
891 ngid = attr->ia_gid; 889 ngid = attr->ia_gid;
892 890
diff --git a/fs/gfs2/ops_vm.c b/fs/gfs2/ops_vm.c
index 5453d2947ab..45a5f11fc39 100644
--- a/fs/gfs2/ops_vm.c
+++ b/fs/gfs2/ops_vm.c
@@ -76,7 +76,7 @@ static int alloc_page_backing(struct gfs2_inode *ip, struct page *page)
76 if (error) 76 if (error)
77 goto out; 77 goto out;
78 78
79 error = gfs2_quota_check(ip, ip->i_di.di_uid, ip->i_di.di_gid); 79 error = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid);
80 if (error) 80 if (error)
81 goto out_gunlock_q; 81 goto out_gunlock_q;
82 82
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 5d00e9b2097..d0db881b55d 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -452,19 +452,19 @@ int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid)
452 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) 452 if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
453 return 0; 453 return 0;
454 454
455 error = qdsb_get(sdp, QUOTA_USER, ip->i_di.di_uid, CREATE, qd); 455 error = qdsb_get(sdp, QUOTA_USER, ip->i_inode.i_uid, CREATE, qd);
456 if (error) 456 if (error)
457 goto out; 457 goto out;
458 al->al_qd_num++; 458 al->al_qd_num++;
459 qd++; 459 qd++;
460 460
461 error = qdsb_get(sdp, QUOTA_GROUP, ip->i_di.di_gid, CREATE, qd); 461 error = qdsb_get(sdp, QUOTA_GROUP, ip->i_inode.i_gid, CREATE, qd);
462 if (error) 462 if (error)
463 goto out; 463 goto out;
464 al->al_qd_num++; 464 al->al_qd_num++;
465 qd++; 465 qd++;
466 466
467 if (uid != NO_QUOTA_CHANGE && uid != ip->i_di.di_uid) { 467 if (uid != NO_QUOTA_CHANGE && uid != ip->i_inode.i_uid) {
468 error = qdsb_get(sdp, QUOTA_USER, uid, CREATE, qd); 468 error = qdsb_get(sdp, QUOTA_USER, uid, CREATE, qd);
469 if (error) 469 if (error)
470 goto out; 470 goto out;
@@ -472,7 +472,7 @@ int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid)
472 qd++; 472 qd++;
473 } 473 }
474 474
475 if (gid != NO_QUOTA_CHANGE && gid != ip->i_di.di_gid) { 475 if (gid != NO_QUOTA_CHANGE && gid != ip->i_inode.i_gid) {
476 error = qdsb_get(sdp, QUOTA_GROUP, gid, CREATE, qd); 476 error = qdsb_get(sdp, QUOTA_GROUP, gid, CREATE, qd);
477 if (error) 477 if (error)
478 goto out; 478 goto out;
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 07dfd630505..ff0846528d5 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -1217,7 +1217,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip)
1217 al->al_alloced++; 1217 al->al_alloced++;
1218 1218
1219 gfs2_statfs_change(sdp, 0, -1, 0); 1219 gfs2_statfs_change(sdp, 0, -1, 0);
1220 gfs2_quota_change(ip, +1, ip->i_di.di_uid, ip->i_di.di_gid); 1220 gfs2_quota_change(ip, +1, ip->i_inode.i_uid, ip->i_inode.i_gid);
1221 1221
1222 spin_lock(&sdp->sd_rindex_spin); 1222 spin_lock(&sdp->sd_rindex_spin);
1223 rgd->rd_free_clone--; 1223 rgd->rd_free_clone--;
@@ -1261,7 +1261,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip)
1261 al->al_alloced++; 1261 al->al_alloced++;
1262 1262
1263 gfs2_statfs_change(sdp, 0, -1, 0); 1263 gfs2_statfs_change(sdp, 0, -1, 0);
1264 gfs2_quota_change(ip, +1, ip->i_di.di_uid, ip->i_di.di_gid); 1264 gfs2_quota_change(ip, +1, ip->i_inode.i_uid, ip->i_inode.i_gid);
1265 gfs2_trans_add_unrevoke(sdp, block); 1265 gfs2_trans_add_unrevoke(sdp, block);
1266 1266
1267 spin_lock(&sdp->sd_rindex_spin); 1267 spin_lock(&sdp->sd_rindex_spin);
@@ -1337,8 +1337,7 @@ void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen)
1337 gfs2_trans_add_rg(rgd); 1337 gfs2_trans_add_rg(rgd);
1338 1338
1339 gfs2_statfs_change(sdp, 0, +blen, 0); 1339 gfs2_statfs_change(sdp, 0, +blen, 0);
1340 gfs2_quota_change(ip, -(s64)blen, 1340 gfs2_quota_change(ip, -(s64)blen, ip->i_inode.i_uid, ip->i_inode.i_gid);
1341 ip->i_di.di_uid, ip->i_di.di_gid);
1342} 1341}
1343 1342
1344/** 1343/**
@@ -1366,7 +1365,7 @@ void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen)
1366 gfs2_trans_add_rg(rgd); 1365 gfs2_trans_add_rg(rgd);
1367 1366
1368 gfs2_statfs_change(sdp, 0, +blen, 0); 1367 gfs2_statfs_change(sdp, 0, +blen, 0);
1369 gfs2_quota_change(ip, -(s64)blen, ip->i_di.di_uid, ip->i_di.di_gid); 1368 gfs2_quota_change(ip, -(s64)blen, ip->i_inode.i_uid, ip->i_inode.i_gid);
1370 gfs2_meta_wipe(ip, bstart, blen); 1369 gfs2_meta_wipe(ip, bstart, blen);
1371} 1370}
1372 1371
@@ -1411,7 +1410,7 @@ static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, u64 blkno)
1411void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip) 1410void gfs2_free_di(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip)
1412{ 1411{
1413 gfs2_free_uninit_di(rgd, ip->i_num.no_addr); 1412 gfs2_free_uninit_di(rgd, ip->i_num.no_addr);
1414 gfs2_quota_change(ip, -1, ip->i_di.di_uid, ip->i_di.di_gid); 1413 gfs2_quota_change(ip, -1, ip->i_inode.i_uid, ip->i_inode.i_gid);
1415 gfs2_meta_wipe(ip, ip->i_num.no_addr, 1); 1414 gfs2_meta_wipe(ip, ip->i_num.no_addr, 1);
1416} 1415}
1417 1416