diff options
-rw-r--r-- | fs/gfs2/bmap.c | 21 | ||||
-rw-r--r-- | fs/gfs2/inode.c | 4 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 14 |
3 files changed, 25 insertions, 14 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 92eef825167d..cc57f2ecd219 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -121,6 +121,7 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
121 | int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page) | 121 | int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page) |
122 | { | 122 | { |
123 | struct buffer_head *bh, *dibh; | 123 | struct buffer_head *bh, *dibh; |
124 | struct gfs2_dinode *di; | ||
124 | u64 block = 0; | 125 | u64 block = 0; |
125 | int isdir = gfs2_is_dir(ip); | 126 | int isdir = gfs2_is_dir(ip); |
126 | int error; | 127 | int error; |
@@ -141,8 +142,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page) | |||
141 | error = gfs2_dir_get_new_buffer(ip, block, &bh); | 142 | error = gfs2_dir_get_new_buffer(ip, block, &bh); |
142 | if (error) | 143 | if (error) |
143 | goto out_brelse; | 144 | goto out_brelse; |
144 | gfs2_buffer_copy_tail(bh, | 145 | gfs2_buffer_copy_tail(bh, sizeof(struct gfs2_meta_header), |
145 | sizeof(struct gfs2_meta_header), | ||
146 | dibh, sizeof(struct gfs2_dinode)); | 146 | dibh, sizeof(struct gfs2_dinode)); |
147 | brelse(bh); | 147 | brelse(bh); |
148 | } else { | 148 | } else { |
@@ -157,18 +157,17 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page) | |||
157 | /* Set up the pointer to the new block */ | 157 | /* Set up the pointer to the new block */ |
158 | 158 | ||
159 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 159 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
160 | 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_di.di_size) { | 163 | if (ip->i_di.di_size) { |
164 | *(u64 *)(dibh->b_data + sizeof(struct gfs2_dinode)) = | 164 | *(__be64 *)(di + 1) = cpu_to_be64(block); |
165 | cpu_to_be64(block); | ||
166 | ip->i_di.di_blocks++; | 165 | ip->i_di.di_blocks++; |
166 | di->di_blocks = cpu_to_be64(ip->i_di.di_blocks); | ||
167 | } | 167 | } |
168 | 168 | ||
169 | ip->i_di.di_height = 1; | 169 | ip->i_di.di_height = 1; |
170 | 170 | di->di_height = cpu_to_be16(1); | |
171 | gfs2_dinode_out(&ip->i_di, dibh->b_data); | ||
172 | 171 | ||
173 | out_brelse: | 172 | out_brelse: |
174 | brelse(dibh); | 173 | brelse(dibh); |
@@ -229,6 +228,7 @@ static int build_height(struct inode *inode, unsigned height) | |||
229 | unsigned new_height = height - ip->i_di.di_height; | 228 | unsigned new_height = height - ip->i_di.di_height; |
230 | struct buffer_head *dibh; | 229 | struct buffer_head *dibh; |
231 | struct buffer_head *blocks[GFS2_MAX_META_HEIGHT]; | 230 | struct buffer_head *blocks[GFS2_MAX_META_HEIGHT]; |
231 | struct gfs2_dinode *di; | ||
232 | int error; | 232 | int error; |
233 | u64 *bp; | 233 | u64 *bp; |
234 | u64 bn; | 234 | u64 bn; |
@@ -267,12 +267,13 @@ static int build_height(struct inode *inode, unsigned height) | |||
267 | dibh, sizeof(struct gfs2_dinode)); | 267 | dibh, sizeof(struct gfs2_dinode)); |
268 | brelse(blocks[n]); | 268 | brelse(blocks[n]); |
269 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 269 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
270 | di = (struct gfs2_dinode *)dibh->b_data; | ||
270 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); | 271 | gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); |
271 | bp = (u64 *)(dibh->b_data + sizeof(struct gfs2_dinode)); | 272 | *(__be64 *)(di + 1) = cpu_to_be64(bn); |
272 | *bp = cpu_to_be64(bn); | ||
273 | ip->i_di.di_height += new_height; | 273 | ip->i_di.di_height += new_height; |
274 | ip->i_di.di_blocks += new_height; | 274 | ip->i_di.di_blocks += new_height; |
275 | gfs2_dinode_out(&ip->i_di, dibh->b_data); | 275 | di->di_height = cpu_to_be16(ip->i_di.di_height); |
276 | di->di_blocks = cpu_to_be64(ip->i_di.di_blocks); | ||
276 | brelse(dibh); | 277 | brelse(dibh); |
277 | return error; | 278 | return error; |
278 | } | 279 | } |
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 57a4c8b68587..660dc81849a6 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -1166,6 +1166,7 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh) | |||
1166 | curtime = get_seconds(); | 1166 | curtime = get_seconds(); |
1167 | if (curtime - ip->i_di.di_atime >= quantum) { | 1167 | if (curtime - ip->i_di.di_atime >= quantum) { |
1168 | struct buffer_head *dibh; | 1168 | struct buffer_head *dibh; |
1169 | struct gfs2_dinode *di; | ||
1169 | 1170 | ||
1170 | error = gfs2_trans_begin(sdp, RES_DINODE, 0); | 1171 | error = gfs2_trans_begin(sdp, RES_DINODE, 0); |
1171 | if (error == -EROFS) | 1172 | if (error == -EROFS) |
@@ -1180,7 +1181,8 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh) | |||
1180 | ip->i_di.di_atime = curtime; | 1181 | ip->i_di.di_atime = curtime; |
1181 | 1182 | ||
1182 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 1183 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
1183 | gfs2_dinode_out(&ip->i_di, dibh->b_data); | 1184 | di = (struct gfs2_dinode *)dibh->b_data; |
1185 | di->di_atime = cpu_to_be64(ip->i_di.di_atime); | ||
1184 | brelse(dibh); | 1186 | brelse(dibh); |
1185 | 1187 | ||
1186 | gfs2_trans_end(sdp); | 1188 | gfs2_trans_end(sdp); |
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 811f4ada2a01..4fb743f4e4a4 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -460,7 +460,8 @@ static int gfs2_commit_write(struct file *file, struct page *page, | |||
460 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 460 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
461 | int error = -EOPNOTSUPP; | 461 | int error = -EOPNOTSUPP; |
462 | struct buffer_head *dibh; | 462 | struct buffer_head *dibh; |
463 | struct gfs2_alloc *al = &ip->i_alloc;; | 463 | struct gfs2_alloc *al = &ip->i_alloc; |
464 | struct gfs2_dinode *di; | ||
464 | 465 | ||
465 | if (gfs2_assert_withdraw(sdp, gfs2_glock_is_locked_by_me(ip->i_gl))) | 466 | if (gfs2_assert_withdraw(sdp, gfs2_glock_is_locked_by_me(ip->i_gl))) |
466 | goto fail_nounlock; | 467 | goto fail_nounlock; |
@@ -470,6 +471,7 @@ static int gfs2_commit_write(struct file *file, struct page *page, | |||
470 | goto fail_endtrans; | 471 | goto fail_endtrans; |
471 | 472 | ||
472 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); | 473 | gfs2_trans_add_bh(ip->i_gl, dibh, 1); |
474 | di = (struct gfs2_dinode *)dibh->b_data; | ||
473 | 475 | ||
474 | if (gfs2_is_stuffed(ip)) { | 476 | if (gfs2_is_stuffed(ip)) { |
475 | u64 file_size; | 477 | u64 file_size; |
@@ -495,10 +497,16 @@ static int gfs2_commit_write(struct file *file, struct page *page, | |||
495 | goto fail; | 497 | goto fail; |
496 | } | 498 | } |
497 | 499 | ||
498 | if (ip->i_di.di_size < inode->i_size) | 500 | if (ip->i_di.di_size < inode->i_size) { |
499 | ip->i_di.di_size = inode->i_size; | 501 | ip->i_di.di_size = inode->i_size; |
502 | di->di_size = cpu_to_be64(inode->i_size); | ||
503 | } | ||
504 | |||
505 | di->di_mode = cpu_to_be32(inode->i_mode); | ||
506 | di->di_atime = cpu_to_be64(inode->i_atime.tv_sec); | ||
507 | di->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec); | ||
508 | di->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec); | ||
500 | 509 | ||
501 | gfs2_dinode_out(&ip->i_di, dibh->b_data); | ||
502 | brelse(dibh); | 510 | brelse(dibh); |
503 | gfs2_trans_end(sdp); | 511 | gfs2_trans_end(sdp); |
504 | if (al->al_requested) { | 512 | if (al->al_requested) { |