Blame SOURCES/bz1487726-3-gfs2_utils_Accept_a_char_instead_of_a_buffer_head_in_gfs2_check_meta.patch

9257a6
commit 2c070ddf1f552e459d8cb7e08e404b56480353df
9257a6
Author: Andrew Price <anprice@redhat.com>
9257a6
Date:   Mon Jan 28 15:50:51 2019 +0000
9257a6
9257a6
    gfs2-utils: Accept a char* instead of a buffer head in gfs2_check_meta
9257a6
    
9257a6
    This allows us to call it from different contexts.
9257a6
    
9257a6
    Signed-off-by: Andrew Price <anprice@redhat.com>
9257a6
9257a6
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
9257a6
index 98450493..d13a5252 100644
9257a6
--- a/gfs2/convert/gfs2_convert.c
9257a6
+++ b/gfs2/convert/gfs2_convert.c
9257a6
@@ -832,7 +832,7 @@ static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct g
9257a6
 
9257a6
 	/* Read in the i_di.di_eattr block */
9257a6
 	eabh = bread(sbp, ip->i_di.di_eattr);
9257a6
-        if (!gfs2_check_meta(eabh, GFS_METATYPE_IN)) {/* if it is an indirect block */
9257a6
+        if (!gfs2_check_meta(eabh->b_data, GFS_METATYPE_IN)) {/* if it is an indirect block */
9257a6
 		len = sbp->bsize - sizeof(struct gfs_indirect);
9257a6
 		buf = malloc(len);
9257a6
 		if (!buf) {
9257a6
@@ -1008,7 +1008,7 @@ static int next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
9257a6
 			return -1;
9257a6
 		bh = bread(sdp, *block);
9257a6
 		first = 0;
9257a6
-	} while(gfs2_check_meta(bh, type));
9257a6
+	} while(gfs2_check_meta(bh->b_data, type));
9257a6
 	brelse(bh);
9257a6
 	return 0;
9257a6
 }
9257a6
@@ -1068,7 +1068,7 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
9257a6
 				sbp->sd_sb.sb_root_dir.no_formal_ino = sbp->md.next_inum;
9257a6
 			}
9257a6
 			bh = bread(sbp, block);
9257a6
-			if (!gfs2_check_meta(bh, GFS_METATYPE_DI)) {/* if it is an dinode */
9257a6
+			if (!gfs2_check_meta(bh->b_data, GFS_METATYPE_DI)) {/* if it is an dinode */
9257a6
 				/* Skip the rindex and jindex inodes for now. */
9257a6
 				if (block != rindex_addr && block != jindex_addr) {
9257a6
 					error = adjust_inode(sbp, bh);
9257a6
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
9257a6
index b67fde2d..923d6b43 100644
9257a6
--- a/gfs2/edit/hexedit.c
9257a6
+++ b/gfs2/edit/hexedit.c
9257a6
@@ -1274,7 +1274,7 @@ static int find_rg_metatype(struct rgrp_tree *rgd, uint64_t *blk, uint64_t start
9257a6
 		for (j = 0; j < m; j++) {
9257a6
 			*blk = ibuf[j];
9257a6
 			bhp = bread(&sbd, *blk);
9257a6
-			found = (*blk > startblk) && !gfs2_check_meta(bhp, mtype);
9257a6
+			found = (*blk > startblk) && !gfs2_check_meta(bhp->b_data, mtype);
9257a6
 			brelse(bhp);
9257a6
 			if (found) {
9257a6
 				free(ibuf);
9257a6
@@ -2279,7 +2279,7 @@ static int count_dinode_blks(struct rgrp_tree *rgd, int bitmap,
9257a6
 			    rgd->bits[bitmap].bi_start + b);
9257a6
 		byte = rbh->b_data + off + (b / GFS2_NBBY);
9257a6
 		bit = (b % GFS2_NBBY) * GFS2_BIT_SIZE;
9257a6
-		if (gfs2_check_meta(tbh, GFS2_METATYPE_DI) == 0) {
9257a6
+		if (gfs2_check_meta(tbh->b_data, GFS2_METATYPE_DI) == 0) {
9257a6
 			dinodes++;
9257a6
 			new_state = GFS2_BLKST_DINODE;
9257a6
 		} else {
9257a6
@@ -2350,7 +2350,7 @@ static void rg_repair(void)
9257a6
 
9257a6
 			printf("Bitmap #%d:", b);
9257a6
 			rbh = bread(&sbd, rgd->ri.ri_addr + b);
9257a6
-			if (gfs2_check_meta(rbh, mtype)) { /* wrong type */
9257a6
+			if (gfs2_check_meta(rbh->b_data, mtype)) { /* wrong type */
9257a6
 				printf("Damaged. Repairing...");
9257a6
 				/* Fix the meta header */
9257a6
 				memset(rbh->b_data, 0, sbd.bsize);
9257a6
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
9257a6
index 04f67fc7..1065e407 100644
9257a6
--- a/gfs2/edit/savemeta.c
9257a6
+++ b/gfs2/edit/savemeta.c
9257a6
@@ -567,7 +567,7 @@ static int save_leaf_chain(struct metafd *mfd, struct gfs2_sbd *sdp, uint64_t bl
9257a6
 			return 1;
9257a6
 		}
9257a6
 		warm_fuzzy_stuff(blk, FALSE);
9257a6
-		if (gfs2_check_meta(bh, GFS2_METATYPE_LF) == 0) {
9257a6
+		if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_LF) == 0) {
9257a6
 			int ret = save_bh(mfd, bh, blk, NULL);
9257a6
 			if (ret != 0) {
9257a6
 				brelse(bh);
9257a6
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
9257a6
index 17b2a3ab..3acbb5d7 100644
9257a6
--- a/gfs2/fsck/fs_recovery.c
9257a6
+++ b/gfs2/fsck/fs_recovery.c
9257a6
@@ -211,7 +211,7 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
9257a6
 			return error;
9257a6
 
9257a6
 		if (!first) {
9257a6
-			if (gfs2_check_meta(bh, GFS2_METATYPE_LB))
9257a6
+			if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_LB))
9257a6
 				continue;
9257a6
 		}
9257a6
 		while (offset + sizeof(uint64_t) <= sdp->sd_sb.sb_bsize) {
9257a6
@@ -355,7 +355,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
9257a6
 			bmodified(bh);
9257a6
 			brelse(bh);
9257a6
 			return error;
9257a6
-		} else if (gfs2_check_meta(bh, GFS2_METATYPE_LD)) {
9257a6
+		} else if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_LD)) {
9257a6
 			bmodified(bh);
9257a6
 			brelse(bh);
9257a6
 			return -EIO;
9257a6
@@ -649,7 +649,7 @@ static int rangecheck_jmeta(struct gfs2_inode *ip, uint64_t block,
9257a6
 	rc = rangecheck_jblock(ip, block);
9257a6
 	if (rc == meta_is_good) {
9257a6
 		*bh = bread(ip->i_sbd, block);
9257a6
-		*is_valid = (gfs2_check_meta(*bh, GFS2_METATYPE_IN) == 0);
9257a6
+		*is_valid = (gfs2_check_meta((*bh)->b_data, GFS2_METATYPE_IN) == 0);
9257a6
 		if (!(*is_valid)) {
9257a6
 			log_err( _("Journal at block %lld (0x%llx) has a bad "
9257a6
 				   "indirect block pointer %lld (0x%llx) "
9257a6
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
9257a6
index 4e323ffa..5720c095 100644
9257a6
--- a/gfs2/fsck/initialize.c
9257a6
+++ b/gfs2/fsck/initialize.c
9257a6
@@ -243,7 +243,7 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
9257a6
 				if (state == GFS2_BLKST_DINODE) {
9257a6
 					if (sdp->gfs1) {
9257a6
 						bh = bread(sdp, diblock);
9257a6
-						if (!gfs2_check_meta(bh,
9257a6
+						if (!gfs2_check_meta(bh->b_data,
9257a6
 							GFS2_METATYPE_DI))
9257a6
 							rg_useddi++;
9257a6
 						else
9257a6
@@ -298,7 +298,7 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
9257a6
 					 (unsigned long long)diblock,
9257a6
 					 (unsigned long long)diblock);
9257a6
 				bh = bread(sdp, diblock);
9257a6
-				if (!gfs2_check_meta(bh, GFS2_METATYPE_DI)) {
9257a6
+				if (!gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI)) {
9257a6
 					struct gfs2_inode *ip =
9257a6
 						fsck_inode_get(sdp, rgd, bh);
9257a6
 					if (ip->i_di.di_blocks > 1) {
9257a6
@@ -1169,7 +1169,7 @@ static int peruse_metadata(struct gfs2_sbd *sdp, uint64_t startblock)
9257a6
 	/* Max RG size is 2GB. 2G / bsize. */
9257a6
 	for (blk = startblock; blk < startblock + max_rg_size; blk++) {
9257a6
 		bh = bread(sdp, blk);
9257a6
-		if (gfs2_check_meta(bh, GFS2_METATYPE_DI)) {
9257a6
+		if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI)) {
9257a6
 			brelse(bh);
9257a6
 			continue;
9257a6
 		}
9257a6
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
9257a6
index a334180f..4d6a2d2c 100644
9257a6
--- a/gfs2/fsck/metawalk.c
9257a6
+++ b/gfs2/fsck/metawalk.c
9257a6
@@ -559,7 +559,7 @@ int check_leaf(struct gfs2_inode *ip, int lindex, struct metawalk_fxns *pass,
9257a6
 	/* Try to read in the leaf block. */
9257a6
 	lbh = bread(sdp, *leaf_no);
9257a6
 	/* Make sure it's really a valid leaf block. */
9257a6
-	if (gfs2_check_meta(lbh, GFS2_METATYPE_LF)) {
9257a6
+	if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF)) {
9257a6
 		msg = _("that is not really a leaf");
9257a6
 		goto bad_leaf;
9257a6
 	}
9257a6
@@ -768,7 +768,7 @@ int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
9257a6
 		if (valid_block_ip(ip, leaf_no)) {
9257a6
 			lbh = bread(sdp, leaf_no);
9257a6
 			/* Make sure it's really a valid leaf block. */
9257a6
-			if (gfs2_check_meta(lbh, GFS2_METATYPE_LF) == 0) {
9257a6
+			if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF) == 0) {
9257a6
 				brelse(lbh);
9257a6
 				first_ok_leaf = leaf_no;
9257a6
 				break;
9257a6
@@ -1268,7 +1268,7 @@ static int build_and_check_metalist(struct gfs2_inode *ip, osi_list_t *mlp,
9257a6
 		for (tmp = prev_list->next; tmp != prev_list; tmp = tmp->next){
9257a6
 			bh = osi_list_entry(tmp, struct gfs2_buffer_head,
9257a6
 					    b_altlist);
9257a6
-			if (gfs2_check_meta(bh, iblk_type)) {
9257a6
+			if (gfs2_check_meta(bh->b_data, iblk_type)) {
9257a6
 				if (pass->invalid_meta_is_fatal)
9257a6
 					return meta_error;
9257a6
 
9257a6
@@ -1513,7 +1513,7 @@ static int undo_check_data(struct gfs2_inode *ip, struct metawalk_fxns *pass,
9257a6
 static int hdr_size(struct gfs2_buffer_head *bh, int height)
9257a6
 {
9257a6
 	if (height > 1) {
9257a6
-		if (gfs2_check_meta(bh, GFS2_METATYPE_IN))
9257a6
+		if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_IN))
9257a6
 			return 0;
9257a6
 		if (bh->sdp->gfs1)
9257a6
 			return sizeof(struct gfs_indirect);
9257a6
@@ -1521,7 +1521,7 @@ static int hdr_size(struct gfs2_buffer_head *bh, int height)
9257a6
 			return sizeof(struct gfs2_meta_header);
9257a6
 	}
9257a6
 	/* if this isn't really a dinode, skip it */
9257a6
-	if (gfs2_check_meta(bh, GFS2_METATYPE_DI))
9257a6
+	if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI))
9257a6
 		return 0;
9257a6
 
9257a6
 	return sizeof(struct gfs2_dinode);
9257a6
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
9257a6
index c7de3e39..0b59971d 100644
9257a6
--- a/gfs2/fsck/pass1.c
9257a6
+++ b/gfs2/fsck/pass1.c
9257a6
@@ -393,7 +393,7 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block,
9257a6
 	}
9257a6
 	nbh = bread(ip->i_sbd, block);
9257a6
 
9257a6
-	*is_valid = (gfs2_check_meta(nbh, iblk_type) == 0);
9257a6
+	*is_valid = (gfs2_check_meta(nbh->b_data, iblk_type) == 0);
9257a6
 
9257a6
 	if (!(*is_valid)) {
9257a6
 		log_err( _("Inode %lld (0x%llx) has a bad indirect block "
9257a6
@@ -519,7 +519,7 @@ static int blockmap_set_as_data(struct gfs2_inode *ip, uint64_t block)
9257a6
 	/* The bitmap says it's a dinode, but a block reference begs to differ.
9257a6
 	   So which is it? */
9257a6
 	bh = bread(ip->i_sbd, block);
9257a6
-	if (gfs2_check_meta(bh, GFS2_METATYPE_DI) != 0)
9257a6
+	if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI) != 0)
9257a6
 		goto out;
9257a6
 
9257a6
 	/* The meta header agrees it's a dinode. But it might be data in
9257a6
@@ -747,7 +747,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
9257a6
 	   handling sort it out.  If it isn't, clear it but don't
9257a6
 	   count it as a duplicate. */
9257a6
 	*bh = bread(sdp, indirect);
9257a6
-	if (gfs2_check_meta(*bh, GFS2_METATYPE_IN)) {
9257a6
+	if (gfs2_check_meta((*bh)->b_data, GFS2_METATYPE_IN)) {
9257a6
 		bc->ea_count++;
9257a6
 		if (q != GFS2_BLKST_FREE) { /* Duplicate? */
9257a6
 			add_duplicate_ref(ip, indirect, ref_as_ea, 0,
9257a6
@@ -829,7 +829,7 @@ static int check_ealeaf_block(struct gfs2_inode *ip, uint64_t block, int btype,
9257a6
 	   really is an EA.  If it is, let duplicate handling sort it out.
9257a6
 	   If it isn't, clear it but don't count it as a duplicate. */
9257a6
 	leaf_bh = bread(sdp, block);
9257a6
-	if (gfs2_check_meta(leaf_bh, btype)) {
9257a6
+	if (gfs2_check_meta(leaf_bh->b_data, btype)) {
9257a6
 		bc->ea_count++;
9257a6
 		if (q != GFS2_BLKST_FREE) { /* Duplicate? */
9257a6
 			add_duplicate_ref(ip, block, ref_as_ea, 0,
9257a6
@@ -1666,7 +1666,7 @@ static int check_system_inode(struct gfs2_sbd *sdp,
9257a6
 			 " (0x%llx)\n"), filename,
9257a6
 			 (unsigned long long)iblock,
9257a6
 			 (unsigned long long)iblock);
9257a6
-		if (gfs2_check_meta((*sysinode)->i_bh, GFS2_METATYPE_DI)) {
9257a6
+		if (gfs2_check_meta((*sysinode)->i_bh->b_data, GFS2_METATYPE_DI)) {
9257a6
 			log_err( _("Found invalid system dinode at block #"
9257a6
 				   "%llu (0x%llx)\n"),
9257a6
 				 (unsigned long long)iblock,
9257a6
@@ -1935,7 +1935,7 @@ static int pass1_process_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd, uin
9257a6
 		bh = bread(sdp, block);
9257a6
 
9257a6
 		is_inode = 0;
9257a6
-		if (gfs2_check_meta(bh, GFS2_METATYPE_DI) == 0)
9257a6
+		if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI) == 0)
9257a6
 			is_inode = 1;
9257a6
 
9257a6
 		check_magic = ((struct gfs2_meta_header *)
9257a6
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
9257a6
index abc2b960..d10b9089 100644
9257a6
--- a/gfs2/fsck/pass2.c
9257a6
+++ b/gfs2/fsck/pass2.c
9257a6
@@ -651,7 +651,7 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
9257a6
 		struct gfs2_buffer_head *tbh;
9257a6
 
9257a6
 		tbh = bread(sdp, entry->no_addr);
9257a6
-		if (gfs2_check_meta(tbh, GFS2_METATYPE_DI)) { /* not dinode */
9257a6
+		if (gfs2_check_meta(tbh->b_data, GFS2_METATYPE_DI)) { /* not dinode */
9257a6
 			log_err( _("Directory entry '%s' pointing to block "
9257a6
 				   "%llu (0x%llx) in directory %llu (0x%llx) "
9257a6
 				   "is not really a GFS1 dinode.\n"), tmp_name,
9257a6
@@ -1600,7 +1600,7 @@ static int check_hash_tbl_dups(struct gfs2_inode *ip, uint64_t *tbl,
9257a6
 			continue;
9257a6
 
9257a6
 		lbh = bread(ip->i_sbd, leafblk);
9257a6
-		if (gfs2_check_meta(lbh, GFS2_METATYPE_LF)) { /* Chked later */
9257a6
+		if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF)) { /* Chked later */
9257a6
 			brelse(lbh);
9257a6
 			continue;
9257a6
 		}
9257a6
@@ -1794,7 +1794,7 @@ static int check_hash_tbl(struct gfs2_inode *ip, uint64_t *tbl,
9257a6
 				proper_len, proper_len);
9257a6
 			lbh = bread(ip->i_sbd, leafblk);
9257a6
 			gfs2_leaf_in(&leaf, lbh);
9257a6
-			if (gfs2_check_meta(lbh, GFS2_METATYPE_LF) ||
9257a6
+			if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF) ||
9257a6
 			    leaf.lf_depth > ip->i_di.di_depth)
9257a6
 				leaf.lf_depth = factor;
9257a6
 			brelse(lbh);
9257a6
@@ -1895,7 +1895,7 @@ static int check_data_qc(struct gfs2_inode *ip, uint64_t metablock,
9257a6
 		return -1;
9257a6
 
9257a6
 	bh = bread(ip->i_sbd, block);
9257a6
-	if (gfs2_check_meta(bh, GFS2_METATYPE_QC) != 0) {
9257a6
+	if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_QC) != 0) {
9257a6
 		log_crit(_("Error: quota_change block at %lld (0x%llx) is "
9257a6
 			   "the wrong metadata type.\n"),
9257a6
 			 (unsigned long long)block, (unsigned long long)block);
9257a6
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
9257a6
index 554f39f9..6693daa5 100644
9257a6
--- a/gfs2/fsck/pass5.c
9257a6
+++ b/gfs2/fsck/pass5.c
9257a6
@@ -49,7 +49,7 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
9257a6
 			struct gfs2_buffer_head *bh;
9257a6
 
9257a6
 			bh = bread(sdp, block);
9257a6
-			if (gfs2_check_meta(bh, GFS2_METATYPE_DI) == 0)
9257a6
+			if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI) == 0)
9257a6
 				count[GFS2_BLKST_DINODE]++;
9257a6
 			else
9257a6
 				count[GFS1_BLKST_USEDMETA]++;
9257a6
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
9257a6
index f397db1c..9a914615 100644
9257a6
--- a/gfs2/fsck/rgrepair.c
9257a6
+++ b/gfs2/fsck/rgrepair.c
9257a6
@@ -71,7 +71,7 @@ static void find_journaled_rgs(struct gfs2_sbd *sdp)
9257a6
 			if (!dblock)
9257a6
 				break;
9257a6
 			bh = bread(sdp, dblock);
9257a6
-			if (!gfs2_check_meta(bh, GFS2_METATYPE_RG)) {
9257a6
+			if (!gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG)) {
9257a6
 				/* False rgrp found at block dblock */
9257a6
 				false_count++;
9257a6
 				gfs2_special_set(&false_rgrps, dblock);
9257a6
@@ -128,7 +128,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
9257a6
 			is_rgrp = 0;
9257a6
 		else {
9257a6
 			bh = bread(sdp, blk);
9257a6
-			is_rgrp = (gfs2_check_meta(bh, GFS2_METATYPE_RG) == 0);
9257a6
+			is_rgrp = (gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG) == 0);
9257a6
 			brelse(bh);
9257a6
 		}
9257a6
 		if (!is_rgrp) {
9257a6
@@ -146,7 +146,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
9257a6
 					is_rgrp = 0;
9257a6
 				} else {
9257a6
 					bh = bread(sdp, nblk);
9257a6
-					is_rgrp = (((gfs2_check_meta(bh,
9257a6
+					is_rgrp = (((gfs2_check_meta(bh->b_data,
9257a6
 						GFS2_METATYPE_RG) == 0)));
9257a6
 					brelse(bh);
9257a6
 				}
9257a6
@@ -562,7 +562,7 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs,
9257a6
 	while (blk <= sdp->device.length) {
9257a6
 		log_debug( _("Block 0x%llx\n"), (unsigned long long)blk);
9257a6
 		bh = bread(sdp, blk);
9257a6
-		rg_was_fnd = (!gfs2_check_meta(bh, GFS2_METATYPE_RG));
9257a6
+		rg_was_fnd = (!gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG));
9257a6
 		brelse(bh);
9257a6
 		/* Allocate a new RG and index. */
9257a6
 		calc_rgd = rgrp_insert(&sdp->rgcalc, blk);
9257a6
@@ -594,7 +594,7 @@ static int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs,
9257a6
 		for (fwd_block = blk + 1; fwd_block < sdp->device.length; fwd_block++) {
9257a6
 			int bitmap_was_fnd;
9257a6
 			bh = bread(sdp, fwd_block);
9257a6
-			bitmap_was_fnd = !gfs2_check_meta(bh, GFS2_METATYPE_RB);
9257a6
+			bitmap_was_fnd = !gfs2_check_meta(bh->b_data, GFS2_METATYPE_RB);
9257a6
 			brelse(bh);
9257a6
 			if (bitmap_was_fnd) /* if a bitmap */
9257a6
 				calc_rgd->ri.ri_length++;
9257a6
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
9257a6
index 3acfb67f..f796c763 100644
9257a6
--- a/gfs2/libgfs2/fs_ops.c
9257a6
+++ b/gfs2/libgfs2/fs_ops.c
9257a6
@@ -883,7 +883,7 @@ void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
9257a6
 	uint16_t cur_rec_len, prev_rec_len;
9257a6
 
9257a6
 	bmodified(bh);
9257a6
-	if (gfs2_check_meta(bh, GFS2_METATYPE_LF) == 0) {
9257a6
+	if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_LF) == 0) {
9257a6
 		struct gfs2_leaf *lf = (struct gfs2_leaf *)bh->b_data;
9257a6
 
9257a6
 		lf->lf_entries = be16_to_cpu(lf->lf_entries) - 1;
9257a6
@@ -1102,7 +1102,7 @@ int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
9257a6
 	int error = 0;
9257a6
 
9257a6
 	*bhp = bread(dip->i_sbd, leaf_no);
9257a6
-	error = gfs2_check_meta(*bhp, GFS2_METATYPE_LF);
9257a6
+	error = gfs2_check_meta((*bhp)->b_data, GFS2_METATYPE_LF);
9257a6
 	if(error)
9257a6
 		brelse(*bhp);
9257a6
 	return error;
9257a6
@@ -1154,7 +1154,7 @@ static int get_next_leaf(struct gfs2_inode *dip,struct gfs2_buffer_head *bh_in,
9257a6
 	if (*bh_out == NULL)
9257a6
 		return -ENOENT;
9257a6
 	/* Check for a leaf pointing to a non-leaf */
9257a6
-	if (gfs2_check_meta(*bh_out, GFS2_METATYPE_LF)) {
9257a6
+	if (gfs2_check_meta((*bh_out)->b_data, GFS2_METATYPE_LF)) {
9257a6
 		brelse(*bh_out);
9257a6
 		*bh_out = NULL;
9257a6
 		return -ENOENT;
9257a6
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
9257a6
index 570c89b9..228ecebd 100644
9257a6
--- a/gfs2/libgfs2/libgfs2.h
9257a6
+++ b/gfs2/libgfs2/libgfs2.h
9257a6
@@ -696,7 +696,7 @@ extern int build_quota(struct gfs2_sbd *sdp);
9257a6
 extern int build_root(struct gfs2_sbd *sdp);
9257a6
 extern int do_init_inum(struct gfs2_sbd *sdp);
9257a6
 extern int do_init_statfs(struct gfs2_sbd *sdp);
9257a6
-extern int gfs2_check_meta(struct gfs2_buffer_head *bh, int type);
9257a6
+extern int gfs2_check_meta(const char *buf, int type);
9257a6
 extern unsigned lgfs2_bm_scan(struct rgrp_tree *rgd, unsigned idx,
9257a6
 			      uint64_t *buf, uint8_t state);
9257a6
 extern int build_inum_range(struct gfs2_inode *per_node, unsigned int j);
9257a6
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
9257a6
index bb0776aa..0040d6dc 100644
9257a6
--- a/gfs2/libgfs2/rgrp.c
9257a6
+++ b/gfs2/libgfs2/rgrp.c
9257a6
@@ -184,7 +184,7 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
9257a6
 		int mtype = (x ? GFS2_METATYPE_RB : GFS2_METATYPE_RG);
9257a6
 
9257a6
 		bi->bi_bh = bhs[x];
9257a6
-		if (gfs2_check_meta(bi->bi_bh, mtype)) {
9257a6
+		if (gfs2_check_meta(bi->bi_bh->b_data, mtype)) {
9257a6
 			unsigned err = x;
9257a6
 			do {
9257a6
 				brelse(rgd->bits[x].bi_bh);
9257a6
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
9257a6
index 1cc88b50..208aa5dd 100644
9257a6
--- a/gfs2/libgfs2/structures.c
9257a6
+++ b/gfs2/libgfs2/structures.c
9257a6
@@ -593,10 +593,10 @@ int do_init_statfs(struct gfs2_sbd *sdp)
9257a6
 	return 0;
9257a6
 }
9257a6
 
9257a6
-int gfs2_check_meta(struct gfs2_buffer_head *bh, int type)
9257a6
+int gfs2_check_meta(const char *buf, int type)
9257a6
 {
9257a6
-	uint32_t check_magic = ((struct gfs2_meta_header *)(bh->b_data))->mh_magic;
9257a6
-	uint32_t check_type = ((struct gfs2_meta_header *)(bh->b_data))->mh_type;
9257a6
+	uint32_t check_magic = ((struct gfs2_meta_header *)buf)->mh_magic;
9257a6
+	uint32_t check_type = ((struct gfs2_meta_header *)buf)->mh_type;
9257a6
 
9257a6
 	check_magic = be32_to_cpu(check_magic);
9257a6
 	check_type = be32_to_cpu(check_type);
9257a6
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
9257a6
index cc9679f5..51657543 100644
9257a6
--- a/gfs2/libgfs2/super.c
9257a6
+++ b/gfs2/libgfs2/super.c
9257a6
@@ -182,7 +182,7 @@ static int good_on_disk(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
9257a6
 	int is_rgrp;
9257a6
 
9257a6
 	bh = bread(sdp, rgd->ri.ri_addr);
9257a6
-	is_rgrp = (gfs2_check_meta(bh, GFS2_METATYPE_RG) == 0);
9257a6
+	is_rgrp = (gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG) == 0);
9257a6
 	brelse(bh);
9257a6
 	return is_rgrp;
9257a6
 }