aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <steve@chygwyn.com>2006-01-18 05:57:10 -0500
committerSteven Whitehouse <steve@chygwyn.com>2006-01-18 05:57:10 -0500
commitb96ca4fa4e3b510d528a093a5bac0befbc2ba46d (patch)
treee4ac82f1d0472d46c8ac30d351b044f1fb3f34d2 /fs/gfs2/inode.c
parent3bd7662c4de28522d4709ab5a56033e3c33e1d4a (diff)
[GFS2] Update init_dinode() to reduce stack usage
We no longer allocate a dinode on the stack in init_dinode() and we no longer use gfs2_dinode_out (eliminating one copy) and gfs2_meta_header_in (eliminating another copy). The meta_header_in fucntion is now no longer referenced from outside gfs2_ondisk.c, so make it static. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 73922dba5398..aa5311ef7ba7 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -993,37 +993,50 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
993 unsigned int uid, unsigned int gid) 993 unsigned int uid, unsigned int gid)
994{ 994{
995 struct gfs2_sbd *sdp = dip->i_sbd; 995 struct gfs2_sbd *sdp = dip->i_sbd;
996 struct gfs2_dinode di; 996 struct gfs2_dinode *di;
997 struct buffer_head *dibh; 997 struct buffer_head *dibh;
998 998
999 dibh = gfs2_meta_new(gl, inum->no_addr); 999 dibh = gfs2_meta_new(gl, inum->no_addr);
1000 gfs2_trans_add_bh(gl, dibh); 1000 gfs2_trans_add_bh(gl, dibh);
1001 gfs2_metatype_set(dibh, GFS2_METATYPE_DI, GFS2_FORMAT_DI); 1001 gfs2_metatype_set(dibh, GFS2_METATYPE_DI, GFS2_FORMAT_DI);
1002 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 1002 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
1003 1003 di = (struct gfs2_dinode *)dibh->b_data;
1004 memset(&di, 0, sizeof(struct gfs2_dinode)); 1004
1005 gfs2_meta_header_in(&di.di_header, dibh->b_data); 1005 di->di_num = *inum;
1006 di.di_num = *inum; 1006 di->di_mode = cpu_to_be32(mode);
1007 di.di_mode = mode; 1007 di->di_uid = cpu_to_be32(uid);
1008 di.di_uid = uid; 1008 di->di_gid = cpu_to_be32(gid);
1009 di.di_gid = gid; 1009 di->di_nlink = cpu_to_be32(0);
1010 di.di_blocks = 1; 1010 di->di_size = cpu_to_be64(0);
1011 di.di_atime = di.di_mtime = di.di_ctime = get_seconds(); 1011 di->di_blocks = cpu_to_be64(1);
1012 di.di_goal_meta = di.di_goal_data = inum->no_addr; 1012 di->di_atime = di->di_mtime = di->di_ctime = cpu_to_be64(get_seconds());
1013 di->di_major = di->di_minor = cpu_to_be32(0);
1014 di->di_goal_meta = di->di_goal_data = cpu_to_be64(inum->no_addr);
1015 di->__pad[0] = di->__pad[1] = 0;
1016 di->di_flags = cpu_to_be32(0);
1013 1017
1014 if (S_ISREG(mode)) { 1018 if (S_ISREG(mode)) {
1015 if ((dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA) || 1019 if ((dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA) ||
1016 gfs2_tune_get(sdp, gt_new_files_jdata)) 1020 gfs2_tune_get(sdp, gt_new_files_jdata))
1017 di.di_flags |= GFS2_DIF_JDATA; 1021 di->di_flags |= cpu_to_be32(GFS2_DIF_JDATA);
1018 if ((dip->i_di.di_flags & GFS2_DIF_INHERIT_DIRECTIO) || 1022 if ((dip->i_di.di_flags & GFS2_DIF_INHERIT_DIRECTIO) ||
1019 gfs2_tune_get(sdp, gt_new_files_directio)) 1023 gfs2_tune_get(sdp, gt_new_files_directio))
1020 di.di_flags |= GFS2_DIF_DIRECTIO; 1024 di->di_flags |= cpu_to_be32(GFS2_DIF_DIRECTIO);
1021 } else if (S_ISDIR(mode)) { 1025 } else if (S_ISDIR(mode)) {
1022 di.di_flags |= (dip->i_di.di_flags & GFS2_DIF_INHERIT_DIRECTIO); 1026 di->di_flags |= cpu_to_be32(dip->i_di.di_flags & GFS2_DIF_INHERIT_DIRECTIO);
1023 di.di_flags |= (dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA); 1027 di->di_flags |= cpu_to_be32(dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA);
1024 } 1028 }
1025 1029
1026 gfs2_dinode_out(&di, dibh->b_data); 1030 di->__pad1 = 0;
1031 di->di_height = cpu_to_be32(0);
1032 di->__pad2 = 0;
1033 di->__pad3 = 0;
1034 di->di_depth = cpu_to_be16(0);
1035 di->di_entries = cpu_to_be32(0);
1036 memset(&di->__pad4, 0, sizeof(di->__pad4));
1037 di->di_eattr = cpu_to_be64(0);
1038 memset(&di->di_reserved, 0, sizeof(di->di_reserved));
1039
1027 brelse(dibh); 1040 brelse(dibh);
1028} 1041}
1029 1042