aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/inode.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-11-01 14:35:17 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2006-11-30 10:34:23 -0500
commit1a7b1eed5802502fd649e04784becd58557fdcf1 (patch)
tree31e9e9ab8ba1296751985d49d55154848ae2eefa /fs/gfs2/inode.c
parent4f56110a00af5fb2e22fbccfcaf944d62cae8fcf (diff)
[GFS2] Shrink gfs2_inode (6) - di_atime/di_mtime/di_ctime
Remove the di_[amc]time fields and use inode->i_[amc]time fields instead. This saves 24 bytes from the gfs2_inode. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/inode.c')
-rw-r--r--fs/gfs2/inode.c44
1 files changed, 11 insertions, 33 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 711203984823..c22ae3c3a444 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -52,12 +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 i_size_write(inode, di->di_size); 54 i_size_write(inode, di->di_size);
55 inode->i_atime.tv_sec = di->di_atime;
56 inode->i_mtime.tv_sec = di->di_mtime;
57 inode->i_ctime.tv_sec = di->di_ctime;
58 inode->i_atime.tv_nsec = 0;
59 inode->i_mtime.tv_nsec = 0;
60 inode->i_ctime.tv_nsec = 0;
61 inode->i_blocks = di->di_blocks << 55 inode->i_blocks = di->di_blocks <<
62 (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT); 56 (GFS2_SB(inode)->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT);
63 57
@@ -72,23 +66,6 @@ void gfs2_inode_attr_in(struct gfs2_inode *ip)
72 inode->i_flags &= ~S_APPEND; 66 inode->i_flags &= ~S_APPEND;
73} 67}
74 68
75/**
76 * gfs2_inode_attr_out - Copy attributes from VFS inode into the dinode
77 * @ip: The GFS2 inode
78 *
79 * Only copy out the attributes that we want the VFS layer
80 * to be able to modify.
81 */
82
83void gfs2_inode_attr_out(struct gfs2_inode *ip)
84{
85 struct inode *inode = &ip->i_inode;
86 struct gfs2_dinode_host *di = &ip->i_di;
87 di->di_atime = inode->i_atime.tv_sec;
88 di->di_mtime = inode->i_mtime.tv_sec;
89 di->di_ctime = inode->i_ctime.tv_sec;
90}
91
92static int iget_test(struct inode *inode, void *opaque) 69static int iget_test(struct inode *inode, void *opaque)
93{ 70{
94 struct gfs2_inode *ip = GFS2_I(inode); 71 struct gfs2_inode *ip = GFS2_I(inode);
@@ -221,9 +198,12 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
221 ip->i_inode.i_nlink = be32_to_cpu(str->di_nlink); 198 ip->i_inode.i_nlink = be32_to_cpu(str->di_nlink);
222 di->di_size = be64_to_cpu(str->di_size); 199 di->di_size = be64_to_cpu(str->di_size);
223 di->di_blocks = be64_to_cpu(str->di_blocks); 200 di->di_blocks = be64_to_cpu(str->di_blocks);
224 di->di_atime = be64_to_cpu(str->di_atime); 201 ip->i_inode.i_atime.tv_sec = be64_to_cpu(str->di_atime);
225 di->di_mtime = be64_to_cpu(str->di_mtime); 202 ip->i_inode.i_atime.tv_nsec = 0;
226 di->di_ctime = be64_to_cpu(str->di_ctime); 203 ip->i_inode.i_mtime.tv_sec = be64_to_cpu(str->di_mtime);
204 ip->i_inode.i_mtime.tv_nsec = 0;
205 ip->i_inode.i_ctime.tv_sec = be64_to_cpu(str->di_ctime);
206 ip->i_inode.i_ctime.tv_nsec = 0;
227 207
228 di->di_goal_meta = be64_to_cpu(str->di_goal_meta); 208 di->di_goal_meta = be64_to_cpu(str->di_goal_meta);
229 di->di_goal_data = be64_to_cpu(str->di_goal_data); 209 di->di_goal_data = be64_to_cpu(str->di_goal_data);
@@ -360,7 +340,7 @@ int gfs2_change_nlink(struct gfs2_inode *ip, int diff)
360 else 340 else
361 drop_nlink(&ip->i_inode); 341 drop_nlink(&ip->i_inode);
362 342
363 ip->i_di.di_ctime = get_seconds(); 343 ip->i_inode.i_ctime.tv_sec = get_seconds();
364 344
365 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 345 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
366 gfs2_dinode_out(ip, dibh->b_data); 346 gfs2_dinode_out(ip, dibh->b_data);
@@ -1224,7 +1204,7 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
1224 return 0; 1204 return 0;
1225 1205
1226 curtime = get_seconds(); 1206 curtime = get_seconds();
1227 if (curtime - ip->i_di.di_atime >= quantum) { 1207 if (curtime - ip->i_inode.i_atime.tv_sec >= quantum) {
1228 gfs2_glock_dq(gh); 1208 gfs2_glock_dq(gh);
1229 gfs2_holder_reinit(LM_ST_EXCLUSIVE, gh->gh_flags & ~LM_FLAG_ANY, 1209 gfs2_holder_reinit(LM_ST_EXCLUSIVE, gh->gh_flags & ~LM_FLAG_ANY,
1230 gh); 1210 gh);
@@ -1236,7 +1216,7 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
1236 trying to get exclusive lock. */ 1216 trying to get exclusive lock. */
1237 1217
1238 curtime = get_seconds(); 1218 curtime = get_seconds();
1239 if (curtime - ip->i_di.di_atime >= quantum) { 1219 if (curtime - ip->i_inode.i_atime.tv_sec >= quantum) {
1240 struct buffer_head *dibh; 1220 struct buffer_head *dibh;
1241 struct gfs2_dinode *di; 1221 struct gfs2_dinode *di;
1242 1222
@@ -1250,11 +1230,11 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
1250 if (error) 1230 if (error)
1251 goto fail_end_trans; 1231 goto fail_end_trans;
1252 1232
1253 ip->i_di.di_atime = curtime; 1233 ip->i_inode.i_atime.tv_sec = curtime;
1254 1234
1255 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1235 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1256 di = (struct gfs2_dinode *)dibh->b_data; 1236 di = (struct gfs2_dinode *)dibh->b_data;
1257 di->di_atime = cpu_to_be64(ip->i_di.di_atime); 1237 di->di_atime = cpu_to_be64(ip->i_inode.i_atime.tv_sec);
1258 brelse(dibh); 1238 brelse(dibh);
1259 1239
1260 gfs2_trans_end(sdp); 1240 gfs2_trans_end(sdp);
@@ -1375,8 +1355,6 @@ __gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
1375 if (!error) { 1355 if (!error) {
1376 error = inode_setattr(&ip->i_inode, attr); 1356 error = inode_setattr(&ip->i_inode, attr);
1377 gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error); 1357 gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
1378 gfs2_inode_attr_out(ip);
1379
1380 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1358 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1381 gfs2_dinode_out(ip, dibh->b_data); 1359 gfs2_dinode_out(ip, dibh->b_data);
1382 brelse(dibh); 1360 brelse(dibh);