[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>
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 33c465a..9482a67 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -202,7 +202,7 @@
 		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);
 	}
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index bece362..967cbc6 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -124,7 +124,7 @@
 
 	/*  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));
 
@@ -223,7 +223,7 @@
 			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);
@@ -236,7 +236,7 @@
 
 		/*  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));
 
@@ -382,7 +382,7 @@
 	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++;
@@ -490,7 +490,7 @@
 	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);
 		}
@@ -672,8 +672,8 @@
 
 	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;
@@ -795,7 +795,7 @@
 	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);
 
@@ -833,7 +833,7 @@
 	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);
@@ -861,7 +861,7 @@
 	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;
@@ -879,7 +879,7 @@
 			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);
 		}
 	}
@@ -957,7 +957,7 @@
 	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);
 
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index f6304e5..93d3704 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -201,7 +201,7 @@
 		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
@@ -264,7 +264,7 @@
 			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);
@@ -282,7 +282,7 @@
 
 		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 +
@@ -552,7 +552,7 @@
 	/*  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));
 
@@ -596,7 +596,7 @@
 	/*  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));
@@ -647,7 +647,7 @@
 	/*  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));
 
@@ -661,7 +661,7 @@
 	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;
 
@@ -1285,14 +1285,14 @@
 				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;
@@ -1330,7 +1330,7 @@
 		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);
 
@@ -1376,7 +1376,7 @@
 	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);
 
@@ -1481,7 +1481,7 @@
 	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;
@@ -1494,7 +1494,7 @@
 
 	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);
 
@@ -1681,7 +1681,7 @@
 	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;
@@ -1976,7 +1976,7 @@
 	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);
 
@@ -2030,7 +2030,7 @@
 
 	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);
 	}
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index dec55dc..02e45c4 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -268,7 +268,7 @@
 	if (error)
 		goto out_gunlock;
 
-	gfs2_trans_add_bh(ip->i_gl, bh);
+	gfs2_trans_add_bh(ip->i_gl, bh, 1);
 
 	dataptrs = GFS2_EA2DATAPTRS(ea);
 	for (x = 0; x < ea->ea_num_ptrs; x++, dataptrs++) {
@@ -309,7 +309,7 @@
 	error = gfs2_meta_inode_buffer(ip, &dibh);
 	if (!error) {
 		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);
 		brelse(dibh);
 	}
@@ -628,7 +628,7 @@
 	block = gfs2_alloc_meta(ip);
 
 	*bhp = gfs2_meta_new(ip->i_gl, block);
-	gfs2_trans_add_bh(ip->i_gl, *bhp);
+	gfs2_trans_add_bh(ip->i_gl, *bhp, 1);
 	gfs2_metatype_set(*bhp, GFS2_METATYPE_EA, GFS2_FORMAT_EA);
 	gfs2_buffer_clear_tail(*bhp, sizeof(struct gfs2_meta_header));
 
@@ -686,7 +686,7 @@
 			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_ED, GFS2_FORMAT_ED);
 
 			ip->i_di.di_blocks++;
@@ -759,7 +759,7 @@
 			ip->i_di.di_mode = er->er_mode;
 		}
 		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);
 		brelse(dibh);
 	}
@@ -839,7 +839,7 @@
 	struct gfs2_ea_header *prev = el->el_prev;
 	uint32_t len;
 
-	gfs2_trans_add_bh(ip->i_gl, el->el_bh);
+	gfs2_trans_add_bh(ip->i_gl, el->el_bh, 1);
 
 	if (!prev || !GFS2_EA_IS_STUFFED(ea)) {
 		ea->ea_type = GFS2_EATYPE_UNUSED;
@@ -877,7 +877,7 @@
 	if (error)
 		return error;
 
-	gfs2_trans_add_bh(ip->i_gl, bh);
+	gfs2_trans_add_bh(ip->i_gl, bh, 1);
 
 	if (es->ea_split)
 		ea = ea_split_ea(ea);
@@ -897,7 +897,7 @@
 		ip->i_di.di_mode = er->er_mode;
 	}
 	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);
 	brelse(dibh);
  out:
@@ -913,7 +913,7 @@
 	struct gfs2_ea_header *ea = es->es_ea;
 	int error;
 
-	gfs2_trans_add_bh(ip->i_gl, es->es_bh);
+	gfs2_trans_add_bh(ip->i_gl, es->es_bh, 1);
 
 	if (es->ea_split)
 		ea = ea_split_ea(ea);
@@ -1007,14 +1007,14 @@
 			goto out;
 		}
 
-		gfs2_trans_add_bh(ip->i_gl, indbh);
+		gfs2_trans_add_bh(ip->i_gl, indbh, 1);
 	} else {
 		uint64_t blk;
 
 		blk = gfs2_alloc_meta(ip);
 
 		indbh = gfs2_meta_new(ip->i_gl, blk);
-		gfs2_trans_add_bh(ip->i_gl, indbh);
+		gfs2_trans_add_bh(ip->i_gl, indbh, 1);
 		gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN);
 		gfs2_buffer_clear_tail(indbh, mh_size);
 
@@ -1163,7 +1163,7 @@
 	if (error)
 		return error;
 
-	gfs2_trans_add_bh(ip->i_gl, el->el_bh);
+	gfs2_trans_add_bh(ip->i_gl, el->el_bh, 1);
 
 	if (prev) {
 		uint32_t len;
@@ -1179,7 +1179,7 @@
 	error = gfs2_meta_inode_buffer(ip, &dibh);
 	if (!error) {
 		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);
 		brelse(dibh);
 	}	
@@ -1288,7 +1288,7 @@
 			goto fail;
 		}
 
-		gfs2_trans_add_bh(ip->i_gl, bh[x]);
+		gfs2_trans_add_bh(ip->i_gl, bh[x], 1);
 
 		memcpy(bh[x]->b_data + sizeof(struct gfs2_meta_header),
 		       data,
@@ -1323,7 +1323,7 @@
 		if (error)
 			return error;
 
-		gfs2_trans_add_bh(ip->i_gl, el->el_bh);
+		gfs2_trans_add_bh(ip->i_gl, el->el_bh, 1);
 		memcpy(GFS2_EA2DATA(el->el_ea),
 		       data,
 		       GFS2_EA_DATA_LEN(el->el_ea));
@@ -1338,7 +1338,7 @@
 		error = inode_setattr(ip->i_vnode, attr);
 		gfs2_assert_warn(ip->i_sbd, !error);
 		gfs2_inode_attr_out(ip);
-		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);
 	}
@@ -1416,7 +1416,7 @@
 	if (error)
 		goto out_gunlock;
 
-	gfs2_trans_add_bh(ip->i_gl, indbh);
+	gfs2_trans_add_bh(ip->i_gl, indbh, 1);
 
 	eablk = (uint64_t *)(indbh->b_data + sizeof(struct gfs2_meta_header));
 	bstart = 0;
@@ -1450,7 +1450,7 @@
 
 	error = gfs2_meta_inode_buffer(ip, &dibh);
 	if (!error) {
-		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);
 	}
@@ -1502,7 +1502,7 @@
 
 	error = gfs2_meta_inode_buffer(ip, &dibh);
 	if (!error) {
-		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);
 	}
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index aa5311e..9ed7c05 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -691,7 +691,7 @@
 	ip->i_di.di_nlink = nlink;
 	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);
 	brelse(dibh);
 
@@ -786,7 +786,7 @@
 	if (ir.ir_length) {
 		*formal_ino = ir.ir_start++;
 		ir.ir_length--;
-		gfs2_trans_add_bh(ip->i_gl, bh);
+		gfs2_trans_add_bh(ip->i_gl, bh, 1);
 		gfs2_inum_range_out(&ir,
 				    bh->b_data + sizeof(struct gfs2_dinode));
 		brelse(bh);
@@ -843,7 +843,7 @@
 		if (x < y)
 			gfs2_consist_inode(m_ip);
 		x = cpu_to_be64(x);
-		gfs2_trans_add_bh(m_ip->i_gl, m_bh);
+		gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1);
 		*(uint64_t *)(m_bh->b_data + sizeof(struct gfs2_dinode)) = x;
 
 		brelse(m_bh);
@@ -852,7 +852,7 @@
 	*formal_ino = ir.ir_start++;
 	ir.ir_length--;
 
-	gfs2_trans_add_bh(ip->i_gl, bh);
+	gfs2_trans_add_bh(ip->i_gl, bh, 1);
 	gfs2_inum_range_out(&ir, bh->b_data + sizeof(struct gfs2_dinode));
 
  out_brelse:
@@ -997,7 +997,7 @@
 	struct buffer_head *dibh;
 
 	dibh = gfs2_meta_new(gl, inum->no_addr);
-	gfs2_trans_add_bh(gl, dibh);
+	gfs2_trans_add_bh(gl, dibh, 1);
 	gfs2_metatype_set(dibh, GFS2_METATYPE_DI, GFS2_FORMAT_DI);
 	gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
 	di = (struct gfs2_dinode *)dibh->b_data;
@@ -1135,7 +1135,7 @@
 	if (error)
 		goto fail_end_trans;
 	ip->i_di.di_nlink = 1;
-	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);
 
@@ -1601,7 +1601,7 @@
 
 			ip->i_di.di_atime = curtime;
 
-			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);
 
@@ -1776,7 +1776,7 @@
 		gfs2_assert_warn(ip->i_sbd, !error);
 		gfs2_inode_attr_out(ip);
 
-		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);
 	}
diff --git a/fs/gfs2/jdata.c b/fs/gfs2/jdata.c
index d4adbf1..6caa93e 100644
--- a/fs/gfs2/jdata.c
+++ b/fs/gfs2/jdata.c
@@ -30,7 +30,7 @@
 
 	if (new) {
 		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_JD, GFS2_FORMAT_JD);
 		gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
 	} else {
@@ -220,7 +220,7 @@
 int gfs2_copy_from_mem(struct gfs2_inode *ip, struct buffer_head *bh,
 		       const char **buf, unsigned int offset, unsigned int size)
 {
-	gfs2_trans_add_bh(ip->i_gl, bh);
+	gfs2_trans_add_bh(ip->i_gl, bh, 1);
 	memcpy(bh->b_data + offset, *buf, size);
 
 	*buf += size;
@@ -243,7 +243,7 @@
 {
 	int error = 0;
 
-	gfs2_trans_add_bh(ip->i_gl, bh);
+	gfs2_trans_add_bh(ip->i_gl, bh, 1);
 	if (copy_from_user(bh->b_data + offset, *buf, size))
 		error = -EFAULT;
 	else
@@ -368,7 +368,7 @@
 		ip->i_di.di_size = offset + copied;
 	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);
 	brelse(dibh);
 
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 177b024..8bbe118 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -786,7 +786,7 @@
 			brelse(bh);
 			return -EIO;
 		}
-		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);
 		gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header));
 
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 0aa5f140..d352b35 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -368,7 +368,7 @@
 		if (error)
 			goto fail;
 
-		gfs2_trans_add_bh(ip->i_gl, dibh);
+		gfs2_trans_add_bh(ip->i_gl, dibh, 1);
 
 		kaddr = kmap(page);
 		memcpy(dibh->b_data + sizeof(struct gfs2_dinode) + from,
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 563c19d..0f356fc 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -456,7 +456,7 @@
 		ip->i_di.di_mode &= (ip->i_di.di_mode & S_IXGRP) ?
 			(~(S_ISUID | S_ISGID)) : (~S_ISUID);
 
-		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);
 	}
@@ -481,7 +481,7 @@
 		ip->i_di.di_size = inode->i_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);
 	brelse(dibh);
 
@@ -721,7 +721,7 @@
 		ip->i_di.di_mode &= (ip->i_di.di_mode & S_IXGRP) ?
 					  (~(S_ISUID | S_ISGID)) : (~S_ISUID);
 
-		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);
 	}
@@ -752,7 +752,7 @@
 			ip->i_di.di_size = inode->i_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);
 		brelse(dibh);
 	}
@@ -1177,7 +1177,7 @@
 
 		ip->i_di.di_flags = flags;
 
-		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);
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index d0f90b88..89417a6 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -839,7 +839,7 @@
 		if (error)
 			goto out_end_trans;
 		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);
 		brelse(dibh);
 	}
@@ -1043,7 +1043,7 @@
 	gfs2_assert_warn(sdp, !error);
 	gfs2_inode_attr_out(ip);
 
-	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);
 
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index a0320f2..5fb5a53 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -527,7 +527,7 @@
 	int64_t x;
 
 	down(&sdp->sd_quota_mutex);
-	gfs2_trans_add_bh(ip->i_gl, qd->qd_bh);
+	gfs2_trans_add_bh(ip->i_gl, qd->qd_bh, 1);
 
 	if (!test_bit(QDF_CHANGE, &qd->qd_flags)) {
 		qc->qc_change = 0;
diff --git a/fs/gfs2/resize.c b/fs/gfs2/resize.c
index 67d26b9..a530966 100644
--- a/fs/gfs2/resize.c
+++ b/fs/gfs2/resize.c
@@ -255,7 +255,7 @@
 	if (error)
 		goto out_trans;
 	ip->i_di.di_flags |= GFS2_DIF_SYSTEM;
-	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);
 
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 8df6fba..87c80bb 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -967,7 +967,7 @@
 	if (gfs2_assert_withdraw(rgd->rd_sbd, x <= length))
 		blk = 0;
 
-	gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh);
+	gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1);
 	gfs2_setbit(rgd,
 		    bi->bi_bh->b_data + bi->bi_offset,
 		    bi->bi_len, blk, new_state);
@@ -1027,7 +1027,7 @@
 			       bi->bi_bh->b_data + bi->bi_offset,
 			       bi->bi_len);
 		}
-		gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh);
+		gfs2_trans_add_bh(rgd->rd_gl, bi->bi_bh, 1);
 		gfs2_setbit(rgd,
 			    bi->bi_bh->b_data + bi->bi_offset,
 			    bi->bi_len, buf_blk, new_state);
@@ -1066,7 +1066,7 @@
 	gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free);
 	rgd->rd_rg.rg_free--;
 
-	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh);
+	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
 
 	al->al_alloced++;
@@ -1111,7 +1111,7 @@
 	gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free);
 	rgd->rd_rg.rg_free--;
 
-	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh);
+	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
 
 	al->al_alloced++;
@@ -1153,7 +1153,7 @@
 	rgd->rd_rg.rg_free--;
 	rgd->rd_rg.rg_dinodes++;
 
-	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh);
+	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
 
 	al->al_alloced++;
@@ -1187,7 +1187,7 @@
 
 	rgd->rd_rg.rg_free += blen;
 
-	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh);
+	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
 
 	gfs2_trans_add_rg(rgd);
@@ -1216,7 +1216,7 @@
 
 	rgd->rd_rg.rg_free += blen;
 
-	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh);
+	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
 
 	gfs2_trans_add_rg(rgd);
@@ -1242,7 +1242,7 @@
 	rgd->rd_rg.rg_dinodes--;
 	rgd->rd_rg.rg_free++;
 
-	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh);
+	gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
 	gfs2_rgrp_out(&rgd->rd_rg, rgd->rd_bits[0].bi_bh->b_data);
 
 	gfs2_statfs_change(sdp, 0, +1, -1);
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index d37f203..cab7ab5 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -608,7 +608,7 @@
 		return;
 
 	down(&sdp->sd_statfs_mutex);
-	gfs2_trans_add_bh(l_ip->i_gl, l_bh);
+	gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
 	up(&sdp->sd_statfs_mutex);
 
 	spin_lock(&sdp->sd_statfs_spin);
@@ -659,7 +659,7 @@
 		goto out_bh2;
 
 	down(&sdp->sd_statfs_mutex);
-	gfs2_trans_add_bh(l_ip->i_gl, l_bh);
+	gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
 	up(&sdp->sd_statfs_mutex);
 
 	spin_lock(&sdp->sd_statfs_spin);
@@ -671,7 +671,7 @@
 	       0, sizeof(struct gfs2_statfs_change));
 	spin_unlock(&sdp->sd_statfs_spin);
 
-	gfs2_trans_add_bh(m_ip->i_gl, m_bh);
+	gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1);
 	gfs2_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs2_dinode));
 
 	gfs2_trans_end(sdp);
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index afa5408..82952fb 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -138,10 +138,11 @@
  * gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction
  * @gl: the glock the buffer belongs to
  * @bh: The buffer to add
+ * @meta: True in the case of adding metadata
  *
  */
 
-void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh)
+void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta)
 {
 	struct gfs2_sbd *sdp = gl->gl_sbd;
 	struct gfs2_bufdata *bd;
diff --git a/fs/gfs2/trans.h b/fs/gfs2/trans.h
index ac615e9..5a7da1e 100644
--- a/fs/gfs2/trans.h
+++ b/fs/gfs2/trans.h
@@ -31,7 +31,7 @@
 void gfs2_trans_end(struct gfs2_sbd *sdp);
 
 void gfs2_trans_add_gl(struct gfs2_glock *gl);
-void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh);
+void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta);
 void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, uint64_t blkno);
 void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, uint64_t blkno);
 void gfs2_trans_add_rg(struct gfs2_rgrpd *rgd);
diff --git a/fs/gfs2/unlinked.c b/fs/gfs2/unlinked.c
index 4a993af..b8d836e 100644
--- a/fs/gfs2/unlinked.c
+++ b/fs/gfs2/unlinked.c
@@ -47,7 +47,7 @@
 	}
 
 	down(&sdp->sd_unlinked_mutex);
-	gfs2_trans_add_bh(ip->i_gl, bh);
+	gfs2_trans_add_bh(ip->i_gl, bh, 1);
 	gfs2_unlinked_tag_out(ut, bh->b_data +
 				  sizeof(struct gfs2_meta_header) +
 				  offset * sizeof(struct gfs2_unlinked_tag));