diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-10-31 21:45:08 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-11-30 10:34:11 -0500 |
commit | e7f14f4d094ea1a9ce1953375f5bc1500c760c79 (patch) | |
tree | da539b26dedd351ecb591e7ccb571b94a679452e /fs/gfs2/inode.c | |
parent | af339c0241d0dd3b35f9097b4f4999bb22ffe502 (diff) |
[GFS2] Shrink gfs2_inode (2) - di_major/di_minor
This removes the device numbers from this structure by using
inode->i_rdev instead. It also cleans up the code in gfs2_mknod.
It results in shrinking the gfs2_inode by 8 bytes.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r-- | fs/gfs2/inode.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 7ba05fc553aa..a99591956544 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -51,17 +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 | |||
55 | switch (di->di_mode & S_IFMT) { | ||
56 | case S_IFBLK: | ||
57 | case S_IFCHR: | ||
58 | inode->i_rdev = MKDEV(di->di_major, di->di_minor); | ||
59 | break; | ||
60 | default: | ||
61 | inode->i_rdev = 0; | ||
62 | break; | ||
63 | }; | ||
64 | |||
65 | inode->i_mode = di->di_mode; | 54 | inode->i_mode = di->di_mode; |
66 | inode->i_nlink = di->di_nlink; | 55 | inode->i_nlink = di->di_nlink; |
67 | inode->i_uid = di->di_uid; | 56 | inode->i_uid = di->di_uid; |
@@ -222,6 +211,15 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
222 | return -ESTALE; | 211 | return -ESTALE; |
223 | 212 | ||
224 | di->di_mode = be32_to_cpu(str->di_mode); | 213 | di->di_mode = be32_to_cpu(str->di_mode); |
214 | ip->i_inode.i_rdev = 0; | ||
215 | switch (di->di_mode & S_IFMT) { | ||
216 | case S_IFBLK: | ||
217 | case S_IFCHR: | ||
218 | ip->i_inode.i_rdev = MKDEV(be32_to_cpu(str->di_major), | ||
219 | be32_to_cpu(str->di_minor)); | ||
220 | break; | ||
221 | }; | ||
222 | |||
225 | di->di_uid = be32_to_cpu(str->di_uid); | 223 | di->di_uid = be32_to_cpu(str->di_uid); |
226 | di->di_gid = be32_to_cpu(str->di_gid); | 224 | di->di_gid = be32_to_cpu(str->di_gid); |
227 | di->di_nlink = be32_to_cpu(str->di_nlink); | 225 | di->di_nlink = be32_to_cpu(str->di_nlink); |
@@ -230,8 +228,6 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) | |||
230 | di->di_atime = be64_to_cpu(str->di_atime); | 228 | di->di_atime = be64_to_cpu(str->di_atime); |
231 | di->di_mtime = be64_to_cpu(str->di_mtime); | 229 | di->di_mtime = be64_to_cpu(str->di_mtime); |
232 | di->di_ctime = be64_to_cpu(str->di_ctime); | 230 | di->di_ctime = be64_to_cpu(str->di_ctime); |
233 | di->di_major = be32_to_cpu(str->di_major); | ||
234 | di->di_minor = be32_to_cpu(str->di_minor); | ||
235 | 231 | ||
236 | di->di_goal_meta = be64_to_cpu(str->di_goal_meta); | 232 | di->di_goal_meta = be64_to_cpu(str->di_goal_meta); |
237 | di->di_goal_data = be64_to_cpu(str->di_goal_data); | 233 | di->di_goal_data = be64_to_cpu(str->di_goal_data); |
@@ -270,7 +266,6 @@ int gfs2_inode_refresh(struct gfs2_inode *ip) | |||
270 | } | 266 | } |
271 | 267 | ||
272 | error = gfs2_dinode_in(ip, dibh->b_data); | 268 | error = gfs2_dinode_in(ip, dibh->b_data); |
273 | |||
274 | brelse(dibh); | 269 | brelse(dibh); |
275 | ip->i_vn = ip->i_gl->gl_vn; | 270 | ip->i_vn = ip->i_gl->gl_vn; |
276 | 271 | ||
@@ -684,7 +679,7 @@ out: | |||
684 | static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | 679 | static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, |
685 | const struct gfs2_inum_host *inum, unsigned int mode, | 680 | const struct gfs2_inum_host *inum, unsigned int mode, |
686 | unsigned int uid, unsigned int gid, | 681 | unsigned int uid, unsigned int gid, |
687 | const u64 *generation) | 682 | const u64 *generation, dev_t dev) |
688 | { | 683 | { |
689 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 684 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
690 | struct gfs2_dinode *di; | 685 | struct gfs2_dinode *di; |
@@ -705,7 +700,8 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | |||
705 | di->di_size = cpu_to_be64(0); | 700 | di->di_size = cpu_to_be64(0); |
706 | di->di_blocks = cpu_to_be64(1); | 701 | di->di_blocks = cpu_to_be64(1); |
707 | di->di_atime = di->di_mtime = di->di_ctime = cpu_to_be64(get_seconds()); | 702 | di->di_atime = di->di_mtime = di->di_ctime = cpu_to_be64(get_seconds()); |
708 | di->di_major = di->di_minor = cpu_to_be32(0); | 703 | di->di_major = cpu_to_be32(MAJOR(dev)); |
704 | di->di_minor = cpu_to_be32(MINOR(dev)); | ||
709 | di->di_goal_meta = di->di_goal_data = cpu_to_be64(inum->no_addr); | 705 | di->di_goal_meta = di->di_goal_data = cpu_to_be64(inum->no_addr); |
710 | di->di_generation = cpu_to_be64(*generation); | 706 | di->di_generation = cpu_to_be64(*generation); |
711 | di->di_flags = cpu_to_be32(0); | 707 | di->di_flags = cpu_to_be32(0); |
@@ -740,7 +736,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | |||
740 | 736 | ||
741 | static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | 737 | static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, |
742 | unsigned int mode, const struct gfs2_inum_host *inum, | 738 | unsigned int mode, const struct gfs2_inum_host *inum, |
743 | const u64 *generation) | 739 | const u64 *generation, dev_t dev) |
744 | { | 740 | { |
745 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); | 741 | struct gfs2_sbd *sdp = GFS2_SB(&dip->i_inode); |
746 | unsigned int uid, gid; | 742 | unsigned int uid, gid; |
@@ -761,7 +757,7 @@ static int make_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl, | |||
761 | if (error) | 757 | if (error) |
762 | goto out_quota; | 758 | goto out_quota; |
763 | 759 | ||
764 | init_dinode(dip, gl, inum, mode, uid, gid, generation); | 760 | init_dinode(dip, gl, inum, mode, uid, gid, generation, dev); |
765 | gfs2_quota_change(dip, +1, uid, gid); | 761 | gfs2_quota_change(dip, +1, uid, gid); |
766 | gfs2_trans_end(sdp); | 762 | gfs2_trans_end(sdp); |
767 | 763 | ||
@@ -892,7 +888,7 @@ static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip) | |||
892 | */ | 888 | */ |
893 | 889 | ||
894 | struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | 890 | struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, |
895 | unsigned int mode) | 891 | unsigned int mode, dev_t dev) |
896 | { | 892 | { |
897 | struct inode *inode; | 893 | struct inode *inode; |
898 | struct gfs2_inode *dip = ghs->gh_gl->gl_object; | 894 | struct gfs2_inode *dip = ghs->gh_gl->gl_object; |
@@ -950,7 +946,7 @@ struct inode *gfs2_createi(struct gfs2_holder *ghs, const struct qstr *name, | |||
950 | goto fail_gunlock; | 946 | goto fail_gunlock; |
951 | } | 947 | } |
952 | 948 | ||
953 | error = make_dinode(dip, ghs[1].gh_gl, mode, &inum, &generation); | 949 | error = make_dinode(dip, ghs[1].gh_gl, mode, &inum, &generation, dev); |
954 | if (error) | 950 | if (error) |
955 | goto fail_gunlock2; | 951 | goto fail_gunlock2; |
956 | 952 | ||