diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2010-08-11 04:53:11 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2010-09-20 06:18:29 -0400 |
commit | a2e0f79939e09e74698564b88dee709db208e1e2 (patch) | |
tree | 0018e445e3d47c4558901153733899ef672f789e /fs/gfs2/dir.c | |
parent | ff8f33c8b30d7b7efdcf2548c7f6e64db6a89b29 (diff) |
GFS2: Remove i_disksize
With the update of the truncate code, ip->i_disksize and
inode->i_size are merely copies of each other. This means
we can remove ip->i_disksize and use inode->i_size exclusively
reducing the size of a GFS2 inode by 8 bytes.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/dir.c')
-rw-r--r-- | fs/gfs2/dir.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index b9dd88a78dd4..c1042ae438cc 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -127,8 +127,8 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf, | |||
127 | 127 | ||
128 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 128 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
129 | memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); | 129 | memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); |
130 | if (ip->i_disksize < offset + size) | 130 | if (ip->i_inode.i_size < offset + size) |
131 | ip->i_disksize = offset + size; | 131 | i_size_write(&ip->i_inode, offset + size); |
132 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; | 132 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; |
133 | gfs2_dinode_out(ip, dibh->b_data); | 133 | gfs2_dinode_out(ip, dibh->b_data); |
134 | 134 | ||
@@ -225,8 +225,8 @@ out: | |||
225 | if (error) | 225 | if (error) |
226 | return error; | 226 | return error; |
227 | 227 | ||
228 | if (ip->i_disksize < offset + copied) | 228 | if (ip->i_inode.i_size < offset + copied) |
229 | ip->i_disksize = offset + copied; | 229 | i_size_write(&ip->i_inode, offset + copied); |
230 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; | 230 | ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; |
231 | 231 | ||
232 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 232 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
@@ -275,12 +275,13 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset, | |||
275 | unsigned int o; | 275 | unsigned int o; |
276 | int copied = 0; | 276 | int copied = 0; |
277 | int error = 0; | 277 | int error = 0; |
278 | u64 disksize = i_size_read(&ip->i_inode); | ||
278 | 279 | ||
279 | if (offset >= ip->i_disksize) | 280 | if (offset >= disksize) |
280 | return 0; | 281 | return 0; |
281 | 282 | ||
282 | if (offset + size > ip->i_disksize) | 283 | if (offset + size > disksize) |
283 | size = ip->i_disksize - offset; | 284 | size = disksize - offset; |
284 | 285 | ||
285 | if (!size) | 286 | if (!size) |
286 | return 0; | 287 | return 0; |
@@ -727,7 +728,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode, | |||
727 | unsigned hsize = 1 << ip->i_depth; | 728 | unsigned hsize = 1 << ip->i_depth; |
728 | unsigned index; | 729 | unsigned index; |
729 | u64 ln; | 730 | u64 ln; |
730 | if (hsize * sizeof(u64) != ip->i_disksize) { | 731 | if (hsize * sizeof(u64) != i_size_read(inode)) { |
731 | gfs2_consist_inode(ip); | 732 | gfs2_consist_inode(ip); |
732 | return ERR_PTR(-EIO); | 733 | return ERR_PTR(-EIO); |
733 | } | 734 | } |
@@ -879,7 +880,7 @@ static int dir_make_exhash(struct inode *inode) | |||
879 | for (x = sdp->sd_hash_ptrs; x--; lp++) | 880 | for (x = sdp->sd_hash_ptrs; x--; lp++) |
880 | *lp = cpu_to_be64(bn); | 881 | *lp = cpu_to_be64(bn); |
881 | 882 | ||
882 | dip->i_disksize = sdp->sd_sb.sb_bsize / 2; | 883 | i_size_write(inode, sdp->sd_sb.sb_bsize / 2); |
883 | gfs2_add_inode_blocks(&dip->i_inode, 1); | 884 | gfs2_add_inode_blocks(&dip->i_inode, 1); |
884 | dip->i_diskflags |= GFS2_DIF_EXHASH; | 885 | dip->i_diskflags |= GFS2_DIF_EXHASH; |
885 | 886 | ||
@@ -1057,11 +1058,12 @@ static int dir_double_exhash(struct gfs2_inode *dip) | |||
1057 | u64 *buf; | 1058 | u64 *buf; |
1058 | u64 *from, *to; | 1059 | u64 *from, *to; |
1059 | u64 block; | 1060 | u64 block; |
1061 | u64 disksize = i_size_read(&dip->i_inode); | ||
1060 | int x; | 1062 | int x; |
1061 | int error = 0; | 1063 | int error = 0; |
1062 | 1064 | ||
1063 | hsize = 1 << dip->i_depth; | 1065 | hsize = 1 << dip->i_depth; |
1064 | if (hsize * sizeof(u64) != dip->i_disksize) { | 1066 | if (hsize * sizeof(u64) != disksize) { |
1065 | gfs2_consist_inode(dip); | 1067 | gfs2_consist_inode(dip); |
1066 | return -EIO; | 1068 | return -EIO; |
1067 | } | 1069 | } |
@@ -1072,7 +1074,7 @@ static int dir_double_exhash(struct gfs2_inode *dip) | |||
1072 | if (!buf) | 1074 | if (!buf) |
1073 | return -ENOMEM; | 1075 | return -ENOMEM; |
1074 | 1076 | ||
1075 | for (block = dip->i_disksize >> sdp->sd_hash_bsize_shift; block--;) { | 1077 | for (block = disksize >> sdp->sd_hash_bsize_shift; block--;) { |
1076 | error = gfs2_dir_read_data(dip, (char *)buf, | 1078 | error = gfs2_dir_read_data(dip, (char *)buf, |
1077 | block * sdp->sd_hash_bsize, | 1079 | block * sdp->sd_hash_bsize, |
1078 | sdp->sd_hash_bsize, 1); | 1080 | sdp->sd_hash_bsize, 1); |
@@ -1370,7 +1372,7 @@ static int dir_e_read(struct inode *inode, u64 *offset, void *opaque, | |||
1370 | unsigned depth = 0; | 1372 | unsigned depth = 0; |
1371 | 1373 | ||
1372 | hsize = 1 << dip->i_depth; | 1374 | hsize = 1 << dip->i_depth; |
1373 | if (hsize * sizeof(u64) != dip->i_disksize) { | 1375 | if (hsize * sizeof(u64) != i_size_read(inode)) { |
1374 | gfs2_consist_inode(dip); | 1376 | gfs2_consist_inode(dip); |
1375 | return -EIO; | 1377 | return -EIO; |
1376 | } | 1378 | } |
@@ -1784,7 +1786,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data) | |||
1784 | int error = 0; | 1786 | int error = 0; |
1785 | 1787 | ||
1786 | hsize = 1 << dip->i_depth; | 1788 | hsize = 1 << dip->i_depth; |
1787 | if (hsize * sizeof(u64) != dip->i_disksize) { | 1789 | if (hsize * sizeof(u64) != i_size_read(&dip->i_inode)) { |
1788 | gfs2_consist_inode(dip); | 1790 | gfs2_consist_inode(dip); |
1789 | return -EIO; | 1791 | return -EIO; |
1790 | } | 1792 | } |