aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <steve@chygwyn.com>2006-01-18 06:19:28 -0500
committerSteven Whitehouse <steve@chygwyn.com>2006-01-18 06:19:28 -0500
commitd4e9c4c3bf861ef2ac96e0de659c75a00da92b28 (patch)
tree925ececc725ad5180b9253f732b50c51bfa0754d
parentb96ca4fa4e3b510d528a093a5bac0befbc2ba46d (diff)
[GFS2] Add an additional argument to gfs2_trans_add_bh()
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>
-rw-r--r--fs/gfs2/acl.c2
-rw-r--r--fs/gfs2/bmap.c24
-rw-r--r--fs/gfs2/dir.c32
-rw-r--r--fs/gfs2/eattr.c38
-rw-r--r--fs/gfs2/inode.c16
-rw-r--r--fs/gfs2/jdata.c8
-rw-r--r--fs/gfs2/meta_io.c2
-rw-r--r--fs/gfs2/ops_address.c2
-rw-r--r--fs/gfs2/ops_file.c10
-rw-r--r--fs/gfs2/ops_inode.c4
-rw-r--r--fs/gfs2/quota.c2
-rw-r--r--fs/gfs2/resize.c2
-rw-r--r--fs/gfs2/rgrp.c16
-rw-r--r--fs/gfs2/super.c6
-rw-r--r--fs/gfs2/trans.c3
-rw-r--r--fs/gfs2/trans.h2
-rw-r--r--fs/gfs2/unlinked.c2
17 files changed, 86 insertions, 85 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 33c465a2ab53..9482a677ea47 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -202,7 +202,7 @@ static int munge_mode(struct gfs2_inode *ip, mode_t mode)
202 gfs2_assert_withdraw(sdp, 202 gfs2_assert_withdraw(sdp,
203 (ip->i_di.di_mode & S_IFMT) == (mode & S_IFMT)); 203 (ip->i_di.di_mode & S_IFMT) == (mode & S_IFMT));
204 ip->i_di.di_mode = mode; 204 ip->i_di.di_mode = mode;
205 gfs2_trans_add_bh(ip->i_gl, dibh); 205 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
206 gfs2_dinode_out(&ip->i_di, dibh->b_data); 206 gfs2_dinode_out(&ip->i_di, dibh->b_data);
207 brelse(dibh); 207 brelse(dibh);
208 } 208 }
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index bece3620f1c0..967cbc68195a 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -124,7 +124,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, gfs2_unstuffer_t unstuffer,
124 124
125 /* Set up the pointer to the new block */ 125 /* Set up the pointer to the new block */
126 126
127 gfs2_trans_add_bh(ip->i_gl, dibh); 127 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
128 128
129 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 129 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
130 130
@@ -223,7 +223,7 @@ static int build_height(struct gfs2_inode *ip, int height)
223 block = gfs2_alloc_meta(ip); 223 block = gfs2_alloc_meta(ip);
224 224
225 bh = gfs2_meta_new(ip->i_gl, block); 225 bh = gfs2_meta_new(ip->i_gl, block);
226 gfs2_trans_add_bh(ip->i_gl, bh); 226 gfs2_trans_add_bh(ip->i_gl, bh, 1);
227 gfs2_metatype_set(bh, 227 gfs2_metatype_set(bh,
228 GFS2_METATYPE_IN, 228 GFS2_METATYPE_IN,
229 GFS2_FORMAT_IN); 229 GFS2_FORMAT_IN);
@@ -236,7 +236,7 @@ static int build_height(struct gfs2_inode *ip, int height)
236 236
237 /* Set up the new direct pointer and write it out to disk */ 237 /* Set up the new direct pointer and write it out to disk */
238 238
239 gfs2_trans_add_bh(ip->i_gl, dibh); 239 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
240 240
241 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 241 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
242 242
@@ -382,7 +382,7 @@ static void lookup_block(struct gfs2_inode *ip, struct buffer_head *bh,
382 else 382 else
383 *block = gfs2_alloc_meta(ip); 383 *block = gfs2_alloc_meta(ip);
384 384
385 gfs2_trans_add_bh(ip->i_gl, bh); 385 gfs2_trans_add_bh(ip->i_gl, bh, 1);
386 386
387 *ptr = cpu_to_be64(*block); 387 *ptr = cpu_to_be64(*block);
388 ip->i_di.di_blocks++; 388 ip->i_di.di_blocks++;
@@ -490,7 +490,7 @@ int gfs2_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
490 if (*new) { 490 if (*new) {
491 error = gfs2_meta_inode_buffer(ip, &bh); 491 error = gfs2_meta_inode_buffer(ip, &bh);
492 if (!error) { 492 if (!error) {
493 gfs2_trans_add_bh(ip->i_gl, bh); 493 gfs2_trans_add_bh(ip->i_gl, bh, 1);
494 gfs2_dinode_out(&ip->i_di, bh->b_data); 494 gfs2_dinode_out(&ip->i_di, bh->b_data);
495 brelse(bh); 495 brelse(bh);
496 } 496 }
@@ -672,8 +672,8 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
672 672
673 down_write(&ip->i_rw_mutex); 673 down_write(&ip->i_rw_mutex);
674 674
675 gfs2_trans_add_bh(ip->i_gl, dibh); 675 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
676 gfs2_trans_add_bh(ip->i_gl, bh); 676 gfs2_trans_add_bh(ip->i_gl, bh, 1);
677 677
678 bstart = 0; 678 bstart = 0;
679 blen = 0; 679 blen = 0;
@@ -795,7 +795,7 @@ static int do_grow(struct gfs2_inode *ip, uint64_t size)
795 if (error) 795 if (error)
796 goto out_end_trans; 796 goto out_end_trans;
797 797
798 gfs2_trans_add_bh(ip->i_gl, dibh); 798 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
799 gfs2_dinode_out(&ip->i_di, dibh->b_data); 799 gfs2_dinode_out(&ip->i_di, dibh->b_data);
800 brelse(dibh); 800 brelse(dibh);
801 801
@@ -833,7 +833,7 @@ static int truncator_journaled(struct gfs2_inode *ip, uint64_t size)
833 if (error) 833 if (error)
834 return error; 834 return error;
835 835
836 gfs2_trans_add_bh(ip->i_gl, bh); 836 gfs2_trans_add_bh(ip->i_gl, bh, 1);
837 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header) + off); 837 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header) + off);
838 838
839 brelse(bh); 839 brelse(bh);
@@ -861,7 +861,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size,
861 if (gfs2_is_stuffed(ip)) { 861 if (gfs2_is_stuffed(ip)) {
862 ip->i_di.di_size = size; 862 ip->i_di.di_size = size;
863 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); 863 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
864 gfs2_trans_add_bh(ip->i_gl, dibh); 864 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
865 gfs2_dinode_out(&ip->i_di, dibh->b_data); 865 gfs2_dinode_out(&ip->i_di, dibh->b_data);
866 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode) + size); 866 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode) + size);
867 error = 1; 867 error = 1;
@@ -879,7 +879,7 @@ static int trunc_start(struct gfs2_inode *ip, uint64_t size,
879 ip->i_di.di_size = size; 879 ip->i_di.di_size = size;
880 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); 880 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
881 ip->i_di.di_flags |= GFS2_DIF_TRUNC_IN_PROG; 881 ip->i_di.di_flags |= GFS2_DIF_TRUNC_IN_PROG;
882 gfs2_trans_add_bh(ip->i_gl, dibh); 882 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
883 gfs2_dinode_out(&ip->i_di, dibh->b_data); 883 gfs2_dinode_out(&ip->i_di, dibh->b_data);
884 } 884 }
885 } 885 }
@@ -957,7 +957,7 @@ static int trunc_end(struct gfs2_inode *ip)
957 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); 957 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
958 ip->i_di.di_flags &= ~GFS2_DIF_TRUNC_IN_PROG; 958 ip->i_di.di_flags &= ~GFS2_DIF_TRUNC_IN_PROG;
959 959
960 gfs2_trans_add_bh(ip->i_gl, dibh); 960 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
961 gfs2_dinode_out(&ip->i_di, dibh->b_data); 961 gfs2_dinode_out(&ip->i_di, dibh->b_data);
962 brelse(dibh); 962 brelse(dibh);
963 963
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index f6304e55dbc1..93d3704ac58c 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -201,7 +201,7 @@ static void dirent_del(struct gfs2_inode *dip, struct buffer_head *bh,
201 return; 201 return;
202 } 202 }
203 203
204 gfs2_trans_add_bh(dip->i_gl, bh); 204 gfs2_trans_add_bh(dip->i_gl, bh, 1);
205 205
206 /* If there is no prev entry, this is the first entry in the block. 206 /* If there is no prev entry, this is the first entry in the block.
207 The de_rec_len is already as big as it needs to be. Just zero 207 The de_rec_len is already as big as it needs to be. Just zero
@@ -264,7 +264,7 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh,
264 return -EIO; 264 return -EIO;
265 } 265 }
266 266
267 gfs2_trans_add_bh(dip->i_gl, bh); 267 gfs2_trans_add_bh(dip->i_gl, bh, 1);
268 268
269 dent->de_rec_len = bh->b_size - offset; 269 dent->de_rec_len = bh->b_size - offset;
270 dent->de_rec_len = cpu_to_be32(dent->de_rec_len); 270 dent->de_rec_len = cpu_to_be32(dent->de_rec_len);
@@ -282,7 +282,7 @@ int gfs2_dirent_alloc(struct gfs2_inode *dip, struct buffer_head *bh,
282 282
283 if ((!dent->de_inum.no_addr && cur_rec_len >= rec_len) || 283 if ((!dent->de_inum.no_addr && cur_rec_len >= rec_len) ||
284 (cur_rec_len >= GFS2_DIRENT_SIZE(cur_name_len) + rec_len)) { 284 (cur_rec_len >= GFS2_DIRENT_SIZE(cur_name_len) + rec_len)) {
285 gfs2_trans_add_bh(dip->i_gl, bh); 285 gfs2_trans_add_bh(dip->i_gl, bh, 1);
286 286
287 if (dent->de_inum.no_addr) { 287 if (dent->de_inum.no_addr) {
288 new = (struct gfs2_dirent *)((char *)dent + 288 new = (struct gfs2_dirent *)((char *)dent +
@@ -552,7 +552,7 @@ static int dir_make_exhash(struct gfs2_inode *dip)
552 /* Turn over a new leaf */ 552 /* Turn over a new leaf */
553 553
554 bh = gfs2_meta_new(dip->i_gl, bn); 554 bh = gfs2_meta_new(dip->i_gl, bn);
555 gfs2_trans_add_bh(dip->i_gl, bh); 555 gfs2_trans_add_bh(dip->i_gl, bh, 1);
556 gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF); 556 gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
557 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header)); 557 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
558 558
@@ -596,7 +596,7 @@ static int dir_make_exhash(struct gfs2_inode *dip)
596 /* We're done with the new leaf block, now setup the new 596 /* We're done with the new leaf block, now setup the new
597 hash table. */ 597 hash table. */
598 598
599 gfs2_trans_add_bh(dip->i_gl, dibh); 599 gfs2_trans_add_bh(dip->i_gl, dibh, 1);
600 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 600 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
601 601
602 lp = (uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode)); 602 lp = (uint64_t *)(dibh->b_data + sizeof(struct gfs2_dinode));
@@ -647,7 +647,7 @@ static int dir_split_leaf(struct gfs2_inode *dip, uint32_t index,
647 /* Get the new leaf block */ 647 /* Get the new leaf block */
648 648
649 nbh = gfs2_meta_new(dip->i_gl, bn); 649 nbh = gfs2_meta_new(dip->i_gl, bn);
650 gfs2_trans_add_bh(dip->i_gl, nbh); 650 gfs2_trans_add_bh(dip->i_gl, nbh, 1);
651 gfs2_metatype_set(nbh, GFS2_METATYPE_LF, GFS2_FORMAT_LF); 651 gfs2_metatype_set(nbh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
652 gfs2_buffer_clear_tail(nbh, sizeof(struct gfs2_meta_header)); 652 gfs2_buffer_clear_tail(nbh, sizeof(struct gfs2_meta_header));
653 653
@@ -661,7 +661,7 @@ static int dir_split_leaf(struct gfs2_inode *dip, uint32_t index,
661 if (error) 661 if (error)
662 goto fail; 662 goto fail;
663 663
664 gfs2_trans_add_bh(dip->i_gl, obh); 664 gfs2_trans_add_bh(dip->i_gl, obh, 1);
665 665
666 oleaf = (struct gfs2_leaf *)obh->b_data; 666 oleaf = (struct gfs2_leaf *)obh->b_data;
667 667
@@ -1285,14 +1285,14 @@ static int dir_e_add(struct gfs2_inode *dip, struct qstr *filename,
1285 bn = gfs2_alloc_meta(dip); 1285 bn = gfs2_alloc_meta(dip);
1286 1286
1287 nbh = gfs2_meta_new(dip->i_gl, bn); 1287 nbh = gfs2_meta_new(dip->i_gl, bn);
1288 gfs2_trans_add_bh(dip->i_gl, nbh); 1288 gfs2_trans_add_bh(dip->i_gl, nbh, 1);
1289 gfs2_metatype_set(nbh, 1289 gfs2_metatype_set(nbh,
1290 GFS2_METATYPE_LF, 1290 GFS2_METATYPE_LF,
1291 GFS2_FORMAT_LF); 1291 GFS2_FORMAT_LF);
1292 gfs2_buffer_clear_tail(nbh, 1292 gfs2_buffer_clear_tail(nbh,
1293 sizeof(struct gfs2_meta_header)); 1293 sizeof(struct gfs2_meta_header));
1294 1294
1295 gfs2_trans_add_bh(dip->i_gl, bh); 1295 gfs2_trans_add_bh(dip->i_gl, bh, 1);
1296 leaf->lf_next = cpu_to_be64(bn); 1296 leaf->lf_next = cpu_to_be64(bn);
1297 1297
1298 nleaf = (struct gfs2_leaf *)nbh->b_data; 1298 nleaf = (struct gfs2_leaf *)nbh->b_data;
@@ -1330,7 +1330,7 @@ static int dir_e_add(struct gfs2_inode *dip, struct qstr *filename,
1330 dip->i_di.di_entries++; 1330 dip->i_di.di_entries++;
1331 dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds(); 1331 dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
1332 1332
1333 gfs2_trans_add_bh(dip->i_gl, dibh); 1333 gfs2_trans_add_bh(dip->i_gl, dibh, 1);
1334 gfs2_dinode_out(&dip->i_di, dibh->b_data); 1334 gfs2_dinode_out(&dip->i_di, dibh->b_data);
1335 brelse(dibh); 1335 brelse(dibh);
1336 1336
@@ -1376,7 +1376,7 @@ static int dir_e_del(struct gfs2_inode *dip, struct qstr *filename)
1376 dip->i_di.di_entries--; 1376 dip->i_di.di_entries--;
1377 dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds(); 1377 dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
1378 1378
1379 gfs2_trans_add_bh(dip->i_gl, dibh); 1379 gfs2_trans_add_bh(dip->i_gl, dibh, 1);
1380 gfs2_dinode_out(&dip->i_di, dibh->b_data); 1380 gfs2_dinode_out(&dip->i_di, dibh->b_data);
1381 brelse(dibh); 1381 brelse(dibh);
1382 1382
@@ -1481,7 +1481,7 @@ static int dir_e_mvino(struct gfs2_inode *dip, struct qstr *filename,
1481 if (error) 1481 if (error)
1482 return error; 1482 return error;
1483 1483
1484 gfs2_trans_add_bh(dip->i_gl, bh); 1484 gfs2_trans_add_bh(dip->i_gl, bh, 1);
1485 1485
1486 gfs2_inum_out(inum, (char *)&dent->de_inum); 1486 gfs2_inum_out(inum, (char *)&dent->de_inum);
1487 dent->de_type = new_type; 1487 dent->de_type = new_type;
@@ -1494,7 +1494,7 @@ static int dir_e_mvino(struct gfs2_inode *dip, struct qstr *filename,
1494 1494
1495 dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds(); 1495 dip->i_di.di_mtime = dip->i_di.di_ctime = get_seconds();
1496 1496
1497 gfs2_trans_add_bh(dip->i_gl, dibh); 1497 gfs2_trans_add_bh(dip->i_gl, dibh, 1);
1498 gfs2_dinode_out(&dip->i_di, dibh->b_data); 1498 gfs2_dinode_out(&dip->i_di, dibh->b_data);
1499 brelse(dibh); 1499 brelse(dibh);
1500 1500
@@ -1681,7 +1681,7 @@ static int dir_l_mvino(struct gfs2_inode *dip, struct qstr *filename,
1681 if (error) 1681 if (error)
1682 goto out; 1682 goto out;
1683 1683
1684 gfs2_trans_add_bh(dip->i_gl, dibh); 1684 gfs2_trans_add_bh(dip->i_gl, dibh, 1);
1685 1685
1686 gfs2_inum_out(inum, (char *)&dent->de_inum); 1686 gfs2_inum_out(inum, (char *)&dent->de_inum);
1687 dent->de_type = new_type; 1687 dent->de_type = new_type;
@@ -1976,7 +1976,7 @@ static int leaf_dealloc(struct gfs2_inode *dip, uint32_t index, uint32_t len,
1976 if (error) 1976 if (error)
1977 goto out_end_trans; 1977 goto out_end_trans;
1978 1978
1979 gfs2_trans_add_bh(dip->i_gl, dibh); 1979 gfs2_trans_add_bh(dip->i_gl, dibh, 1);
1980 gfs2_dinode_out(&dip->i_di, dibh->b_data); 1980 gfs2_dinode_out(&dip->i_di, dibh->b_data);
1981 brelse(dibh); 1981 brelse(dibh);
1982 1982
@@ -2030,7 +2030,7 @@ int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip)
2030 2030
2031 error = gfs2_meta_inode_buffer(dip, &bh); 2031 error = gfs2_meta_inode_buffer(dip, &bh);
2032 if (!error) { 2032 if (!error) {
2033 gfs2_trans_add_bh(dip->i_gl, bh); 2033 gfs2_trans_add_bh(dip->i_gl, bh, 1);
2034 ((struct gfs2_dinode *)bh->b_data)->di_mode = cpu_to_be32(S_IFREG); 2034 ((struct gfs2_dinode *)bh->b_data)->di_mode = cpu_to_be32(S_IFREG);
2035 brelse(bh); 2035 brelse(bh);
2036 } 2036 }
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index dec55dcb9dbc..02e45c4ecbec 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -268,7 +268,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
268 if (error) 268 if (error)
269 goto out_gunlock; 269 goto out_gunlock;
270 270
271 gfs2_trans_add_bh(ip->i_gl, bh); 271 gfs2_trans_add_bh(ip->i_gl, bh, 1);
272 272
273 dataptrs = GFS2_EA2DATAPTRS(ea); 273 dataptrs = GFS2_EA2DATAPTRS(ea);
274 for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) { 274 for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) {
@@ -309,7 +309,7 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
309 error = gfs2_meta_inode_buffer(ip, &dibh); 309 error = gfs2_meta_inode_buffer(ip, &dibh);
310 if (!error) { 310 if (!error) {
311 ip->i_di.di_ctime = get_seconds(); 311 ip->i_di.di_ctime = get_seconds();
312 gfs2_trans_add_bh(ip->i_gl, dibh); 312 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
313 gfs2_dinode_out(&ip->i_di, dibh->b_data); 313 gfs2_dinode_out(&ip->i_di, dibh->b_data);
314 brelse(dibh); 314 brelse(dibh);
315 } 315 }
@@ -628,7 +628,7 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct buffer_head **bhp)
628 block = gfs2_alloc_meta(ip); 628 block = gfs2_alloc_meta(ip);
629 629
630 *bhp = gfs2_meta_new(ip->i_gl, block); 630 *bhp = gfs2_meta_new(ip->i_gl, block);
631 gfs2_trans_add_bh(ip->i_gl, *bhp); 631 gfs2_trans_add_bh(ip->i_gl, *bhp, 1);
632 gfs2_metatype_set(*bhp, GFS2_METATYPE_EA, GFS2_FORMAT_EA); 632 gfs2_metatype_set(*bhp, GFS2_METATYPE_EA, GFS2_FORMAT_EA);
633 gfs2_buffer_clear_tail(*bhp, sizeof(struct gfs2_meta_header)); 633 gfs2_buffer_clear_tail(*bhp, sizeof(struct gfs2_meta_header));
634 634
@@ -686,7 +686,7 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_ea_header *ea,
686 block = gfs2_alloc_meta(ip); 686 block = gfs2_alloc_meta(ip);
687 687
688 bh = gfs2_meta_new(ip->i_gl, block); 688 bh = gfs2_meta_new(ip->i_gl, block);
689 gfs2_trans_add_bh(ip->i_gl, bh); 689 gfs2_trans_add_bh(ip->i_gl, bh, 1);
690 gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED); 690 gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED);
691 691
692 ip->i_di.di_blocks++; 692 ip->i_di.di_blocks++;
@@ -759,7 +759,7 @@ static int ea_alloc_skeleton(struct gfs2_inode *ip, struct gfs2_ea_request *er,
759 ip->i_di.di_mode = er->er_mode; 759 ip->i_di.di_mode = er->er_mode;
760 } 760 }
761 ip->i_di.di_ctime = get_seconds(); 761 ip->i_di.di_ctime = get_seconds();
762 gfs2_trans_add_bh(ip->i_gl, dibh); 762 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
763 gfs2_dinode_out(&ip->i_di, dibh->b_data); 763 gfs2_dinode_out(&ip->i_di, dibh->b_data);
764 brelse(dibh); 764 brelse(dibh);
765 } 765 }
@@ -839,7 +839,7 @@ static void ea_set_remove_stuffed(struct gfs2_inode *ip,
839 struct gfs2_ea_header *prev = el->el_prev; 839 struct gfs2_ea_header *prev = el->el_prev;
840 uint32_t len; 840 uint32_t len;
841 841
842 gfs2_trans_add_bh(ip->i_gl, el->el_bh); 842 gfs2_trans_add_bh(ip->i_gl, el->el_bh, 1);
843 843
844 if (!prev || !GFS2_EA_IS_STUFFED(ea)) { 844 if (!prev || !GFS2_EA_IS_STUFFED(ea)) {
845 ea->ea_type = GFS2_EATYPE_UNUSED; 845 ea->ea_type = GFS2_EATYPE_UNUSED;
@@ -877,7 +877,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
877 if (error) 877 if (error)
878 return error; 878 return error;
879 879
880 gfs2_trans_add_bh(ip->i_gl, bh); 880 gfs2_trans_add_bh(ip->i_gl, bh, 1);
881 881
882 if (es->ea_split) 882 if (es->ea_split)
883 ea = ea_split_ea(ea); 883 ea = ea_split_ea(ea);
@@ -897,7 +897,7 @@ static int ea_set_simple_noalloc(struct gfs2_inode *ip, struct buffer_head *bh,
897 ip->i_di.di_mode = er->er_mode; 897 ip->i_di.di_mode = er->er_mode;
898 } 898 }
899 ip->i_di.di_ctime = get_seconds(); 899 ip->i_di.di_ctime = get_seconds();
900 gfs2_trans_add_bh(ip->i_gl, dibh); 900 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
901 gfs2_dinode_out(&ip->i_di, dibh->b_data); 901 gfs2_dinode_out(&ip->i_di, dibh->b_data);
902 brelse(dibh); 902 brelse(dibh);
903 out: 903 out:
@@ -913,7 +913,7 @@ static int ea_set_simple_alloc(struct gfs2_inode *ip,
913 struct gfs2_ea_header *ea = es->es_ea; 913 struct gfs2_ea_header *ea = es->es_ea;
914 int error; 914 int error;
915 915
916 gfs2_trans_add_bh(ip->i_gl, es->es_bh); 916 gfs2_trans_add_bh(ip->i_gl, es->es_bh, 1);
917 917
918 if (es->ea_split) 918 if (es->ea_split)
919 ea = ea_split_ea(ea); 919 ea = ea_split_ea(ea);
@@ -1007,14 +1007,14 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
1007 goto out; 1007 goto out;
1008 } 1008 }
1009 1009
1010 gfs2_trans_add_bh(ip->i_gl, indbh); 1010 gfs2_trans_add_bh(ip->i_gl, indbh, 1);
1011 } else { 1011 } else {
1012 uint64_t blk; 1012 uint64_t blk;
1013 1013
1014 blk = gfs2_alloc_meta(ip); 1014 blk = gfs2_alloc_meta(ip);
1015 1015
1016 indbh = gfs2_meta_new(ip->i_gl, blk); 1016 indbh = gfs2_meta_new(ip->i_gl, blk);
1017 gfs2_trans_add_bh(ip->i_gl, indbh); 1017 gfs2_trans_add_bh(ip->i_gl, indbh, 1);
1018 gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); 1018 gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN);
1019 gfs2_buffer_clear_tail(indbh, mh_size); 1019 gfs2_buffer_clear_tail(indbh, mh_size);
1020 1020
@@ -1163,7 +1163,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1163 if (error) 1163 if (error)
1164 return error; 1164 return error;
1165 1165
1166 gfs2_trans_add_bh(ip->i_gl, el->el_bh); 1166 gfs2_trans_add_bh(ip->i_gl, el->el_bh, 1);
1167 1167
1168 if (prev) { 1168 if (prev) {
1169 uint32_t len; 1169 uint32_t len;
@@ -1179,7 +1179,7 @@ static int ea_remove_stuffed(struct gfs2_inode *ip, struct gfs2_ea_location *el)
1179 error = gfs2_meta_inode_buffer(ip, &dibh); 1179 error = gfs2_meta_inode_buffer(ip, &dibh);
1180 if (!error) { 1180 if (!error) {
1181 ip->i_di.di_ctime = get_seconds(); 1181 ip->i_di.di_ctime = get_seconds();
1182 gfs2_trans_add_bh(ip->i_gl, dibh); 1182 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1183 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1183 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1184 brelse(dibh); 1184 brelse(dibh);
1185 } 1185 }
@@ -1288,7 +1288,7 @@ static int ea_acl_chmod_unstuffed(struct gfs2_inode *ip,
1288 goto fail; 1288 goto fail;
1289 } 1289 }
1290 1290
1291 gfs2_trans_add_bh(ip->i_gl, bh[x]); 1291 gfs2_trans_add_bh(ip->i_gl, bh[x], 1);
1292 1292
1293 memcpy(bh[x]->b_data + sizeof(struct gfs2_meta_header), 1293 memcpy(bh[x]->b_data + sizeof(struct gfs2_meta_header),
1294 data, 1294 data,
@@ -1323,7 +1323,7 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el,
1323 if (error) 1323 if (error)
1324 return error; 1324 return error;
1325 1325
1326 gfs2_trans_add_bh(ip->i_gl, el->el_bh); 1326 gfs2_trans_add_bh(ip->i_gl, el->el_bh, 1);
1327 memcpy(GFS2_EA2DATA(el->el_ea), 1327 memcpy(GFS2_EA2DATA(el->el_ea),
1328 data, 1328 data,
1329 GFS2_EA_DATA_LEN(el->el_ea)); 1329 GFS2_EA_DATA_LEN(el->el_ea));
@@ -1338,7 +1338,7 @@ int gfs2_ea_acl_chmod(struct gfs2_inode *ip, struct gfs2_ea_location *el,
1338 error = inode_setattr(ip->i_vnode, attr); 1338 error = inode_setattr(ip->i_vnode, attr);
1339 gfs2_assert_warn(ip->i_sbd, !error); 1339 gfs2_assert_warn(ip->i_sbd, !error);
1340 gfs2_inode_attr_out(ip); 1340 gfs2_inode_attr_out(ip);
1341 gfs2_trans_add_bh(ip->i_gl, dibh); 1341 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1342 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1342 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1343 brelse(dibh); 1343 brelse(dibh);
1344 } 1344 }
@@ -1416,7 +1416,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1416 if (error) 1416 if (error)
1417 goto out_gunlock; 1417 goto out_gunlock;
1418 1418
1419 gfs2_trans_add_bh(ip->i_gl, indbh); 1419 gfs2_trans_add_bh(ip->i_gl, indbh, 1);
1420 1420
1421 eablk = (uint64_t *)(indbh->b_data + sizeof(struct gfs2_meta_header)); 1421 eablk = (uint64_t *)(indbh->b_data + sizeof(struct gfs2_meta_header));
1422 bstart = 0; 1422 bstart = 0;
@@ -1450,7 +1450,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1450 1450
1451 error = gfs2_meta_inode_buffer(ip, &dibh); 1451 error = gfs2_meta_inode_buffer(ip, &dibh);
1452 if (!error) { 1452 if (!error) {
1453 gfs2_trans_add_bh(ip->i_gl, dibh); 1453 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1454 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1454 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1455 brelse(dibh); 1455 brelse(dibh);
1456 } 1456 }
@@ -1502,7 +1502,7 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
1502 1502
1503 error = gfs2_meta_inode_buffer(ip, &dibh); 1503 error = gfs2_meta_inode_buffer(ip, &dibh);
1504 if (!error) { 1504 if (!error) {
1505 gfs2_trans_add_bh(ip->i_gl, dibh); 1505 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1506 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1506 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1507 brelse(dibh); 1507 brelse(dibh);
1508 } 1508 }
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index aa5311ef7ba7..9ed7c0541065 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -691,7 +691,7 @@ int gfs2_change_nlink(struct gfs2_inode *ip, int diff)
691 ip->i_di.di_nlink = nlink; 691 ip->i_di.di_nlink = nlink;
692 ip->i_di.di_ctime = get_seconds(); 692 ip->i_di.di_ctime = get_seconds();
693 693
694 gfs2_trans_add_bh(ip->i_gl, dibh); 694 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
695 gfs2_dinode_out(&ip->i_di, dibh->b_data); 695 gfs2_dinode_out(&ip->i_di, dibh->b_data);
696 brelse(dibh); 696 brelse(dibh);
697 697
@@ -786,7 +786,7 @@ static int pick_formal_ino_1(struct gfs2_sbd *sdp, uint64_t *formal_ino)
786 if (ir.ir_length) { 786 if (ir.ir_length) {
787 *formal_ino = ir.ir_start++; 787 *formal_ino = ir.ir_start++;
788 ir.ir_length--; 788 ir.ir_length--;
789 gfs2_trans_add_bh(ip->i_gl, bh); 789 gfs2_trans_add_bh(ip->i_gl, bh, 1);
790 gfs2_inum_range_out(&ir, 790 gfs2_inum_range_out(&ir,
791 bh->b_data + sizeof(struct gfs2_dinode)); 791 bh->b_data + sizeof(struct gfs2_dinode));
792 brelse(bh); 792 brelse(bh);
@@ -843,7 +843,7 @@ static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino)
843 if (x < y) 843 if (x < y)
844 gfs2_consist_inode(m_ip); 844 gfs2_consist_inode(m_ip);
845 x = cpu_to_be64(x); 845 x = cpu_to_be64(x);
846 gfs2_trans_add_bh(m_ip->i_gl, m_bh); 846 gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1);
847 *(uint64_t *)(m_bh->b_data + sizeof(struct gfs2_dinode)) = x; 847 *(uint64_t *)(m_bh->b_data + sizeof(struct gfs2_dinode)) = x;
848 848
849 brelse(m_bh); 849 brelse(m_bh);
@@ -852,7 +852,7 @@ static int pick_formal_ino_2(struct gfs2_sbd *sdp, uint64_t *formal_ino)
852 *formal_ino = ir.ir_start++; 852 *formal_ino = ir.ir_start++;
853 ir.ir_length--; 853 ir.ir_length--;
854 854
855 gfs2_trans_add_bh(ip->i_gl, bh); 855 gfs2_trans_add_bh(ip->i_gl, bh, 1);
856 gfs2_inum_range_out(&ir, bh->b_data + sizeof(struct gfs2_dinode)); 856 gfs2_inum_range_out(&ir, bh->b_data + sizeof(struct gfs2_dinode));
857 857
858 out_brelse: 858 out_brelse:
@@ -997,7 +997,7 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
997 struct buffer_head *dibh; 997 struct buffer_head *dibh;
998 998
999 dibh = gfs2_meta_new(gl, inum->no_addr); 999 dibh = gfs2_meta_new(gl, inum->no_addr);
1000 gfs2_trans_add_bh(gl, dibh); 1000 gfs2_trans_add_bh(gl, dibh, 1);
1001 gfs2_metatype_set(dibh, GFS2_METATYPE_DI, GFS2_FORMAT_DI); 1001 gfs2_metatype_set(dibh, GFS2_METATYPE_DI, GFS2_FORMAT_DI);
1002 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 1002 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
1003 di = (struct gfs2_dinode *)dibh->b_data; 1003 di = (struct gfs2_dinode *)dibh->b_data;
@@ -1135,7 +1135,7 @@ static int link_dinode(struct gfs2_inode *dip, struct qstr *name,
1135 if (error) 1135 if (error)
1136 goto fail_end_trans; 1136 goto fail_end_trans;
1137 ip->i_di.di_nlink = 1; 1137 ip->i_di.di_nlink = 1;
1138 gfs2_trans_add_bh(ip->i_gl, dibh); 1138 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1139 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1139 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1140 brelse(dibh); 1140 brelse(dibh);
1141 1141
@@ -1601,7 +1601,7 @@ int gfs2_glock_nq_atime(struct gfs2_holder *gh)
1601 1601
1602 ip->i_di.di_atime = curtime; 1602 ip->i_di.di_atime = curtime;
1603 1603
1604 gfs2_trans_add_bh(ip->i_gl, dibh); 1604 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1605 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1605 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1606 brelse(dibh); 1606 brelse(dibh);
1607 1607
@@ -1776,7 +1776,7 @@ __gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
1776 gfs2_assert_warn(ip->i_sbd, !error); 1776 gfs2_assert_warn(ip->i_sbd, !error);
1777 gfs2_inode_attr_out(ip); 1777 gfs2_inode_attr_out(ip);
1778 1778
1779 gfs2_trans_add_bh(ip->i_gl, dibh); 1779 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1780 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1780 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1781 brelse(dibh); 1781 brelse(dibh);
1782 } 1782 }
diff --git a/fs/gfs2/jdata.c b/fs/gfs2/jdata.c
index d4adbf171ed3..6caa93e46ce0 100644
--- a/fs/gfs2/jdata.c
+++ b/fs/gfs2/jdata.c
@@ -30,7 +30,7 @@ int gfs2_jdata_get_buffer(struct gfs2_inode *ip, uint64_t block, int new,
30 30
31 if (new) { 31 if (new) {
32 bh = gfs2_meta_new(ip->i_gl, block); 32 bh = gfs2_meta_new(ip->i_gl, block);
33 gfs2_trans_add_bh(ip->i_gl, bh); 33 gfs2_trans_add_bh(ip->i_gl, bh, 1);
34 gfs2_metatype_set(bh, GFS2_METATYPE_JD, GFS2_FORMAT_JD); 34 gfs2_metatype_set(bh, GFS2_METATYPE_JD, GFS2_FORMAT_JD);
35 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header)); 35 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
36 } else { 36 } else {
@@ -220,7 +220,7 @@ int gfs2_jdata_read(struct gfs2_inode *ip, char __user *buf, uint64_t offset,
220int gfs2_copy_from_mem(struct gfs2_inode *ip, struct buffer_head *bh, 220int gfs2_copy_from_mem(struct gfs2_inode *ip, struct buffer_head *bh,
221 const char **buf, unsigned int offset, unsigned int size) 221 const char **buf, unsigned int offset, unsigned int size)
222{ 222{
223 gfs2_trans_add_bh(ip->i_gl, bh); 223 gfs2_trans_add_bh(ip->i_gl, bh, 1);
224 memcpy(bh->b_data + offset, *buf, size); 224 memcpy(bh->b_data + offset, *buf, size);
225 225
226 *buf += size; 226 *buf += size;
@@ -243,7 +243,7 @@ int gfs2_copy_from_user(struct gfs2_inode *ip, struct buffer_head *bh,
243{ 243{
244 int error = 0; 244 int error = 0;
245 245
246 gfs2_trans_add_bh(ip->i_gl, bh); 246 gfs2_trans_add_bh(ip->i_gl, bh, 1);
247 if (copy_from_user(bh->b_data + offset, *buf, size)) 247 if (copy_from_user(bh->b_data + offset, *buf, size))
248 error = -EFAULT; 248 error = -EFAULT;
249 else 249 else
@@ -368,7 +368,7 @@ int gfs2_jdata_write(struct gfs2_inode *ip, const char __user *buf, uint64_t off
368 ip->i_di.di_size = offset + copied; 368 ip->i_di.di_size = offset + copied;
369 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); 369 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
370 370
371 gfs2_trans_add_bh(ip->i_gl, dibh); 371 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
372 gfs2_dinode_out(&ip->i_di, dibh->b_data); 372 gfs2_dinode_out(&ip->i_di, dibh->b_data);
373 brelse(dibh); 373 brelse(dibh);
374 374
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 177b0246d194..8bbe11855223 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -786,7 +786,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, uint64_t num,
786 brelse(bh); 786 brelse(bh);
787 return -EIO; 787 return -EIO;
788 } 788 }
789 gfs2_trans_add_bh(ip->i_gl, bh); 789 gfs2_trans_add_bh(ip->i_gl, bh, 1);
790 gfs2_metatype_set(bh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); 790 gfs2_metatype_set(bh, GFS2_METATYPE_IN, GFS2_FORMAT_IN);
791 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header)); 791 gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
792 792
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 0aa5f140ddb1..d352b3528f5e 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -368,7 +368,7 @@ static int gfs2_commit_write(struct file *file, struct page *page,
368 if (error) 368 if (error)
369 goto fail; 369 goto fail;
370 370
371 gfs2_trans_add_bh(ip->i_gl, dibh); 371 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
372 372
373 kaddr = kmap(page); 373 kaddr = kmap(page);
374 memcpy(dibh->b_data + sizeof(struct gfs2_dinode) + from, 374 memcpy(dibh->b_data + sizeof(struct gfs2_dinode) + from,
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 563c19d0d406..0f356fc4690c 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -456,7 +456,7 @@ static ssize_t do_write_direct_alloc(struct file *file, const char __user *buf,
456 ip->i_di.di_mode &= (ip->i_di.di_mode & S_IXGRP) ? 456 ip->i_di.di_mode &= (ip->i_di.di_mode & S_IXGRP) ?
457 (~(S_ISUID | S_ISGID)) : (~S_ISUID); 457 (~(S_ISUID | S_ISGID)) : (~S_ISUID);
458 458
459 gfs2_trans_add_bh(ip->i_gl, dibh); 459 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
460 gfs2_dinode_out(&ip->i_di, dibh->b_data); 460 gfs2_dinode_out(&ip->i_di, dibh->b_data);
461 brelse(dibh); 461 brelse(dibh);
462 } 462 }
@@ -481,7 +481,7 @@ static ssize_t do_write_direct_alloc(struct file *file, const char __user *buf,
481 ip->i_di.di_size = inode->i_size; 481 ip->i_di.di_size = inode->i_size;
482 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); 482 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
483 483
484 gfs2_trans_add_bh(ip->i_gl, dibh); 484 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
485 gfs2_dinode_out(&ip->i_di, dibh->b_data); 485 gfs2_dinode_out(&ip->i_di, dibh->b_data);
486 brelse(dibh); 486 brelse(dibh);
487 487
@@ -721,7 +721,7 @@ static ssize_t do_do_write_buf(struct file *file, const char __user *buf, size_t
721 ip->i_di.di_mode &= (ip->i_di.di_mode & S_IXGRP) ? 721 ip->i_di.di_mode &= (ip->i_di.di_mode & S_IXGRP) ?
722 (~(S_ISUID | S_ISGID)) : (~S_ISUID); 722 (~(S_ISUID | S_ISGID)) : (~S_ISUID);
723 723
724 gfs2_trans_add_bh(ip->i_gl, dibh); 724 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
725 gfs2_dinode_out(&ip->i_di, dibh->b_data); 725 gfs2_dinode_out(&ip->i_di, dibh->b_data);
726 brelse(dibh); 726 brelse(dibh);
727 } 727 }
@@ -752,7 +752,7 @@ static ssize_t do_do_write_buf(struct file *file, const char __user *buf, size_t
752 ip->i_di.di_size = inode->i_size; 752 ip->i_di.di_size = inode->i_size;
753 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds(); 753 ip->i_di.di_mtime = ip->i_di.di_ctime = get_seconds();
754 754
755 gfs2_trans_add_bh(ip->i_gl, dibh); 755 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
756 gfs2_dinode_out(&ip->i_di, dibh->b_data); 756 gfs2_dinode_out(&ip->i_di, dibh->b_data);
757 brelse(dibh); 757 brelse(dibh);
758 } 758 }
@@ -1177,7 +1177,7 @@ static int gfs2_ioctl_flags(struct gfs2_inode *ip, unsigned int cmd, unsigned lo
1177 1177
1178 ip->i_di.di_flags = flags; 1178 ip->i_di.di_flags = flags;
1179 1179
1180 gfs2_trans_add_bh(ip->i_gl, dibh); 1180 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1181 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1181 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1182 1182
1183 brelse(dibh); 1183 brelse(dibh);
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index d0f90b88380c..89417a6cb723 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -839,7 +839,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
839 if (error) 839 if (error)
840 goto out_end_trans; 840 goto out_end_trans;
841 ip->i_di.di_ctime = get_seconds(); 841 ip->i_di.di_ctime = get_seconds();
842 gfs2_trans_add_bh(ip->i_gl, dibh); 842 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
843 gfs2_dinode_out(&ip->i_di, dibh->b_data); 843 gfs2_dinode_out(&ip->i_di, dibh->b_data);
844 brelse(dibh); 844 brelse(dibh);
845 } 845 }
@@ -1043,7 +1043,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)
1043 gfs2_assert_warn(sdp, !error); 1043 gfs2_assert_warn(sdp, !error);
1044 gfs2_inode_attr_out(ip); 1044 gfs2_inode_attr_out(ip);
1045 1045
1046 gfs2_trans_add_bh(ip->i_gl, dibh); 1046 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1047 gfs2_dinode_out(&ip->i_di, dibh->b_data); 1047 gfs2_dinode_out(&ip->i_di, dibh->b_data);
1048 brelse(dibh); 1048 brelse(dibh);
1049 1049
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index a0320f22b57b..5fb5a5305e0e 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -527,7 +527,7 @@ static void do_qc(struct gfs2_quota_data *qd, int64_t change)
527 int64_t x; 527 int64_t x;
528 528
529 down(&sdp->sd_quota_mutex); 529 down(&sdp->sd_quota_mutex);
530 gfs2_trans_add_bh(ip->i_gl, qd->qd_bh); 530 gfs2_trans_add_bh(ip->i_gl, qd->qd_bh, 1);
531 531
532 if (!test_bit(QDF_CHANGE, &qd->qd_flags)) { 532 if (!test_bit(QDF_CHANGE, &qd->qd_flags)) {
533 qc->qc_change = 0; 533 qc->qc_change = 0;
diff --git a/fs/gfs2/resize.c b/fs/gfs2/resize.c
index 67d26b99a73c..a53096682500 100644
--- a/fs/gfs2/resize.c
+++ b/fs/gfs2/resize.c
@@ -255,7 +255,7 @@ int gfs2_rename2system(struct gfs2_inode *ip,
255 if (error) 255 if (error)
256 goto out_trans; 256 goto out_trans;
257 ip->i_di.di_flags |= GFS2_DIF_SYSTEM; 257 ip->i_di.di_flags |= GFS2_DIF_SYSTEM;
258 gfs2_trans_add_bh(ip->i_gl, dibh); 258 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
259 gfs2_dinode_out(&ip->i_di, dibh->b_data); 259 gfs2_dinode_out(&ip->i_di, dibh->b_data);
260 brelse(dibh); 260 brelse(dibh);
261 261
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 8df6fba20fac..87c80bbce1cf 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -967,7 +967,7 @@ static uint32_t rgblk_search(struct gfs2_rgrpd *rgd, uint32_t goal,
967 if (gfs2_assert_withdraw(rgd->rd_sbd, x <= length)) 967 if (gfs2_assert_withdraw(rgd->rd_sbd, x <= length))
968 blk = 0; 968 blk = 0;
969 969
970 gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh); 970 gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1);
971 gfs2_setbit(rgd, 971 gfs2_setbit(rgd,
972 bi->bi_bh->b_data + bi->bi_offset, 972 bi->bi_bh->b_data + bi->bi_offset,
973 bi->bi_len, blk, new_state); 973 bi->bi_len, blk, new_state);
@@ -1027,7 +1027,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, uint64_t bstart,
1027 bi->bi_bh->b_data + bi->bi_offset, 1027 bi->bi_bh->b_data + bi->bi_offset,
1028 bi->bi_len); 1028 bi->bi_len);
1029 } 1029 }
1030 gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh); 1030 gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1);
1031 gfs2_setbit(rgd, 1031 gfs2_setbit(rgd,
1032 bi->bi_bh->b_data + bi->bi_offset, 1032 bi->bi_bh->b_data + bi->bi_offset,
1033 bi->bi_len, buf_blk, new_state); 1033 bi->bi_len, buf_blk, new_state);
@@ -1066,7 +1066,7 @@ uint64_t gfs2_alloc_data(struct gfs2_inode *ip)
1066 gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); 1066 gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free);
1067 rgd->rd_rg.rg_free--; 1067 rgd->rd_rg.rg_free--;
1068 1068
1069 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh); 1069 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1070 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); 1070 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
1071 1071
1072 al->al_alloced++; 1072 al->al_alloced++;
@@ -1111,7 +1111,7 @@ uint64_t gfs2_alloc_meta(struct gfs2_inode *ip)
1111 gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); 1111 gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free);
1112 rgd->rd_rg.rg_free--; 1112 rgd->rd_rg.rg_free--;
1113 1113
1114 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh); 1114 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1115 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); 1115 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
1116 1116
1117 al->al_alloced++; 1117 al->al_alloced++;
@@ -1153,7 +1153,7 @@ uint64_t gfs2_alloc_di(struct gfs2_inode *dip)
1153 rgd->rd_rg.rg_free--; 1153 rgd->rd_rg.rg_free--;
1154 rgd->rd_rg.rg_dinodes++; 1154 rgd->rd_rg.rg_dinodes++;
1155 1155
1156 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh); 1156 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1157 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); 1157 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
1158 1158
1159 al->al_alloced++; 1159 al->al_alloced++;
@@ -1187,7 +1187,7 @@ void gfs2_free_data(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen)
1187 1187
1188 rgd->rd_rg.rg_free += blen; 1188 rgd->rd_rg.rg_free += blen;
1189 1189
1190 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh); 1190 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1191 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); 1191 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
1192 1192
1193 gfs2_trans_add_rg(rgd); 1193 gfs2_trans_add_rg(rgd);
@@ -1216,7 +1216,7 @@ void gfs2_free_meta(struct gfs2_inode *ip, uint64_t bstart, uint32_t blen)
1216 1216
1217 rgd->rd_rg.rg_free += blen; 1217 rgd->rd_rg.rg_free += blen;
1218 1218
1219 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh); 1219 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1220 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); 1220 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
1221 1221
1222 gfs2_trans_add_rg(rgd); 1222 gfs2_trans_add_rg(rgd);
@@ -1242,7 +1242,7 @@ void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, uint64_t blkno)
1242 rgd->rd_rg.rg_dinodes--; 1242 rgd->rd_rg.rg_dinodes--;
1243 rgd->rd_rg.rg_free++; 1243 rgd->rd_rg.rg_free++;
1244 1244
1245 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh); 1245 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1246 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data); 1246 gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
1247 1247
1248 gfs2_statfs_change(sdp, 0, +1, -1); 1248 gfs2_statfs_change(sdp, 0, +1, -1);
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index d37f203e133b..cab7ab5fb506 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -608,7 +608,7 @@ void gfs2_statfs_change(struct gfs2_sbd *sdp, int64_t total, int64_t free,
608 return; 608 return;
609 609
610 down(&sdp->sd_statfs_mutex); 610 down(&sdp->sd_statfs_mutex);
611 gfs2_trans_add_bh(l_ip->i_gl, l_bh); 611 gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
612 up(&sdp->sd_statfs_mutex); 612 up(&sdp->sd_statfs_mutex);
613 613
614 spin_lock(&sdp->sd_statfs_spin); 614 spin_lock(&sdp->sd_statfs_spin);
@@ -659,7 +659,7 @@ int gfs2_statfs_sync(struct gfs2_sbd *sdp)
659 goto out_bh2; 659 goto out_bh2;
660 660
661 down(&sdp->sd_statfs_mutex); 661 down(&sdp->sd_statfs_mutex);
662 gfs2_trans_add_bh(l_ip->i_gl, l_bh); 662 gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
663 up(&sdp->sd_statfs_mutex); 663 up(&sdp->sd_statfs_mutex);
664 664
665 spin_lock(&sdp->sd_statfs_spin); 665 spin_lock(&sdp->sd_statfs_spin);
@@ -671,7 +671,7 @@ int gfs2_statfs_sync(struct gfs2_sbd *sdp)
671 0, sizeof(struct gfs2_statfs_change)); 671 0, sizeof(struct gfs2_statfs_change));
672 spin_unlock(&sdp->sd_statfs_spin); 672 spin_unlock(&sdp->sd_statfs_spin);
673 673
674 gfs2_trans_add_bh(m_ip->i_gl, m_bh); 674 gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1);
675 gfs2_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs2_dinode)); 675 gfs2_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs2_dinode));
676 676
677 gfs2_trans_end(sdp); 677 gfs2_trans_end(sdp);
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index afa5408c0008..82952fb64830 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -138,10 +138,11 @@ void gfs2_trans_add_gl(struct gfs2_glock *gl)
138 * gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction 138 * gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction
139 * @gl: the glock the buffer belongs to 139 * @gl: the glock the buffer belongs to
140 * @bh: The buffer to add 140 * @bh: The buffer to add
141 * @meta: True in the case of adding metadata
141 * 142 *
142 */ 143 */
143 144
144void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh) 145void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta)
145{ 146{
146 struct gfs2_sbd *sdp = gl->gl_sbd; 147 struct gfs2_sbd *sdp = gl->gl_sbd;
147 struct gfs2_bufdata *bd; 148 struct gfs2_bufdata *bd;
diff --git a/fs/gfs2/trans.h b/fs/gfs2/trans.h
index ac615e9e8521..5a7da1e853c9 100644
--- a/fs/gfs2/trans.h
+++ b/fs/gfs2/trans.h
@@ -31,7 +31,7 @@ int gfs2_trans_begin_i(struct gfs2_sbd *sdp,
31void gfs2_trans_end(struct gfs2_sbd *sdp); 31void gfs2_trans_end(struct gfs2_sbd *sdp);
32 32
33void gfs2_trans_add_gl(struct gfs2_glock *gl); 33void gfs2_trans_add_gl(struct gfs2_glock *gl);
34void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh); 34void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta);
35void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, uint64_t blkno); 35void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, uint64_t blkno);
36void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, uint64_t blkno); 36void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, uint64_t blkno);
37void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd); 37void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd);
diff --git a/fs/gfs2/unlinked.c b/fs/gfs2/unlinked.c
index 4a993af58c1a..b8d836e3a5c0 100644
--- a/fs/gfs2/unlinked.c
+++ b/fs/gfs2/unlinked.c
@@ -47,7 +47,7 @@ static int munge_ondisk(struct gfs2_sbd *sdp, unsigned int slot,
47 } 47 }
48 48
49 down(&sdp->sd_unlinked_mutex); 49 down(&sdp->sd_unlinked_mutex);
50 gfs2_trans_add_bh(ip->i_gl, bh); 50 gfs2_trans_add_bh(ip->i_gl, bh, 1);
51 gfs2_unlinked_tag_out(ut, bh->b_data + 51 gfs2_unlinked_tag_out(ut, bh->b_data +
52 sizeof(struct gfs2_meta_header) + 52 sizeof(struct gfs2_meta_header) +
53 offset * sizeof(struct gfs2_unlinked_tag)); 53 offset * sizeof(struct gfs2_unlinked_tag));