Skip to content

Commit

Permalink
[GFS2] Add an additional argument to gfs2_trans_add_bh()
Browse files Browse the repository at this point in the history
This adds an extra argument to gfs2_trans_add_bh() to indicate whether the
bh being added to the transaction is metadata or data. Its currently unused
since all existing callers set it to 1 (metadata) but following patches will
make use of it.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Steven Whitehouse committed Jan 18, 2006
1 parent b96ca4f commit d4e9c4c
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 85 deletions.
2 changes: 1 addition & 1 deletion fs/gfs2/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ static int munge_mode(struct gfs2_inode *ip, mode_t mode)
gfs2_assert_withdraw(sdp,
(ip->i_di.di_mode & S_IFMT) == (mode & S_IFMT));
ip->i_di.di_mode = mode;
gfs2_trans_add_bh(ip->i_gl, dibh);
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(&ip->i_di, dibh->b_data);
brelse(dibh);
}
Expand Down
24 changes: 12 additions & 12 deletions fs/gfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, gfs2_unstuffer_t unstuffer,

/* Set up the pointer to the new block */

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

gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));

Expand Down Expand Up @@ -223,7 +223,7 @@ static int build_height(struct gfs2_inode *ip, int height)
block = gfs2_alloc_meta(ip);

bh = gfs2_meta_new(ip->i_gl, block);
gfs2_trans_add_bh(ip->i_gl, bh);
gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_metatype_set(bh,
GFS2_METATYPE_IN,
GFS2_FORMAT_IN);
Expand All @@ -236,7 +236,7 @@ static int build_height(struct gfs2_inode *ip, int height)

/* Set up the new direct pointer and write it out to disk */

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

gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));

Expand Down Expand Up @@ -382,7 +382,7 @@ static void lookup_block(struct gfs2_inode *ip, struct buffer_head *bh,
else
*block = gfs2_alloc_meta(ip);

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

*ptr = cpu_to_be64(*block);
ip->i_di.di_blocks++;
Expand Down Expand Up @@ -490,7 +490,7 @@ int gfs2_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
if (*new) {
error = gfs2_meta_inode_buffer(ip, &bh);
if (!error) {
gfs2_trans_add_bh(ip->i_gl, bh);
gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_dinode_out(&ip->i_di, bh->b_data);
brelse(bh);
}
Expand Down Expand Up @@ -672,8 +672,8 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,

down_write(&ip->i_rw_mutex);

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

bstart = 0;
blen = 0;
Expand Down Expand Up @@ -795,7 +795,7 @@ static int do_grow(struct gfs2_inode *ip, uint64_t size)
if (error)
goto out_end_trans;

gfs2_trans_add_bh(ip->i_gl, dibh);
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(&ip->i_di, dibh->b_data);
brelse(dibh);

Expand Down Expand Up @@ -833,7 +833,7 @@ static int truncator_journaled(struct gfs2_inode *ip, uint64_t size)
if (error)
return error;

gfs2_trans_add_bh(ip->i_gl, bh);
gfs2_trans_add_bh(ip->i_gl, bh, 1);
gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header) + off);

brelse(bh);
Expand Down Expand Up @@ -861,7 +861,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size,
if (gfs2_is_stuffed(ip)) {
ip->i_di.di_size = size;
ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
gfs2_trans_add_bh(ip->i_gl, dibh);
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(&ip->i_di, dibh->b_data);
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode) + size);
error = 1;
Expand All @@ -879,7 +879,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size,
ip->i_di.di_size = size;
ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
ip->i_di.di_flags |= GFS2_DIF_TRUNC_IN_PROG;
gfs2_trans_add_bh(ip->i_gl, dibh);
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(&ip->i_di, dibh->b_data);
}
}
Expand Down Expand Up @@ -957,7 +957,7 @@ static int trunc_end(struct gfs2_inode *ip)
ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
ip->i_di.di_flags &= ~GFS2_DIF_TRUNC_IN_PROG;

gfs2_trans_add_bh(ip->i_gl, dibh);
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
gfs2_dinode_out(&ip->i_di, dibh->b_data);
brelse(dibh);

Expand Down
32 changes: 16 additions & 16 deletions fs/gfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh,
return;
}

gfs2_trans_add_bh(dip->i_gl, bh);
gfs2_trans_add_bh(dip->i_gl, bh, 1);

/* If there is no prev entry, this is the first entry in the block.
The de_rec_len is already as big as it needs to be. Just zero
Expand Down Expand Up @@ -264,7 +264,7 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh,
return -EIO;
}

gfs2_trans_add_bh(dip->i_gl, bh);
gfs2_trans_add_bh(dip->i_gl, bh, 1);

dent->de_rec_len = bh->b_size - offset;
dent->de_rec_len = cpu_to_be32(dent->de_rec_len);
Expand All @@ -282,7 +282,7 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh,

if ((!dent->de_inum.no_addr && cur_rec_len >= rec_len) ||
(cur_rec_len >= GFS2_DIRENT_SIZE(cur_name_len) + rec_len)) {
gfs2_trans_add_bh(dip->i_gl, bh);
gfs2_trans_add_bh(dip->i_gl, bh, 1);

if (dent->de_inum.no_addr) {
new = (struct gfs2_dirent *)((char *)dent +
Expand Down Expand Up @@ -552,7 +552,7 @@ static int dir_make_exhash(struct gfs2_inode *dip)
/* Turn over a new leaf */

bh = gfs2_meta_new(dip->i_gl, bn);
gfs2_trans_add_bh(dip->i_gl, bh);
gfs2_trans_add_bh(dip->i_gl, bh, 1);
gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));

Expand Down Expand Up @@ -596,7 +596,7 @@ static int dir_make_exhash(struct gfs2_inode *dip)
/* We're done with the new leaf block, now setup the new
hash table. */

gfs2_trans_add_bh(dip->i_gl, dibh);
gfs2_trans_add_bh(dip->i_gl, dibh, 1);
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));

lp = (uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode));
Expand Down Expand Up @@ -647,7 +647,7 @@ static int dir_split_leaf(struct gfs2_inode *dip, uint32_t index,
/* Get the new leaf block */

nbh = gfs2_meta_new(dip->i_gl, bn);
gfs2_trans_add_bh(dip->i_gl, nbh);
gfs2_trans_add_bh(dip->i_gl, nbh, 1);
gfs2_metatype_set(nbh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
gfs2_buffer_clear_tail(nbh, sizeof(struct gfs2_meta_header));

Expand All @@ -661,7 +661,7 @@ static int dir_split_leaf(struct gfs2_inode *dip, uint32_t index,
if (error)
goto fail;

gfs2_trans_add_bh(dip->i_gl, obh);
gfs2_trans_add_bh(dip->i_gl, obh, 1);

oleaf = (struct gfs2_leaf *)obh->b_data;

Expand Down Expand Up @@ -1285,14 +1285,14 @@ static int dir_e_add(struct gfs2_inode *dip, struct qstr *filename,
bn = gfs2_alloc_meta(dip);

nbh = gfs2_meta_new(dip->i_gl, bn);
gfs2_trans_add_bh(dip->i_gl, nbh);
gfs2_trans_add_bh(dip->i_gl, nbh, 1);
gfs2_metatype_set(nbh,
GFS2_METATYPE_LF,
GFS2_FORMAT_LF);
gfs2_buffer_clear_tail(nbh,
sizeof(struct gfs2_meta_header));

gfs2_trans_add_bh(dip->i_gl, bh);
gfs2_trans_add_bh(dip->i_gl, bh, 1);
leaf->lf_next = cpu_to_be64(bn);

nleaf = (struct gfs2_leaf *)nbh->b_data;
Expand Down Expand Up @@ -1330,7 +1330,7 @@ static int dir_e_add(struct gfs2_inode *dip, struct qstr *filename,
dip->i_di.di_entries++;
dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();

gfs2_trans_add_bh(dip->i_gl, dibh);
gfs2_trans_add_bh(dip->i_gl, dibh, 1);
gfs2_dinode_out(&dip->i_di, dibh->b_data);
brelse(dibh);

Expand Down Expand Up @@ -1376,7 +1376,7 @@ static int dir_e_del(struct gfs2_inode *dip, struct qstr *filename)
dip->i_di.di_entries--;
dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();

gfs2_trans_add_bh(dip->i_gl, dibh);
gfs2_trans_add_bh(dip->i_gl, dibh, 1);
gfs2_dinode_out(&dip->i_di, dibh->b_data);
brelse(dibh);

Expand Down Expand Up @@ -1481,7 +1481,7 @@ static int dir_e_mvino(struct gfs2_inode *dip, struct qstr *filename,
if (error)
return error;

gfs2_trans_add_bh(dip->i_gl, bh);
gfs2_trans_add_bh(dip->i_gl, bh, 1);

gfs2_inum_out(inum, (char *)&dent->de_inum);
dent->de_type = new_type;
Expand All @@ -1494,7 +1494,7 @@ static int dir_e_mvino(struct gfs2_inode *dip, struct qstr *filename,

dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();

gfs2_trans_add_bh(dip->i_gl, dibh);
gfs2_trans_add_bh(dip->i_gl, dibh, 1);
gfs2_dinode_out(&dip->i_di, dibh->b_data);
brelse(dibh);

Expand Down Expand Up @@ -1681,7 +1681,7 @@ static int dir_l_mvino(struct gfs2_inode *dip, struct qstr *filename,
if (error)
goto out;

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

gfs2_inum_out(inum, (char *)&dent->de_inum);
dent->de_type = new_type;
Expand Down Expand Up @@ -1976,7 +1976,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, uint32_t index, uint32_t len,
if (error)
goto out_end_trans;

gfs2_trans_add_bh(dip->i_gl, dibh);
gfs2_trans_add_bh(dip->i_gl, dibh, 1);
gfs2_dinode_out(&dip->i_di, dibh->b_data);
brelse(dibh);

Expand Down Expand Up @@ -2030,7 +2030,7 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)

error = gfs2_meta_inode_buffer(dip, &bh);
if (!error) {
gfs2_trans_add_bh(dip->i_gl, bh);
gfs2_trans_add_bh(dip->i_gl, bh, 1);
((struct gfs2_dinode *)bh->b_data)->di_mode = cpu_to_be32(S_IFREG);
brelse(bh);
}
Expand Down
Loading

0 comments on commit d4e9c4c

Please sign in to comment.