aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/bmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/bmap.c')
-rw-r--r--fs/gfs2/bmap.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 20b971ad4973..04513e997df6 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -131,7 +131,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
131 if (error) 131 if (error)
132 goto out; 132 goto out;
133 133
134 if (ip->i_disksize) { 134 if (i_size_read(&ip->i_inode)) {
135 /* Get a free block, fill it with the stuffed data, 135 /* Get a free block, fill it with the stuffed data,
136 and write it out to disk */ 136 and write it out to disk */
137 137
@@ -160,7 +160,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
160 di = (struct gfs2_dinode *)dibh->b_data; 160 di = (struct gfs2_dinode *)dibh->b_data;
161 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 161 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
162 162
163 if (ip->i_disksize) { 163 if (i_size_read(&ip->i_inode)) {
164 *(__be64 *)(di + 1) = cpu_to_be64(block); 164 *(__be64 *)(di + 1) = cpu_to_be64(block);
165 gfs2_add_inode_blocks(&ip->i_inode, 1); 165 gfs2_add_inode_blocks(&ip->i_inode, 1);
166 di->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode)); 166 di->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode));
@@ -985,7 +985,6 @@ static int trunc_start(struct inode *inode, u64 oldsize, u64 newsize)
985 } 985 }
986 986
987 i_size_write(inode, newsize); 987 i_size_write(inode, newsize);
988 ip->i_disksize = newsize;
989 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 988 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
990 gfs2_dinode_out(ip, dibh->b_data); 989 gfs2_dinode_out(ip, dibh->b_data);
991 990
@@ -1051,7 +1050,7 @@ static int trunc_end(struct gfs2_inode *ip)
1051 if (error) 1050 if (error)
1052 goto out; 1051 goto out;
1053 1052
1054 if (!ip->i_disksize) { 1053 if (!i_size_read(&ip->i_inode)) {
1055 ip->i_height = 0; 1054 ip->i_height = 0;
1056 ip->i_goal = ip->i_no_addr; 1055 ip->i_goal = ip->i_no_addr;
1057 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 1056 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
@@ -1167,7 +1166,6 @@ static int do_grow(struct inode *inode, u64 size)
1167 goto do_end_trans; 1166 goto do_end_trans;
1168 1167
1169 i_size_write(inode, size); 1168 i_size_write(inode, size);
1170 ip->i_disksize = size;
1171 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1169 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
1172 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1170 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1173 gfs2_dinode_out(ip, dibh->b_data); 1171 gfs2_dinode_out(ip, dibh->b_data);
@@ -1219,7 +1217,7 @@ int gfs2_setattr_size(struct inode *inode, u64 newsize)
1219int gfs2_truncatei_resume(struct gfs2_inode *ip) 1217int gfs2_truncatei_resume(struct gfs2_inode *ip)
1220{ 1218{
1221 int error; 1219 int error;
1222 error = trunc_dealloc(ip, ip->i_disksize); 1220 error = trunc_dealloc(ip, i_size_read(&ip->i_inode));
1223 if (!error) 1221 if (!error)
1224 error = trunc_end(ip); 1222 error = trunc_end(ip);
1225 return error; 1223 return error;
@@ -1260,7 +1258,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
1260 1258
1261 shift = sdp->sd_sb.sb_bsize_shift; 1259 shift = sdp->sd_sb.sb_bsize_shift;
1262 BUG_ON(gfs2_is_dir(ip)); 1260 BUG_ON(gfs2_is_dir(ip));
1263 end_of_file = (ip->i_disksize + sdp->sd_sb.sb_bsize - 1) >> shift; 1261 end_of_file = (i_size_read(&ip->i_inode) + sdp->sd_sb.sb_bsize - 1) >> shift;
1264 lblock = offset >> shift; 1262 lblock = offset >> shift;
1265 lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift; 1263 lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
1266 if (lblock_stop > end_of_file) 1264 if (lblock_stop > end_of_file)