Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38883
b: refs/heads/master
c: 48516ce
h: refs/heads/master
i:
  38881: 870689a
  38879: 8f62128
v: v3
  • Loading branch information
Steven Whitehouse committed Oct 2, 2006
1 parent ce3a55f commit 20642cf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3cf1e7bed4681bdb1c14b6e146ae9c0afb6c1552
refs/heads/master: 48516ced21e83a755ebae3d1ed03f1731befc391
21 changes: 11 additions & 10 deletions trunk/fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
{
struct buffer_head *bh, *dibh;
struct gfs2_dinode *di;
u64 block = 0;
int isdir = gfs2_is_dir(ip);
int error;
Expand All @@ -141,8 +142,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
error = gfs2_dir_get_new_buffer(ip, block, &bh);
if (error)
goto out_brelse;
gfs2_buffer_copy_tail(bh,
sizeof(struct gfs2_meta_header),
gfs2_buffer_copy_tail(bh, sizeof(struct gfs2_meta_header),
dibh, sizeof(struct gfs2_dinode));
brelse(bh);
} else {
Expand All @@ -157,18 +157,17 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
/* Set up the pointer to the new block */

gfs2_trans_add_bh(ip->i_gl, dibh, 1);

di = (struct gfs2_dinode *)dibh->b_data;
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));

if (ip->i_di.di_size) {
*(u64 *)(dibh->b_data + sizeof(struct gfs2_dinode)) =
cpu_to_be64(block);
*(__be64 *)(di + 1) = cpu_to_be64(block);
ip->i_di.di_blocks++;
di->di_blocks = cpu_to_be64(ip->i_di.di_blocks);
}

ip->i_di.di_height = 1;

gfs2_dinode_out(&ip->i_di, dibh->b_data);
di->di_height = cpu_to_be16(1);

out_brelse:
brelse(dibh);
Expand Down Expand Up @@ -229,6 +228,7 @@ static int build_height(struct inode *inode, unsigned height)
unsigned new_height = height - ip->i_di.di_height;
struct buffer_head *dibh;
struct buffer_head *blocks[GFS2_MAX_META_HEIGHT];
struct gfs2_dinode *di;
int error;
u64 *bp;
u64 bn;
Expand Down Expand Up @@ -267,12 +267,13 @@ static int build_height(struct inode *inode, unsigned height)
dibh, sizeof(struct gfs2_dinode));
brelse(blocks[n]);
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
di = (struct gfs2_dinode *)dibh->b_data;
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
bp = (u64 *)(dibh->b_data + sizeof(struct gfs2_dinode));
*bp = cpu_to_be64(bn);
*(__be64 *)(di + 1) = cpu_to_be64(bn);
ip->i_di.di_height += new_height;
ip->i_di.di_blocks += new_height;
gfs2_dinode_out(&ip->i_di, dibh->b_data);
di->di_height = cpu_to_be16(ip->i_di.di_height);
di->di_blocks = cpu_to_be64(ip->i_di.di_blocks);
brelse(dibh);
return error;
}
Expand Down
4 changes: 3 additions & 1 deletion trunk/fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,7 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
curtime = get_seconds();
if (curtime - ip->i_di.di_atime >= quantum) {
struct buffer_head *dibh;
struct gfs2_dinode *di;

error = gfs2_trans_begin(sdp, RES_DINODE, 0);
if (error == -EROFS)
Expand All @@ -1180,7 +1181,8 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
ip->i_di.di_atime = curtime;

gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(&ip->i_di, dibh->b_data);
di = (struct gfs2_dinode *)dibh->b_data;
di->di_atime = cpu_to_be64(ip->i_di.di_atime);
brelse(dibh);

gfs2_trans_end(sdp);
Expand Down
14 changes: 11 additions & 3 deletions trunk/fs/gfs2/ops_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,8 @@ static int gfs2_commit_write(struct file *file, struct page *page,
struct gfs2_sbd *sdp = GFS2_SB(inode);
int error = -EOPNOTSUPP;
struct buffer_head *dibh;
struct gfs2_alloc *al = &ip->i_alloc;;
struct gfs2_alloc *al = &ip->i_alloc;
struct gfs2_dinode *di;

if (gfs2_assert_withdraw(sdp, gfs2_glock_is_locked_by_me(ip->i_gl)))
goto fail_nounlock;
Expand All @@ -470,6 +471,7 @@ static int gfs2_commit_write(struct file *file, struct page *page,
goto fail_endtrans;

gfs2_trans_add_bh(ip->i_gl, dibh, 1);
di = (struct gfs2_dinode *)dibh->b_data;

if (gfs2_is_stuffed(ip)) {
u64 file_size;
Expand All @@ -495,10 +497,16 @@ static int gfs2_commit_write(struct file *file, struct page *page,
goto fail;
}

if (ip->i_di.di_size < inode->i_size)
if (ip->i_di.di_size < inode->i_size) {
ip->i_di.di_size = inode->i_size;
di->di_size = cpu_to_be64(inode->i_size);
}

di->di_mode = cpu_to_be32(inode->i_mode);
di->di_atime = cpu_to_be64(inode->i_atime.tv_sec);
di->di_mtime = cpu_to_be64(inode->i_mtime.tv_sec);
di->di_ctime = cpu_to_be64(inode->i_ctime.tv_sec);

gfs2_dinode_out(&ip->i_di, dibh->b_data);
brelse(dibh);
gfs2_trans_end(sdp);
if (al->al_requested) {
Expand Down

0 comments on commit 20642cf

Please sign in to comment.