Skip to contentSkip to conversation

libgfs2: Namespace improvements

PATCH New Andrew Price 1 participant 22 messages Jan 19, 2022

lore
Share & tools
lore
#0 lore raw

cover libgfs2: Namespace improvements

In libgfs2 we have a mix of function names prefixed with gfs2_, lgfs2_ or nothing at all that denotes where they are defined. This patch set addresses that problem by more strictly enforcing a prefix namespace scheme on the symbols exposed by libgfs2. So now we (mostly) have these prefix conventions:

GFS2_/gfs2_ - kernel code
LGFS2_/lgfs2_ - libgfs2 interfaces
No prefix - application/internal code

This means we can tell at a glance where names are defined, which makes the code easier to work with.

Some changes that were not made in this set are:

- gfs(1) on-disk structures defined in libgfs2.h for compatibility were not renamed as they're essentially kernel-defined.
- The endianness conversion macros (be64_to_cpu(), etc.) were not renamed but they will likely be renamed once a concise naming scheme has been decided upon.

This is obviously a large amount of churn but it pays off a lot of technical debt and I think it's worth getting it out of the way in one go. Many of the changes were scripted but each patch was reviewed by eye and tested with 'make check'.

Andrew Price (21):
libgfs2: Namespace improvements - structures.c
libgfs2: Namespace improvements - buf.c
libgfs2: Namespace improvements - fs_ops.c
libgfs2: Namespace improvements - fs_bits.c
libgfs2: Namespace improvements - gfs1.c
libgfs2: Namespace improvements - misc.c
libgfs2: Namespace improvements - rgrp.c
libgfs2: Namespace improvements - super.c
libgfs2: Namespace improvements - gfs2_disk_hash.c
libgfs2: Remove revoke function declarations from libgfs2.h
libgfs2: Namespace improvements - recovery.c
libgfs2: Namespace improvements - device_geometry.c
libgfs2: Namespace improvements - struct gfs2_inode
libgfs2: Namespace improvements - struct gfs2_buffer_head
libgfs2: Namespace improvements - struct gfs2_sbd
libgfs2: Namespace improvements - struct metapath
libgfs2: Namespace improvements - struct master_dir
libgfs2: Namespace improvements - struct device
libgfs2: Namespace improvements - struct gfs2_bitmap
libgfs2: Namespace improvements - constants
libgfs2: Namespace improvements - struct rgrp_tree

 gfs2/convert/gfs2_convert.c    | 398 +++++++++++------------
 gfs2/edit/extended.c           |  72 ++---
 gfs2/edit/gfs2hex.c            |   8 +-
 gfs2/edit/hexedit.c            | 198 ++++++------
 gfs2/edit/hexedit.h            |   6 +-
 gfs2/edit/journal.c            |  84 ++---
 gfs2/edit/savemeta.c           |  32 +-
 gfs2/fsck/afterpass1_common.c  |  54 ++--
 gfs2/fsck/afterpass1_common.h  |  26 +-
 gfs2/fsck/fs_recovery.c        | 206 ++++++------
 gfs2/fsck/fs_recovery.h        |  10 +-
 gfs2/fsck/fsck.h               |  46 +--
 gfs2/fsck/initialize.c         | 278 ++++++++--------
 gfs2/fsck/link.c               |   6 +-
 gfs2/fsck/link.h               |   4 +-
 gfs2/fsck/lost_n_found.c       |  34 +-
 gfs2/fsck/lost_n_found.h       |   4 +-
 gfs2/fsck/main.c               |  38 +--
 gfs2/fsck/metawalk.c           | 178 +++++------
 gfs2/fsck/metawalk.h           |  70 ++---
 gfs2/fsck/pass1.c              | 356 ++++++++++-----------
 gfs2/fsck/pass1b.c             | 118 +++----
 gfs2/fsck/pass2.c              | 278 ++++++++--------
 gfs2/fsck/pass3.c              |  14 +-
 gfs2/fsck/pass4.c              |  24 +-
 gfs2/fsck/pass5.c              |  28 +-
 gfs2/fsck/rgrepair.c           | 222 ++++++-------
 gfs2/fsck/util.c               |  18 +-
 gfs2/fsck/util.h               |  26 +-
 gfs2/glocktop/glocktop.c       |  18 +-
 gfs2/libgfs2/buf.c             |  28 +-
 gfs2/libgfs2/check_ondisk.c    |   6 +-
 gfs2/libgfs2/check_rgrp.c      |   8 +-
 gfs2/libgfs2/device_geometry.c |   4 +-
 gfs2/libgfs2/fs_bits.c         |  32 +-
 gfs2/libgfs2/fs_ops.c          | 557 ++++++++++++++++-----------------
 gfs2/libgfs2/gfs1.c            |  82 ++---
 gfs2/libgfs2/gfs2_disk_hash.c  |   5 +-
 gfs2/libgfs2/gfs2l.c           |  20 +-
 gfs2/libgfs2/lang.c            |  40 +--
 gfs2/libgfs2/lang.h            |   2 +-
 gfs2/libgfs2/libgfs2.h         | 319 +++++++++----------
 gfs2/libgfs2/misc.c            |   8 +-
 gfs2/libgfs2/ondisk.c          |   8 +-
 gfs2/libgfs2/recovery.c        |  38 +--
 gfs2/libgfs2/rgrp.c            |  88 +++---
 gfs2/libgfs2/rgrp.h            |   4 +-
 gfs2/libgfs2/structures.c      | 168 +++++-----
 gfs2/libgfs2/super.c           |  48 +--
 gfs2/mkfs/main_grow.c          |  32 +-
 gfs2/mkfs/main_jadd.c          |  24 +-
 gfs2/mkfs/main_mkfs.c          | 104 +++---
 gfs2/tune/super.c              |   6 +-
 tests/nukerg.c                 |  22 +-
 54 files changed, 2243 insertions(+), 2264 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/21 libgfs2: Namespace improvements - structures.c

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/convert/gfs2_convert.c | 28 ++++++++++----------
 gfs2/edit/hexedit.c         |  6 ++---
 gfs2/edit/savemeta.c        |  2 +-
 gfs2/fsck/fs_recovery.c     | 10 +++----
 gfs2/fsck/initialize.c      | 24 ++++++++---------
 gfs2/fsck/main.c            |  2 +-
 gfs2/fsck/metawalk.c        |  8 +++---
 gfs2/fsck/pass1.c           | 52 ++++++++++++++++++-------------------
 gfs2/fsck/pass2.c           | 30 ++++++++++-----------
 gfs2/fsck/pass5.c           |  2 +-
 gfs2/fsck/rgrepair.c        | 10 +++----
 gfs2/libgfs2/fs_ops.c       |  6 ++---
 gfs2/libgfs2/libgfs2.h      | 33 ++++++++++++-----------
 gfs2/libgfs2/rgrp.c         |  2 +-
 gfs2/libgfs2/structures.c   | 40 ++++++++++++++--------------
 gfs2/libgfs2/super.c        |  2 +-
 gfs2/mkfs/main_mkfs.c       | 22 ++++++++--------
 17 files changed, 139 insertions(+), 140 deletions(-)
gfs2/convert/gfs2_convert.c +14 -14
index dc011d05..07fa9a10 100644
@@ -817,7 +817,7 @@ static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct g
 
 	/* Read in the i_eattr block */
 	eabh = bread(sbp, ip->i_eattr);
-        if (!gfs2_check_meta(eabh->b_data, GFS_METATYPE_IN)) {/* if it is an indirect block */
+        if (!lgfs2_check_meta(eabh->b_data, GFS_METATYPE_IN)) {/* if it is an indirect block */
 		len = sbp->sd_bsize - sizeof(struct gfs_indirect);
 		buf = malloc(len);
 		if (!buf) {
@@ -993,7 +993,7 @@ static int next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 			return -1;
 		bh = bread(sdp, *block);
 		first = 0;
-	} while(gfs2_check_meta(bh->b_data, type));
+	} while(lgfs2_check_meta(bh->b_data, type));
 	brelse(bh);
 	return 0;
 }
@@ -1052,7 +1052,7 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 				sbp->sd_root_dir.in_formal_ino = sbp->md.next_inum;
 			}
 			bh = bread(sbp, block);
-			if (!gfs2_check_meta(bh->b_data, GFS_METATYPE_DI)) {/* if it is an dinode */
+			if (!lgfs2_check_meta(bh->b_data, GFS_METATYPE_DI)) {/* if it is an dinode */
 				/* Skip the rindex and jindex inodes for now. */
 				if (block != rindex_addr && block != jindex_addr) {
 					error = adjust_inode(sbp, bh);
@@ -1982,8 +1982,8 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
 		sprintf(name, "journal%u", j);
 		sdp->md.journal[j] = createi(sdp->md.jiinode, name, S_IFREG |
 					     0600, GFS2_DIF_SYSTEM);
-		write_journal(sdp->md.journal[j], sdp->sd_bsize,
-			      sdp->jsize << 20 >> sdp->sd_bsize_shift);
+		lgfs2_write_journal(sdp->md.journal[j], sdp->sd_bsize,
+		                    sdp->jsize << 20 >> sdp->sd_bsize_shift);
 		inode_put(&sdp->md.journal[j]);
 		printf(_("done.\n"));
 		fflush(stdout);
@@ -2100,7 +2100,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
 	for (j = 0; j < sdp->md.journals; j++) {
 		struct gfs2_inode *ip;
 
-		ip = build_inum_range(per_node, j);
+		ip = lgfs2_build_inum_range(per_node, j);
 		if (ip == NULL) {
 			log_crit(_("Error building '%s': %s\n"), "inum_range",
 			         strerror(errno));
@@ -2108,7 +2108,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
 		}
 		inode_put(&ip);
 
-		ip = build_statfs_change(per_node, j);
+		ip = lgfs2_build_statfs_change(per_node, j);
 		if (ip == NULL) {
 			log_crit(_("Error building '%s': %s\n"), "statfs_change",
 			         strerror(errno));
@@ -2116,7 +2116,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
 		}
 		inode_put(&ip);
 
-		ip = build_quota_change(per_node, j);
+		ip = lgfs2_build_quota_change(per_node, j);
 		if (ip == NULL) {
 			log_crit(_("Error building '%s': %s\n"), "quota_change",
 			         strerror(errno));
@@ -2314,7 +2314,7 @@ int main(int argc, char **argv)
 			log_notice(_("Reduced journal size to %u MB to accommodate "
 				   "GFS2 file system structures.\n"), sb2.jsize);
 		/* Build the master subdirectory. */
-		build_master(&sb2); /* Does not do inode_put */
+		lgfs2_build_master(&sb2); /* Does not do inode_put */
 		sb2.sd_meta_dir = sb2.master_dir->i_num;
 		/* Build empty journal index file. */
 		error = conv_build_jindex(&sb2);
@@ -2331,23 +2331,23 @@ int main(int argc, char **argv)
 			exit(-1);
 		}
 		/* Create the empty inode number file */
-		sb2.md.inum = build_inum(&sb2); /* Does not do inode_put */
+		sb2.md.inum = lgfs2_build_inum(&sb2); /* Does not do inode_put */
 		if (sb2.md.inum == NULL) {
 			log_crit(_("Error building inum inode: %s\n"),
 			         strerror(error));
 			exit(-1);
 		}
 		/* Create the statfs file */
-		sb2.md.statfs = build_statfs(&sb2); /* Does not do inode_put */
+		sb2.md.statfs = lgfs2_build_statfs(&sb2); /* Does not do inode_put */
 		if (sb2.md.statfs == NULL) {
 			log_crit(_("Error building statfs inode: %s\n"),
 			         strerror(error));
 			exit(-1);
 		}
-		do_init_statfs(&sb2, NULL);
+		lgfs2_init_statfs(&sb2, NULL);
 
 		/* Create the resource group index file */
-		ip = build_rindex(&sb2);
+		ip = lgfs2_build_rindex(&sb2);
 		if (ip == NULL) {
 			log_crit(_("Error building rindex inode: %s\n"),
 			         strerror(errno));
@@ -2355,7 +2355,7 @@ int main(int argc, char **argv)
 		}
 		inode_put(&ip);
 		/* Create the quota file */
-		ip = build_quota(&sb2);
+		ip = lgfs2_build_quota(&sb2);
 		if (ip == NULL) {
 			log_crit(_("Error building quota inode: %s\n"),
 			         strerror(error));
gfs2/edit/hexedit.c +3 -3
index 051f88c1..0809db85 100644
@@ -1173,7 +1173,7 @@ static int find_rg_metatype(struct rgrp_tree *rgd, uint64_t *blk, uint64_t start
 		for (j = 0; j < m; j++) {
 			*blk = ibuf[j];
 			bhp = bread(&sbd, *blk);
-			found = (*blk > startblk) && !gfs2_check_meta(bhp->b_data, mtype);
+			found = (*blk > startblk) && !lgfs2_check_meta(bhp->b_data, mtype);
 			brelse(bhp);
 			if (found) {
 				free(ibuf);
@@ -2135,7 +2135,7 @@ static int count_dinode_blks(struct rgrp_tree *rgd, int bitmap,
 			    rgd->bits[bitmap].bi_start + b);
 		byte = rbh->b_data + off + (b / GFS2_NBBY);
 		bit = (b % GFS2_NBBY) * GFS2_BIT_SIZE;
-		if (gfs2_check_meta(tbh->b_data, GFS2_METATYPE_DI) == 0) {
+		if (lgfs2_check_meta(tbh->b_data, GFS2_METATYPE_DI) == 0) {
 			dinodes++;
 			new_state = GFS2_BLKST_DINODE;
 		} else {
@@ -2205,7 +2205,7 @@ static void rg_repair(void)
 
 			printf("Bitmap #%d:", b);
 			rbh = bread(&sbd, rgd->rt_addr + b);
-			if (gfs2_check_meta(rbh->b_data, mtype)) { /* wrong type */
+			if (lgfs2_check_meta(rbh->b_data, mtype)) { /* wrong type */
 				printf("Damaged. Repairing...");
 				/* Fix the meta header */
 				memset(rbh->b_data, 0, sbd.sd_bsize);
gfs2/edit/savemeta.c +1 -1
index 8fde8c8a..941472aa 100644
@@ -814,7 +814,7 @@ static int save_leaf_chain(struct metafd *mfd, struct gfs2_sbd *sdp, char *buf)
 			return 1;
 		}
 		report_progress(blk, 0);
-		if (gfs2_check_meta(buf, GFS2_METATYPE_LF) == 0) {
+		if (lgfs2_check_meta(buf, GFS2_METATYPE_LF) == 0) {
 			int ret = save_buf(mfd, buf, blk, sdp->sd_bsize);
 			if (ret != 0)
 				return ret;
gfs2/fsck/fs_recovery.c +5 -5
index e5cde051..fdeb3c44 100644
@@ -206,7 +206,7 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 			return error;
 
 		if (!first) {
-			if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_LB))
+			if (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_LB))
 				continue;
 		}
 		while (offset + sizeof(uint64_t) <= sdp->sd_bsize) {
@@ -343,7 +343,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
 			bmodified(bh);
 			brelse(bh);
 			return error;
-		} else if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_LD)) {
+		} else if (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_LD)) {
 			bmodified(bh);
 			brelse(bh);
 			return -EIO;
@@ -597,7 +597,7 @@ out:
 	log_err( _("jid=%u: Failed\n"), j);
 reinit:
 	if (query( _("Do you want to clear the journal instead? (y/n)"))) {
-		error = write_journal(sdp->md.journal[j], sdp->sd_bsize,
+		error = lgfs2_write_journal(sdp->md.journal[j], sdp->sd_bsize,
 				      sdp->md.journal[j]->i_size /
 				      sdp->sd_bsize);
 		log_err(_("jid=%u: journal was cleared.\n"), j);
@@ -633,7 +633,7 @@ static int rangecheck_jmeta(struct iptr iptr, struct gfs2_buffer_head **bh, int
 	rc = rangecheck_jblock(ip, block);
 	if (rc == META_IS_GOOD) {
 		*bh = bread(ip->i_sbd, block);
-		*is_valid = (gfs2_check_meta((*bh)->b_data, GFS2_METATYPE_IN) == 0);
+		*is_valid = (lgfs2_check_meta((*bh)->b_data, GFS2_METATYPE_IN) == 0);
 		if (!(*is_valid)) {
 			log_err( _("Journal at block %"PRIu64" (0x%"PRIx64") has a bad "
 				   "indirect block pointer %"PRIu64" (0x%"PRIx64") "
@@ -859,7 +859,7 @@ int build_jindex(struct gfs2_sbd *sdp)
 	}
 	sdp->md.journal = malloc(sdp->md.journals * sizeof(struct gfs2_inode *));
 	for (unsigned j = 0; j < sdp->md.journals; j++) {
-		int ret = build_journal(sdp, j, jindex);
+		int ret = lgfs2_build_journal(sdp, j, jindex);
 		if (ret)
 			return ret;
 		inode_put(&sdp->md.journal[j]);
gfs2/fsck/initialize.c +12 -12
index fab9a1e7..7923e9c1 100644
@@ -233,7 +233,7 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 				if (state == GFS2_BLKST_DINODE) {
 					if (sdp->gfs1) {
 						bh = bread(sdp, diblock);
-						if (!gfs2_check_meta(bh->b_data,
+						if (!lgfs2_check_meta(bh->b_data,
 							GFS2_METATYPE_DI))
 							rg_useddi++;
 						else
@@ -283,7 +283,7 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 				log_info(_("Free metadata block %"PRIu64" (0x%"PRIx64") reclaimed.\n"),
 				         diblock, diblock);
 				bh = bread(sdp, diblock);
-				if (!gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI)) {
+				if (!lgfs2_check_meta(bh->b_data, GFS2_METATYPE_DI)) {
 					struct gfs2_inode *ip =
 						fsck_inode_get(sdp, rgd, bh);
 					if (ip->i_blocks > 1) {
@@ -504,7 +504,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
 			exit(FSCK_ERROR);
 		}
 	} else {
-		sdp->md.inum = build_inum(sdp);
+		sdp->md.inum = lgfs2_build_inum(sdp);
 		if (sdp->md.inum == NULL) {
 			log_crit(_("Error building inum inode: %s\n"), strerror(errno));
 			exit(FSCK_ERROR);
@@ -524,7 +524,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
 			exit(FSCK_ERROR);
 		}
 	} else {
-		sdp->md.statfs = build_statfs(sdp);
+		sdp->md.statfs = lgfs2_build_statfs(sdp);
 		if (sdp->md.statfs == NULL) {
 			log_crit(_("Error %d building statfs inode\n"), err);
 			exit(FSCK_ERROR);
@@ -544,7 +544,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
 			exit(FSCK_ERROR);
 		}
 	} else {
-		struct gfs2_inode *rip = build_rindex(sdp);
+		struct gfs2_inode *rip = lgfs2_build_rindex(sdp);
 		if (rip == NULL) {
 			log_crit(_("Error building rindex inode: %s\n"), strerror(errno));
 			exit(FSCK_ERROR);
@@ -562,7 +562,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
 			exit(FSCK_ERROR);
 		}
 	} else {
-		struct gfs2_inode *qip = build_quota(sdp);
+		struct gfs2_inode *qip = lgfs2_build_quota(sdp);
 		if (qip == NULL) {
 			log_crit(_("Error building quota inode: %s\n"), strerror(errno));
 			exit(FSCK_ERROR);
@@ -804,7 +804,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
 					   "a valid inum file; aborting.\n"));
 				goto fail;
 			}
-			sdp->md.inum = build_inum(sdp);
+			sdp->md.inum = lgfs2_build_inum(sdp);
 			if (sdp->md.inum == NULL) {
 				log_crit(_("Error rebuilding inum inode: %s\n"), strerror(errno));
 				exit(FSCK_ERROR);
@@ -855,7 +855,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
 				   "statfs file; aborting.\n"));
 			goto fail;
 		}
-		sdp->md.statfs = build_statfs(sdp);
+		sdp->md.statfs = lgfs2_build_statfs(sdp);
 		if (sdp->md.statfs == NULL) {
 			log_crit(_("Error %d rebuilding statfs inode\n"), err);
 			exit(FSCK_ERROR);
@@ -867,7 +867,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
 				   "a valid statfs file; aborting.\n"));
 			goto fail;
 		}
-		do_init_statfs(sdp, NULL);
+		lgfs2_init_statfs(sdp, NULL);
 	}
 	if (sdp->md.statfs->i_size) {
 		buf = malloc(sdp->md.statfs->i_size);
@@ -912,7 +912,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
 				   "rebuilt.  Aborting.\n"));
 			goto fail;
 		}
-		sdp->md.qinode = build_quota(sdp);
+		sdp->md.qinode = lgfs2_build_quota(sdp);
 		if (sdp->md.qinode == NULL) {
 			log_crit(_("Error rebuilding quota inode: %s\n"), strerror(errno));
 			exit(FSCK_ERROR);
@@ -1200,7 +1200,7 @@ static int peruse_metadata(struct gfs2_sbd *sdp, uint64_t startblock)
 	/* Max RG size is 2GB. 2G / bsize. */
 	for (blk = startblock; blk < startblock + max_rg_size; blk++) {
 		bh = bread(sdp, blk);
-		if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI)) {
+		if (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_DI)) {
 			brelse(bh);
 			continue;
 		}
@@ -1531,7 +1531,7 @@ static int init_rindex(struct gfs2_sbd *sdp)
 		log_crit(_("Error: Cannot proceed without a valid rindex.\n"));
 		return -1;
 	}
-	ip = build_rindex(sdp);
+	ip = lgfs2_build_rindex(sdp);
 	if (ip == NULL) {
 		log_crit(_("Error rebuilding rindex: %s\n"), strerror(errno));
 		return -1;
gfs2/fsck/main.c +1 -1
index 82408245..446f4f85 100644
@@ -217,7 +217,7 @@ static int check_statfs(struct gfs2_sbd *sdp)
 		return 0;
 	}
 
-	do_init_statfs(sdp, NULL);
+	lgfs2_init_statfs(sdp, NULL);
 	log_err( _("The statfs file was fixed.\n"));
 	errors_corrected++;
 	return 0;
gfs2/fsck/metawalk.c +4 -4
index b5e7c865..4b783648 100644
@@ -535,7 +535,7 @@ int check_leaf(struct gfs2_inode *ip, int lindex, struct metawalk_fxns *pass,
 	/* Try to read in the leaf block. */
 	lbh = bread(sdp, *leaf_no);
 	/* Make sure it's really a valid leaf block. */
-	if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF)) {
+	if (lgfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF)) {
 		msg = _("that is not really a leaf");
 		goto bad_leaf;
 	}
@@ -734,7 +734,7 @@ int check_leaf_blks(struct gfs2_inode *ip, struct metawalk_fxns *pass)
 		if (valid_block_ip(ip, leaf_no)) {
 			lbh = bread(sdp, leaf_no);
 			/* Make sure it's really a valid leaf block. */
-			if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF) == 0) {
+			if (lgfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF) == 0) {
 				brelse(lbh);
 				first_ok_leaf = leaf_no;
 				break;
@@ -1259,7 +1259,7 @@ static int build_and_check_metalist(struct gfs2_inode *ip, osi_list_t *mlp,
 			iptr.ipt_off = head_size;
 			iptr.ipt_bh = osi_list_entry(tmp, struct gfs2_buffer_head, b_altlist);
 
-			if (gfs2_check_meta(iptr_buf(iptr), iblk_type)) {
+			if (lgfs2_check_meta(iptr_buf(iptr), iblk_type)) {
 				if (pass->invalid_meta_is_fatal)
 					return META_ERROR;
 
@@ -1482,7 +1482,7 @@ static unsigned int should_check(struct gfs2_buffer_head *bh, unsigned int heigh
 {
 	int iblk_type = height > 1 ? GFS2_METATYPE_IN : GFS2_METATYPE_DI;
 
-	return gfs2_check_meta(bh->b_data, iblk_type) == 0;
+	return lgfs2_check_meta(bh->b_data, iblk_type) == 0;
 }
 
 /**
gfs2/fsck/pass1.c +26 -26

183 lines not on this page · raw message

gfs2/fsck/pass2.c +15 -15
index d82380a1..a80aae2f 100644
@@ -601,7 +601,7 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 		struct gfs2_buffer_head *tbh;
 
 		tbh = bread(sdp, entry->in_addr);
-		if (gfs2_check_meta(tbh->b_data, GFS2_METATYPE_DI)) { /* not dinode */
+		if (lgfs2_check_meta(tbh->b_data, GFS2_METATYPE_DI)) { /* not dinode */
 			log_err(_("Directory entry '%s' pointing to block %"PRIu64
 			          " (0x%"PRIx64") in directory %"PRIu64" (0x%"PRIx64") "
 				   "is not really a GFS1 dinode.\n"), tmp_name,
@@ -1502,7 +1502,7 @@ static int check_hash_tbl_dups(struct gfs2_inode *ip, __be64 *tbl,
 			continue;
 
 		lbh = bread(ip->i_sbd, leafblk);
-		if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF)) { /* Chked later */
+		if (lgfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF)) { /* Chked later */
 			brelse(lbh);
 			continue;
 		}
@@ -1686,7 +1686,7 @@ static int check_hash_tbl(struct gfs2_inode *ip, __be64 *tbl,
 				leafblk, leafblk, proper_len, proper_len);
 			lbh = bread(ip->i_sbd, leafblk);
 			lgfs2_leaf_in(&leaf, lbh->b_data);
-			if (gfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF) ||
+			if (lgfs2_check_meta(lbh->b_data, GFS2_METATYPE_LF) ||
 			    leaf.lf_depth > ip->i_depth)
 				leaf.lf_depth = factor;
 			brelse(lbh);
@@ -1787,7 +1787,7 @@ static int check_data_qc(struct gfs2_inode *ip, uint64_t metablock,
 		return -1;
 
 	bh = bread(ip->i_sbd, block);
-	if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_QC) != 0) {
+	if (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_QC) != 0) {
 		log_crit(_("Error: quota_change block at %"PRIu64" (0x%"PRIx64") is "
 			   "the wrong metadata type.\n"),
 		         block, block);
@@ -1875,9 +1875,9 @@ build_it:
 	goto out_good;
 }
 
-static int fsck_build_inum_range(struct gfs2_inode *per_node, unsigned int n)
+static int build_inum_range(struct gfs2_inode *per_node, unsigned int n)
 {
-	struct gfs2_inode *ip = build_inum_range(per_node, n);
+	struct gfs2_inode *ip = lgfs2_build_inum_range(per_node, n);
 
 	if (ip == NULL)
 		return 1;
@@ -1885,9 +1885,9 @@ static int fsck_build_inum_range(struct gfs2_inode *per_node, unsigned int n)
 	return 0;
 }
 
-static int fsck_build_statfs_change(struct gfs2_inode *per_node, unsigned int n)
+static int build_statfs_change(struct gfs2_inode *per_node, unsigned int n)
 {
-	struct gfs2_inode *ip = build_statfs_change(per_node, n);
+	struct gfs2_inode *ip = lgfs2_build_statfs_change(per_node, n);
 
 	if (ip == NULL)
 		return 1;
@@ -1895,9 +1895,9 @@ static int fsck_build_statfs_change(struct gfs2_inode *per_node, unsigned int n)
 	return 0;
 }
 
-static int fsck_build_quota_change(struct gfs2_inode *per_node, unsigned int n)
+static int build_quota_change(struct gfs2_inode *per_node, unsigned int n)
 {
-	struct gfs2_inode *ip = build_quota_change(per_node, n);
+	struct gfs2_inode *ip = lgfs2_build_quota_change(per_node, n);
 
 	if (ip == NULL)
 		return 1;
@@ -1989,14 +1989,14 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
 		for (j = 0; j < sysinode->i_sbd->md.journals; j++) {
 			sprintf(fn, "inum_range%d", j);
 			error += check_pernode_for(j, sysinode, fn, 16, 0,
-						   NULL, fsck_build_inum_range);
+						   NULL, build_inum_range);
 			sprintf(fn, "statfs_change%d", j);
 			error += check_pernode_for(j, sysinode, fn, 24, 0,
-						   NULL, fsck_build_statfs_change);
+						   NULL, build_statfs_change);
 			sprintf(fn, "quota_change%d", j);
 			error += check_pernode_for(j, sysinode, fn, 1048576, 1,
 						   &quota_change_fxns,
-						   fsck_build_quota_change);
+						   build_quota_change);
 		}
 	}
 	return error;
@@ -2130,13 +2130,13 @@ int pass2(struct gfs2_sbd *sdp)
 	if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
 		return FSCK_OK;
 	if (!sdp->gfs1 &&
-	    check_system_dir(sdp->master_dir, "master", build_master)) {
+	    check_system_dir(sdp->master_dir, "master", lgfs2_build_master)) {
 		stack;
 		return FSCK_ERROR;
 	}
 	if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
 		return FSCK_OK;
-	if (check_system_dir(sdp->md.rooti, "root", build_root)) {
+	if (check_system_dir(sdp->md.rooti, "root", lgfs2_build_root)) {
 		stack;
 		return FSCK_ERROR;
 	}
gfs2/fsck/pass5.c +1 -1
index 9730aa06..7d2e309d 100644
@@ -49,7 +49,7 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
 			struct gfs2_buffer_head *bh;
 
 			bh = bread(sdp, block);
-			if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_DI) == 0)
+			if (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_DI) == 0)
 				count[GFS2_BLKST_DINODE]++;
 			else
 				count[GFS1_BLKST_USEDMETA]++;
gfs2/fsck/rgrepair.c +5 -5
index 55e99143..b7bb8dd2 100644
@@ -68,7 +68,7 @@ static void find_journaled_rgs(struct gfs2_sbd *sdp)
 			if (!dblock)
 				break;
 			bh = bread(sdp, dblock);
-			if (!gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG)) {
+			if (!lgfs2_check_meta(bh->b_data, GFS2_METATYPE_RG)) {
 				/* False rgrp found at block dblock */
 				false_count++;
 				gfs2_special_set(&false_rgrps, dblock);
@@ -124,7 +124,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
 			is_rgrp = 0;
 		else {
 			bh = bread(sdp, blk);
-			is_rgrp = (gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG) == 0);
+			is_rgrp = (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_RG) == 0);
 			brelse(bh);
 		}
 		if (!is_rgrp) {
@@ -141,7 +141,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
 					is_rgrp = 0;
 				} else {
 					bh = bread(sdp, nblk);
-					is_rgrp = (((gfs2_check_meta(bh->b_data,
+					is_rgrp = (((lgfs2_check_meta(bh->b_data,
 						GFS2_METATYPE_RG) == 0)));
 					brelse(bh);
 				}
@@ -554,7 +554,7 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
 	while (blk <= sdp->device.length) {
 		log_debug( _("Block 0x%"PRIx64"\n"), blk);
 		bh = bread(sdp, blk);
-		rg_was_fnd = (!gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG));
+		rg_was_fnd = (!lgfs2_check_meta(bh->b_data, GFS2_METATYPE_RG));
 		brelse(bh);
 		/* Allocate a new RG and index. */
 		calc_rgd = rgrp_insert(&rgcalc, blk);
@@ -584,7 +584,7 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
 		for (fwd_block = blk + 1; fwd_block < sdp->device.length; fwd_block++) {
 			int bitmap_was_fnd;
 			bh = bread(sdp, fwd_block);
-			bitmap_was_fnd = !gfs2_check_meta(bh->b_data, GFS2_METATYPE_RB);
+			bitmap_was_fnd = !lgfs2_check_meta(bh->b_data, GFS2_METATYPE_RB);
 			brelse(bh);
 			if (bitmap_was_fnd) /* if a bitmap */
 				calc_rgd->rt_length++;
gfs2/libgfs2/fs_ops.c +3 -3
index 6b54a9fd..0b127e26 100644
@@ -854,7 +854,7 @@ void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 	uint16_t cur_rec_len, prev_rec_len;
 
 	bmodified(bh);
-	if (gfs2_check_meta(bh->b_data, GFS2_METATYPE_LF) == 0) {
+	if (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_LF) == 0) {
 		struct gfs2_leaf *lf = (struct gfs2_leaf *)bh->b_data;
 		uint16_t entries;
 
@@ -1078,7 +1078,7 @@ int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
 	int error = 0;
 
 	*bhp = bread(dip->i_sbd, leaf_no);
-	error = gfs2_check_meta((*bhp)->b_data, GFS2_METATYPE_LF);
+	error = lgfs2_check_meta((*bhp)->b_data, GFS2_METATYPE_LF);
 	if(error)
 		brelse(*bhp);
 	return error;
@@ -1130,7 +1130,7 @@ static int get_next_leaf(struct gfs2_inode *dip,struct gfs2_buffer_head *bh_in,
 	if (*bh_out == NULL)
 		return -ENOENT;
 	/* Check for a leaf pointing to a non-leaf */
-	if (gfs2_check_meta((*bh_out)->b_data, GFS2_METATYPE_LF)) {
+	if (lgfs2_check_meta((*bh_out)->b_data, GFS2_METATYPE_LF)) {
 		brelse(*bh_out);
 		*bh_out = NULL;
 		return -ENOENT;
gfs2/libgfs2/libgfs2.h +16 -17
index cf7ecf3f..6aa97053 100644
@@ -556,9 +556,6 @@ extern int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 extern void build_height(struct gfs2_inode *ip, int height);
 extern void unstuff_dinode(struct gfs2_inode *ip);
 extern unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size);
-extern int write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned blocks);
-extern int lgfs2_write_journal_data(struct gfs2_inode *ip);
-extern int lgfs2_write_filemeta(struct gfs2_inode *ip);
 extern uint32_t lgfs2_log_header_hash(char *buf);
 extern uint32_t lgfs2_log_header_crc(char *buf, unsigned bsize);
 
@@ -769,24 +766,26 @@ static inline unsigned int rgrp_size(struct rgrp_tree *rgrp)
 }
 
 /* structures.c */
-extern int build_master(struct gfs2_sbd *sdp);
+extern int lgfs2_build_master(struct gfs2_sbd *sdp);
 extern int lgfs2_sb_write(const struct gfs2_sbd *sdp, int fd);
-extern int build_journal(struct gfs2_sbd *sdp, int j,
-			 struct gfs2_inode *jindex);
+extern int lgfs2_build_journal(struct gfs2_sbd *sdp, int j, struct gfs2_inode *jindex);
+extern int lgfs2_write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned blocks);
+extern int lgfs2_write_journal_data(struct gfs2_inode *ip);
+extern int lgfs2_write_filemeta(struct gfs2_inode *ip);
 extern struct gfs2_inode *lgfs2_build_jindex(struct gfs2_inode *metafs, struct lgfs2_inum *jnls, size_t nmemb);
-extern struct gfs2_inode *build_inum(struct gfs2_sbd *sdp);
-extern struct gfs2_inode *build_statfs(struct gfs2_sbd *sdp);
-extern struct gfs2_inode *build_rindex(struct gfs2_sbd *sdp);
-extern struct gfs2_inode *build_quota(struct gfs2_sbd *sdp);
-extern int build_root(struct gfs2_sbd *sdp);
-extern int do_init_inum(struct gfs2_sbd *sdp);
-extern int do_init_statfs(struct gfs2_sbd *sdp, struct gfs2_statfs_change *res);
-extern int gfs2_check_meta(const char *buf, int type);
+extern struct gfs2_inode *lgfs2_build_inum(struct gfs2_sbd *sdp);
+extern struct gfs2_inode *lgfs2_build_statfs(struct gfs2_sbd *sdp);
+extern struct gfs2_inode *lgfs2_build_rindex(struct gfs2_sbd *sdp);
+extern struct gfs2_inode *lgfs2_build_quota(struct gfs2_sbd *sdp);
+extern int lgfs2_build_root(struct gfs2_sbd *sdp);
+extern int lgfs2_init_inum(struct gfs2_sbd *sdp);
+extern int lgfs2_init_statfs(struct gfs2_sbd *sdp, struct gfs2_statfs_change *res);
+extern int lgfs2_check_meta(const char *buf, int type);
 extern unsigned lgfs2_bm_scan(struct rgrp_tree *rgd, unsigned idx,
 			      uint64_t *buf, uint8_t state);
-extern struct gfs2_inode *build_inum_range(struct gfs2_inode *per_node, unsigned int n);
-extern struct gfs2_inode *build_statfs_change(struct gfs2_inode *per_node, unsigned int j);
-extern struct gfs2_inode *build_quota_change(struct gfs2_inode *per_node, unsigned int j);
+extern struct gfs2_inode *lgfs2_build_inum_range(struct gfs2_inode *per_node, unsigned int n);
+extern struct gfs2_inode *lgfs2_build_statfs_change(struct gfs2_inode *per_node, unsigned int j);
+extern struct gfs2_inode *lgfs2_build_quota_change(struct gfs2_inode *per_node, unsigned int j);
 
 /* super.c */
 extern int check_sb(void *sbp);
gfs2/libgfs2/rgrp.c +1 -1
index 94907c25..c6dfb228 100644
@@ -209,7 +209,7 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 		int mtype = (i ? GFS2_METATYPE_RB : GFS2_METATYPE_RG);
 
 		rgd->bits[i].bi_data = buf + (i * sdp->sd_bsize);
-		if (gfs2_check_meta(rgd->bits[i].bi_data, mtype)) {
+		if (lgfs2_check_meta(rgd->bits[i].bi_data, mtype)) {
 			free(buf);
 			rgd->bits[0].bi_data = NULL;
 			return rgd->rt_addr + i;
gfs2/libgfs2/structures.c +20 -20
index d7b7f4e1..4029df43 100644
@@ -16,7 +16,7 @@
 #include "libgfs2.h"
 #include "crc32c.h"
 
-int build_master(struct gfs2_sbd *sdp)
+int lgfs2_build_master(struct gfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
 	uint64_t bn;
@@ -151,7 +151,7 @@ int lgfs2_write_journal_data(struct gfs2_inode *ip)
 	return 0;
 }
 
-static struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn, int prealloc)
+static struct gfs2_buffer_head *lgfs2_get_file_buf(struct gfs2_inode *ip, uint64_t lbn, int prealloc)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	uint64_t dbn;
@@ -175,7 +175,7 @@ static struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn
 		return bread(sdp, dbn);
 }
 
-int write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks)
+int lgfs2_write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks)
 {
 	struct gfs2_log_header *lh;
 	uint32_t x;
@@ -189,7 +189,7 @@ int write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks)
 	build_height(jnl, height);
 
 	for (x = 0; x < blocks; x++) {
-		struct gfs2_buffer_head *bh = get_file_buf(jnl, x, 1);
+		struct gfs2_buffer_head *bh = lgfs2_get_file_buf(jnl, x, 1);
 		if (!bh)
 			return -1;
 		bmodified(bh);
@@ -197,7 +197,7 @@ int write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks)
 	}
 	crc32c_optimization_init();
 	for (x = 0; x < blocks; x++) {
-		struct gfs2_buffer_head *bh = get_file_buf(jnl, x, 0);
+		struct gfs2_buffer_head *bh = lgfs2_get_file_buf(jnl, x, 0);
 		if (!bh)
 			return -1;
 
@@ -227,7 +227,7 @@ int write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks)
 	return 0;
 }
 
-int build_journal(struct gfs2_sbd *sdp, int j, struct gfs2_inode *jindex)
+int lgfs2_build_journal(struct gfs2_sbd *sdp, int j, struct gfs2_inode *jindex)
 {
 	char name[256];
 	int ret;
@@ -238,8 +238,8 @@ int build_journal(struct gfs2_sbd *sdp, int j, struct gfs2_inode *jindex)
 	if (sdp->md.journal[j] == NULL) {
 		return errno;
 	}
-	ret = write_journal(sdp->md.journal[j], sdp->sd_bsize,
-			    sdp->jsize << 20 >> sdp->sd_bsize_shift);
+	ret = lgfs2_write_journal(sdp->md.journal[j], sdp->sd_bsize,
+	                          sdp->jsize << 20 >> sdp->sd_bsize_shift);
 	return ret;
 }
 
@@ -278,7 +278,7 @@ struct gfs2_inode *lgfs2_build_jindex(struct gfs2_inode *master, struct lgfs2_in
 	return jindex;
 }
 
-struct gfs2_inode *build_inum_range(struct gfs2_inode *per_node, unsigned int j)
+struct gfs2_inode *lgfs2_build_inum_range(struct gfs2_inode *per_node, unsigned int j)
 {
 	char name[256];
 	struct gfs2_inode *ip;
@@ -295,7 +295,7 @@ struct gfs2_inode *build_inum_range(struct gfs2_inode *per_node, unsigned int j)
 	return ip;
 }
 
-struct gfs2_inode *build_statfs_change(struct gfs2_inode *per_node, unsigned int j)
+struct gfs2_inode *lgfs2_build_statfs_change(struct gfs2_inode *per_node, unsigned int j)
 {
 	char name[256];
 	struct gfs2_inode *ip;
@@ -312,7 +312,7 @@ struct gfs2_inode *build_statfs_change(struct gfs2_inode *per_node, unsigned int
 	return ip;
 }
 
-struct gfs2_inode *build_quota_change(struct gfs2_inode *per_node, unsigned int j)
+struct gfs2_inode *lgfs2_build_quota_change(struct gfs2_inode *per_node, unsigned int j)
 {
 	struct gfs2_sbd *sdp = per_node->i_sbd;
 	struct gfs2_meta_header mh;
@@ -337,7 +337,7 @@ struct gfs2_inode *build_quota_change(struct gfs2_inode *per_node, unsigned int
 	build_height(ip, hgt);
 
 	for (x = 0; x < blocks; x++) {
-		bh = get_file_buf(ip, x, 0);
+		bh = lgfs2_get_file_buf(ip, x, 0);
 		if (!bh)
 			return NULL;
 
@@ -349,7 +349,7 @@ struct gfs2_inode *build_quota_change(struct gfs2_inode *per_node, unsigned int
 	return ip;
 }
 
-struct gfs2_inode *build_inum(struct gfs2_sbd *sdp)
+struct gfs2_inode *lgfs2_build_inum(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *ip;
 
@@ -358,7 +358,7 @@ struct gfs2_inode *build_inum(struct gfs2_sbd *sdp)
 	return ip;
 }
 
-struct gfs2_inode *build_statfs(struct gfs2_sbd *sdp)
+struct gfs2_inode *lgfs2_build_statfs(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *ip;
 
@@ -367,7 +367,7 @@ struct gfs2_inode *build_statfs(struct gfs2_sbd *sdp)
 	return ip;
 }
 
-struct gfs2_inode *build_rindex(struct gfs2_sbd *sdp)
+struct gfs2_inode *lgfs2_build_rindex(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *ip;
 	struct osi_node *n, *next = NULL;
@@ -401,7 +401,7 @@ struct gfs2_inode *build_rindex(struct gfs2_sbd *sdp)
 	return ip;
 }
 
-struct gfs2_inode *build_quota(struct gfs2_sbd *sdp)
+struct gfs2_inode *lgfs2_build_quota(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *ip;
 	struct gfs2_quota qu;
@@ -428,7 +428,7 @@ struct gfs2_inode *build_quota(struct gfs2_sbd *sdp)
 	return ip;
 }
 
-int build_root(struct gfs2_sbd *sdp)
+int lgfs2_build_root(struct gfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
 	uint64_t bn;
@@ -453,7 +453,7 @@ int build_root(struct gfs2_sbd *sdp)
 	return 0;
 }
 
-int do_init_inum(struct gfs2_sbd *sdp)
+int lgfs2_init_inum(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *ip = sdp->md.inum;
 	__be64 buf;
@@ -467,7 +467,7 @@ int do_init_inum(struct gfs2_sbd *sdp)
 	return 0;
 }
 
-int do_init_statfs(struct gfs2_sbd *sdp, struct gfs2_statfs_change *res)
+int lgfs2_init_statfs(struct gfs2_sbd *sdp, struct gfs2_statfs_change *res)
 {
 	struct gfs2_inode *ip = sdp->md.statfs;
 	struct gfs2_statfs_change sc;
@@ -486,7 +486,7 @@ int do_init_statfs(struct gfs2_sbd *sdp, struct gfs2_statfs_change *res)
 	return 0;
 }
 
-int gfs2_check_meta(const char *buf, int type)
+int lgfs2_check_meta(const char *buf, int type)
 {
 	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)buf;
 	uint32_t check_magic = be32_to_cpu(mh->mh_magic);
gfs2/libgfs2/super.c +1 -1
index c3c59e7e..8dfeee57 100644
@@ -185,7 +185,7 @@ static int good_on_disk(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 	int is_rgrp;
 
 	bh = bread(sdp, rgd->rt_addr);
-	is_rgrp = (gfs2_check_meta(bh->b_data, GFS2_METATYPE_RG) == 0);
+	is_rgrp = (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_RG) == 0);
 	brelse(bh);
 	return is_rgrp;
 }
gfs2/mkfs/main_mkfs.c +11 -11
index 435ea0a7..318c24f2 100644
@@ -695,7 +695,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 	for (j = 0; j < sdp->md.journals; j++) {
 		struct gfs2_inode *ip;
 
-		ip = build_inum_range(per_node, j);
+		ip = lgfs2_build_inum_range(per_node, j);
 		if (ip == NULL) {
 			fprintf(stderr, _("Error building '%s': %s\n"), "inum_range",
 			        strerror(errno));
@@ -707,7 +707,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 		}
 		inode_put(&ip);
 
-		ip = build_statfs_change(per_node, j);
+		ip = lgfs2_build_statfs_change(per_node, j);
 		if (ip == NULL) {
 			fprintf(stderr, _("Error building '%s': %s\n"), "statfs_change",
 			        strerror(errno));
@@ -719,7 +719,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 		}
 		inode_put(&ip);
 
-		ip = build_quota_change(per_node, j);
+		ip = lgfs2_build_quota_change(per_node, j);
 		if (ip == NULL) {
 			fprintf(stderr, _("Error building '%s': %s\n"), "quota_change",
 			        strerror(errno));
@@ -1278,7 +1278,7 @@ int main(int argc, char *argv[])
 	}
 	lgfs2_attach_rgrps(&sbd, rgs); // Temporary
 
-	error = build_master(&sbd);
+	error = lgfs2_build_master(&sbd);
 	if (error) {
 		fprintf(stderr, _("Error building '%s': %s\n"), "master", strerror(errno));
 		exit(EXIT_FAILURE);
@@ -1298,7 +1298,7 @@ int main(int argc, char *argv[])
 	if (error != 0)
 		exit(1);
 
-	sbd.md.inum = build_inum(&sbd);
+	sbd.md.inum = lgfs2_build_inum(&sbd);
 	if (sbd.md.inum == NULL) {
 		fprintf(stderr, _("Error building '%s': %s\n"), "inum", strerror(errno));
 		exit(EXIT_FAILURE);
@@ -1307,7 +1307,7 @@ int main(int argc, char *argv[])
 		printf("\nInum Inode:\n");
 		dinode_print(sbd.md.inum->i_bh->b_data);
 	}
-	sbd.md.statfs = build_statfs(&sbd);
+	sbd.md.statfs = lgfs2_build_statfs(&sbd);
 	if (sbd.md.statfs == NULL) {
 		fprintf(stderr, _("Error building '%s': %s\n"), "statfs", strerror(errno));
 		exit(EXIT_FAILURE);
@@ -1316,7 +1316,7 @@ int main(int argc, char *argv[])
 		printf("\nStatFS Inode:\n");
 		dinode_print(sbd.md.statfs->i_bh->b_data);
 	}
-	ip = build_rindex(&sbd);
+	ip = lgfs2_build_rindex(&sbd);
 	if (ip == NULL) {
 		fprintf(stderr, _("Error building '%s': %s\n"), "rindex", strerror(errno));
 		exit(EXIT_FAILURE);
@@ -1330,7 +1330,7 @@ int main(int argc, char *argv[])
 		printf("%s", _("Creating quota file: "));
 		fflush(stdout);
 	}
-	ip = build_quota(&sbd);
+	ip = lgfs2_build_quota(&sbd);
 	if (ip == NULL) {
 		fprintf(stderr, _("Error building '%s': %s\n"), "quota", strerror(errno));
 		exit(EXIT_FAILURE);
@@ -1343,7 +1343,7 @@ int main(int argc, char *argv[])
 	if (!opts.quiet)
 		printf("%s", _("Done\n"));
 
-	build_root(&sbd);
+	lgfs2_build_root(&sbd);
 	if (opts.debug) {
 		printf("\nRoot directory:\n");
 		dinode_print(sbd.md.rooti->i_bh->b_data);
@@ -1355,11 +1355,11 @@ int main(int argc, char *argv[])
 	sbd.sd_lockproto[GFS2_LOCKNAME_LEN - 1] = '\0';
 	sbd.sd_locktable[GFS2_LOCKNAME_LEN - 1] = '\0';
 
-	do_init_inum(&sbd);
+	lgfs2_init_inum(&sbd);
 	if (opts.debug)
 		printf("\nNext Inum: %"PRIu64"\n", sbd.md.next_inum);
 
-	do_init_statfs(&sbd, &sc);
+	lgfs2_init_statfs(&sbd, &sc);
 	if (opts.debug) {
 		printf("\nStatfs:\n");
 		statfs_change_print(&sc);
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/21 libgfs2: Namespace improvements - buf.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/convert/gfs2_convert.c   |  76 +++++++--------
 gfs2/edit/extended.c          |  26 ++---
 gfs2/edit/gfs2hex.c           |   4 +-
 gfs2/edit/hexedit.c           |  48 +++++-----
 gfs2/edit/journal.c           |  40 ++++----
 gfs2/fsck/afterpass1_common.c |   8 +-
 gfs2/fsck/fs_recovery.c       |  62 ++++++------
 gfs2/fsck/initialize.c        |  44 ++++-----
 gfs2/fsck/lost_n_found.c      |   6 +-
 gfs2/fsck/metawalk.c          |  44 ++++-----
 gfs2/fsck/pass1.c             |  58 +++++------
 gfs2/fsck/pass1b.c            |  40 ++++----
 gfs2/fsck/pass2.c             |  76 +++++++--------
 gfs2/fsck/pass4.c             |   6 +-
 gfs2/fsck/pass5.c             |   4 +-
 gfs2/fsck/rgrepair.c          |  44 ++++-----
 gfs2/libgfs2/buf.c            |  18 ++--
 gfs2/libgfs2/fs_ops.c         | 176 +++++++++++++++++-----------------
 gfs2/libgfs2/gfs1.c           |  28 +++---
 gfs2/libgfs2/libgfs2.h        |  16 ++--
 gfs2/libgfs2/recovery.c       |  10 +-
 gfs2/libgfs2/structures.c     |  24 ++---
 gfs2/libgfs2/super.c          |  10 +-
 23 files changed, 434 insertions(+), 434 deletions(-)
gfs2/convert/gfs2_convert.c +38 -38
index 07fa9a10..5bfe8acd 100644
@@ -285,15 +285,15 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 			new = 0;
 			lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
 			if (bh != ip->i_bh)
-				brelse(bh);
+				lgfs2_brelse(bh);
 			if (!block)
 				break;
 
-			bh = bread(sbp, block);
+			bh = lgfs2_bread(sbp, block);
 			if (new)
 				memset(bh->b_data, 0, sbp->sd_bsize);
 			memcpy(bh->b_data, &mh, sizeof(mh));
-			bmodified(bh);
+			lgfs2_bmodified(bh);
 		}
 
 		hdrsize = blk->height ? sizeof(struct gfs2_meta_header) :
@@ -304,9 +304,9 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 
 		memcpy(bh->b_data + hdrsize + ptramt, (char *)srcptr, amount);
 		srcptr += amount;
-		bmodified(bh);
+		lgfs2_bmodified(bh);
 		if (bh != ip->i_bh)
-			brelse(bh);
+			lgfs2_brelse(bh);
 
 		copied += amount;
 
@@ -443,16 +443,16 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 			new = 0;
 			lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
 			if (bh != ip->i_bh)
-				brelse(bh);
+				lgfs2_brelse(bh);
 			if (!block)
 				break;
 
-			bh = bread(sbp, block);
+			bh = lgfs2_bread(sbp, block);
 			if (new)
 				memset(bh->b_data, 0, sbp->sd_bsize);
 			if (h < (blk->height - 1)) {
 				memcpy(bh->b_data, &mh, sizeof(mh));
-				bmodified(bh);
+				lgfs2_bmodified(bh);
 			}
 		}
 
@@ -461,9 +461,9 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 
 		memcpy(bh->b_data + ptramt, (char *)srcptr, amount);
 		srcptr += amount;
-		bmodified(bh);
+		lgfs2_bmodified(bh);
 		if (bh != ip->i_bh)
-			brelse(bh);
+			lgfs2_brelse(bh);
 
 		copied += amount;
 
@@ -554,12 +554,12 @@ static int get_inode_metablocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip, str
 			/* Queue it to be processed later on in the loop. */
 			osi_list_add_prev(&newblk->list, &blocks->list);
 			/* read the new metadata block's pointers */
-			bh = bread(sbp, block);
+			bh = lgfs2_bread(sbp, block);
 			memcpy(newblk->ptrbuf, bh->b_data + sizeof(struct gfs_indirect), bufsize);
 			/* Zero the buffer so we can fill it in later */
 			memset(bh->b_data + sizeof(struct gfs_indirect), 0, bufsize);
-			bmodified(bh);
-			brelse(bh);
+			lgfs2_bmodified(bh);
+			lgfs2_brelse(bh);
 			/* Free the block so we can reuse it. This allows us to
 			   convert a "full" file system. */
 			ip->i_blocks--;
@@ -654,14 +654,14 @@ static int fix_ind_jdata(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint32_t d
 		for (h=0; h < blk->height; h++)
 			newblk->mp.mp_list[h] = blk->mp.mp_list[h];
 		newblk->mp.mp_list[h] = ptrnum;
-		bh = bread(sbp, block);
+		bh = lgfs2_bread(sbp, block);
 		/* This is a data block. i.e newblk->height == ip->i_height */
 		/* read in the jdata block */
 		memcpy(newblk->ptrbuf, bh->b_data +
 		       sizeof(struct gfs2_meta_header), bufsize);
 		memset(bh->b_data + sizeof(struct gfs2_meta_header), 0, bufsize);
-		bmodified(bh);
-		brelse(bh);
+		lgfs2_bmodified(bh);
+		lgfs2_brelse(bh);
 		/* Free the block so we can reuse it. This allows us to
 		   convert a "full" file system */
 		ip->i_blocks--;
@@ -816,8 +816,8 @@ static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct g
 	char *buf;
 
 	/* Read in the i_eattr block */
-	eabh = bread(sbp, ip->i_eattr);
-        if (!lgfs2_check_meta(eabh->b_data, GFS_METATYPE_IN)) {/* if it is an indirect block */
+	eabh = lgfs2_bread(sbp, ip->i_eattr);
+	if (!lgfs2_check_meta(eabh->b_data, GFS_METATYPE_IN)) {/* if it is an indirect block */
 		len = sbp->sd_bsize - sizeof(struct gfs_indirect);
 		buf = malloc(len);
 		if (!buf) {
@@ -831,9 +831,9 @@ static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct g
 		memset(eabh->b_data + new_hdr_sz, 0, sbp->sd_bsize - new_hdr_sz);
 		memcpy(eabh->b_data + new_hdr_sz, buf, len);
 		free(buf);
-		bmodified(eabh);
+		lgfs2_bmodified(eabh);
 	}
-        brelse(eabh);
+	lgfs2_brelse(eabh);
 
 	return 0;
 }
@@ -940,7 +940,7 @@ static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
 		}
 	}
 
-	bmodified(inode->i_bh);
+	lgfs2_bmodified(inode->i_bh);
 	inode_put(&inode); /* does gfs2_dinode_out if modified */
 	sbp->md.next_inum++; /* update inode count */
 	return 0;
@@ -988,13 +988,13 @@ static int next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 
 	do{
 		if (bh)
-			brelse(bh);
+			lgfs2_brelse(bh);
 		if (next_rg_meta(rgd, block, first))
 			return -1;
-		bh = bread(sdp, *block);
+		bh = lgfs2_bread(sdp, *block);
 		first = 0;
 	} while(lgfs2_check_meta(bh->b_data, type));
-	brelse(bh);
+	lgfs2_brelse(bh);
 	return 0;
 }
 
@@ -1051,7 +1051,7 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 				sbp->sd_root_dir.in_addr = block;
 				sbp->sd_root_dir.in_formal_ino = sbp->md.next_inum;
 			}
-			bh = bread(sbp, block);
+			bh = lgfs2_bread(sbp, block);
 			if (!lgfs2_check_meta(bh->b_data, GFS_METATYPE_DI)) {/* if it is an dinode */
 				/* Skip the rindex and jindex inodes for now. */
 				if (block != rindex_addr && block != jindex_addr) {
@@ -1086,7 +1086,7 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 					bitmap_byte -= (sbp->sd_bsize - buf_offset);
 				}
 			}
-			brelse(bh);
+			lgfs2_brelse(bh);
 			first = 0;
 		} /* while 1 */
 	} /* for all rgs */
@@ -1283,8 +1283,8 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip
 		}
 		leaf = (struct gfs2_leaf *)bh_leaf->b_data;
 		error = process_dirent_info(dip, sbp, bh_leaf, be16_to_cpu(leaf->lf_entries), dentmod);
-		bmodified(bh_leaf);
-		brelse(bh_leaf);
+		lgfs2_bmodified(bh_leaf);
+		lgfs2_brelse(bh_leaf);
 		if (dentmod && error == -EISDIR) /* dentmod was marked DT_DIR, break out */
 			break;
 		if (leaf->lf_next) { /* leaf has a leaf chain, process leaves in chain */
@@ -1319,7 +1319,7 @@ static int process_directory(struct gfs2_sbd *sbp, uint64_t dirblock, uint64_t d
 			return -1;
 		}
 	}
-	bmodified(dip->i_bh);
+	lgfs2_bmodified(dip->i_bh);
 	inode_put(&dip);
 	return 0;
 }
@@ -1413,8 +1413,8 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
 			return -1;
 		fix_inode->i_eattr = eablk; /*fix extended attribute */
 		inode_put(&fix_inode);
-		bmodified(bh);
-		brelse(bh);
+		lgfs2_bmodified(bh);
+		lgfs2_brelse(bh);
 
 		/* fix the parent directory dirent entry for this inode */
 		error = process_directory(sbp, l_fix->di_paddr, l_fix->di_addr);
@@ -1590,7 +1590,7 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
 		exit(-1);
 	}
 
-	bh = bread(sbp, GFS2_SB_ADDR >> sbp->sd_fsb2bb_shift);
+	bh = lgfs2_bread(sbp, GFS2_SB_ADDR >> sbp->sd_fsb2bb_shift);
 	memcpy(&gfs1_sb, bh->b_data, sizeof(struct gfs_sb));
 	lgfs2_sb_in(sbp, bh->b_data);
 
@@ -1604,7 +1604,7 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
 	sbp->sd_diptrs = (sbp->sd_bsize - sizeof(struct gfs_dinode)) /
 		sizeof(uint64_t);
 	sbp->sd_jbsize = sbp->sd_bsize - sizeof(struct gfs2_meta_header);
-	brelse(bh);
+	lgfs2_brelse(bh);
 	if (compute_heightsize(sbp->sd_bsize, sbp->sd_heightsize, &sbp->sd_max_height,
 				sbp->sd_bsize, sbp->sd_diptrs, sbp->sd_inptrs)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
@@ -2162,10 +2162,10 @@ static void copy_quotas(struct gfs2_sbd *sdp)
 	oq_ip->i_height = 0;
 	oq_ip->i_size = 0;
 
-	bmodified(nq_ip->i_bh);
+	lgfs2_bmodified(nq_ip->i_bh);
 	inode_put(&nq_ip);
 
-	bmodified(oq_ip->i_bh);
+	lgfs2_bmodified(oq_ip->i_bh);
 	inode_put(&oq_ip);
 }
 
@@ -2389,12 +2389,12 @@ int main(int argc, char **argv)
 		/* end because if the tool is interrupted in the middle, we want */
 		/* it to not reject the partially converted fs as already done   */
 		/* when it's run a second time.                                  */
-		bh = bread(&sb2, LGFS2_SB_ADDR(&sb2));
+		bh = lgfs2_bread(&sb2, LGFS2_SB_ADDR(&sb2));
 		sb2.sd_fs_format = GFS2_FORMAT_FS;
 		sb2.sd_multihost_format = GFS2_FORMAT_MULTI;
 		lgfs2_sb_out(&sb2, bh->b_data);
-		bmodified(bh);
-		brelse(bh);
+		lgfs2_bmodified(bh);
+		lgfs2_brelse(bh);
 
 		error = fsync(sb2.device_fd);
 		if (error)
gfs2/edit/extended.c +13 -13
index 6e2e16db..89720a53 100644
@@ -628,13 +628,13 @@ int display_extended(void)
 	dsplines = termlines - line - 1;
 	/* Display any indirect pointers that we have. */
 	if (block_is_rindex(block)) {
-		tmp_bh = bread(&sbd, block);
+		tmp_bh = lgfs2_bread(&sbd, block);
 		tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
 		if (tmp_inode == NULL)
 			return -1;
 		parse_rindex(tmp_inode, TRUE);
 		inode_put(&tmp_inode);
-		brelse(tmp_bh);
+		lgfs2_brelse(tmp_bh);
 	} else if (block_is_journals(block)) {
 		if (sbd.gfs1)
 			block = sbd.sd_jindex_di.in_addr;
@@ -648,50 +648,50 @@ int display_extended(void)
 		return -1;
 	else if (block_is_rgtree(block)) {
 		if (sbd.gfs1)
-			tmp_bh = bread(&sbd, sbd.sd_rindex_di.in_addr);
+			tmp_bh = lgfs2_bread(&sbd, sbd.sd_rindex_di.in_addr);
 		else
-			tmp_bh = bread(&sbd, masterblock("rindex"));
+			tmp_bh = lgfs2_bread(&sbd, masterblock("rindex"));
 		tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
 		if (tmp_inode == NULL)
 			return -1;
 		parse_rindex(tmp_inode, FALSE);
 		inode_put(&tmp_inode);
-		brelse(tmp_bh);
+		lgfs2_brelse(tmp_bh);
 	} else if (block_is_jindex(block)) {
-		tmp_bh = bread(&sbd, block);
+		tmp_bh = lgfs2_bread(&sbd, block);
 		tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
 		if (tmp_inode == NULL)
 			return -1;
 		print_gfs_jindex(tmp_inode);
 		inode_put(&tmp_inode);
-		brelse(tmp_bh);
+		lgfs2_brelse(tmp_bh);
 	}
 	else if (block_is_inum_file(block)) {
-		tmp_bh = bread(&sbd, block);
+		tmp_bh = lgfs2_bread(&sbd, block);
 		tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
 		if (tmp_inode == NULL)
 			return -1;
 		print_inum(tmp_inode);
 		inode_put(&tmp_inode);
-		brelse(tmp_bh);
+		lgfs2_brelse(tmp_bh);
 	}
 	else if (block_is_statfs_file(block)) {
-		tmp_bh = bread(&sbd, block);
+		tmp_bh = lgfs2_bread(&sbd, block);
 		tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
 		if (tmp_inode == NULL)
 			return -1;
 		print_statfs(tmp_inode);
 		inode_put(&tmp_inode);
-		brelse(tmp_bh);
+		lgfs2_brelse(tmp_bh);
 	}
 	else if (block_is_quota_file(block)) {
-		tmp_bh = bread(&sbd, block);
+		tmp_bh = lgfs2_bread(&sbd, block);
 		tmp_inode = lgfs2_inode_get(&sbd, tmp_bh);
 		if (tmp_inode == NULL)
 			return -1;
 		print_quota(tmp_inode);
 		inode_put(&tmp_inode);
-		brelse(tmp_bh);
+		lgfs2_brelse(tmp_bh);
 	}
 	return 0;
 }
gfs2/edit/gfs2hex.c +2 -2
index 610c7d2a..cdf22042 100644
@@ -192,7 +192,7 @@ void do_dinode_extended(char *buf)
 
 				if (last >= max_block)
 					break;
-				tmp_bh = bread(&sbd, last);
+				tmp_bh = lgfs2_bread(&sbd, last);
 				indirect->ii[indirect_blocks].dirents = 0;
 				for (direntcount = 0, bufoffset = sizeof(struct gfs2_leaf);
 					 bufoffset < sbd.sd_bsize;
@@ -203,7 +203,7 @@ void do_dinode_extended(char *buf)
 					if (skip <= 0)
 						break;
 				}
-				brelse(tmp_bh);
+				lgfs2_brelse(tmp_bh);
 				indirect->ii[indirect_blocks].block = last;
 				indirect_blocks++;
 				last = p;
gfs2/edit/hexedit.c +24 -24

170 lines not on this page · raw message

gfs2/edit/journal.c +20 -20
index 11f9e032..29986c3e 100644
@@ -47,7 +47,7 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
 	else
 		jindex_block = masterblock("jindex");
 	/* read in the block */
-	jindex_bh = bread(&sbd, jindex_block);
+	jindex_bh = lgfs2_bread(&sbd, jindex_block);
 	di = (struct gfs2_dinode *)jindex_bh->b_data;
 
 	if (!sbd.gfs1)
@@ -74,12 +74,12 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
 		if (journal_num > indirect->ii[0].dirents - 2)
 			return 0;
 		jblock = indirect->ii[0].dirent[journal_num + 2].inum.in_addr;
-		j_bh = bread(&sbd, jblock);
+		j_bh = lgfs2_bread(&sbd, jblock);
 		jdi = (struct gfs2_dinode *)j_bh->b_data;
 		*j_size = be64_to_cpu(jdi->di_size);
-		brelse(j_bh);
+		lgfs2_brelse(j_bh);
 	}
-	brelse(jindex_bh);
+	lgfs2_brelse(jindex_bh);
 	return jblock;
 }
 
@@ -147,7 +147,7 @@ static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
 			block_map(ip, lblock, &not_new, &dblock, &extlen,
 				  FALSE);
 		if (dblock) {
-			lbh = bread(sdp, dblock);
+			lbh = lgfs2_bread(sdp, dblock);
 			if (*abs_block == 0)
 				*abs_block = lbh->b_blocknr;
 			dblock++;
@@ -156,7 +156,7 @@ static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
 			lbh = NULL;
 		if (lbh) {
 			memcpy(rbuf, lbh->b_data + o, amount);
-			brelse(lbh);
+			lgfs2_brelse(lbh);
 		} else {
 			memset(rbuf, 0, amount);
 		}
@@ -220,12 +220,12 @@ static int print_ld_blks(const __be64 *b, const char *end, int start_line,
 			bcount++;
 			if (prnt) {
 				if (is_meta_ld) {
-					j_bmap_bh = bread(&sbd, abs_block +
+					j_bmap_bh = lgfs2_bread(&sbd, abs_block +
 							  bcount);
 					sprintf(str, "0x%"PRIx64" %2s",
 						be64_to_cpu(*b),
 						mtypes[lgfs2_get_block_type(j_bmap_bh->b_data)]);
-					brelse(j_bmap_bh);
+					lgfs2_brelse(j_bmap_bh);
 				} else {
 					sprintf(str, "0x%"PRIx64, be64_to_cpu(*b));
 				}
@@ -258,11 +258,11 @@ static int print_ld_blks(const __be64 *b, const char *end, int start_line,
 							* GFS2_NBBY;
 					bmap = o / sbd.sd_blocks_per_bitmap;
 					save_ptr = rgd->bits[bmap].bi_data;
-					j_bmap_bh = bread(&sbd, abs_block +
+					j_bmap_bh = lgfs2_bread(&sbd, abs_block +
 							  bcount);
 					rgd->bits[bmap].bi_data = j_bmap_bh->b_data;
 					type = lgfs2_get_bitmap(&sbd, tblk, rgd);
-					brelse(j_bmap_bh);
+					lgfs2_brelse(j_bmap_bh);
 					if (type < 0) {
 						perror("Error printing log descriptor blocks");
 						exit(1);
@@ -328,9 +328,9 @@ static uint64_t find_wrap_pt(struct gfs2_inode *ji, char *jbuf, uint64_t jblock,
 		if (sbd.gfs1) {
 			struct gfs2_buffer_head *j_bh;
 
-			j_bh = bread(&sbd, jblock + jb);
+			j_bh = lgfs2_bread(&sbd, jblock + jb);
 			found = is_wrap_pt(j_bh->b_data, &highest_seq);
-			brelse(j_bh);
+			lgfs2_brelse(j_bh);
 		} else {
 			int copied;
 			uint64_t abs_block;
@@ -415,7 +415,7 @@ static int meta_has_ref(uint64_t abs_block, int tblk)
 	__be64 *b;
 	struct gfs2_dinode *dinode;
 
-	mbh = bread(&sbd, abs_block);
+	mbh = lgfs2_bread(&sbd, abs_block);
 	mtype = get_block_type(mbh->b_data);
 	if (mtype != NULL) {
 		structlen = mtype->size;
@@ -431,7 +431,7 @@ static int meta_has_ref(uint64_t abs_block, int tblk)
 			has_ref = 1;
 		b++;
 	}
-	brelse(mbh);
+	lgfs2_brelse(mbh);
 	return has_ref;
 }
 
@@ -449,11 +449,11 @@ static uint64_t get_ldref(uint64_t abs_ld, int offset_from_ld)
 	uint64_t refblk;
 	__be64 *b;
 
-	jbh = bread(&sbd, abs_ld);
+	jbh = lgfs2_bread(&sbd, abs_ld);
 	b = (__be64 *)(jbh->b_data + sizeof(struct gfs2_log_descriptor));
 	b += offset_from_ld - 1;
 	refblk = be64_to_cpu(*b);
-	brelse(jbh);
+	lgfs2_brelse(jbh);
 	return refblk;
 }
 
@@ -530,7 +530,7 @@ void dump_journal(const char *journal, uint64_t tblk)
 		return;
 
 	if (!sbd.gfs1) {
-		j_bh = bread(&sbd, jblock);
+		j_bh = lgfs2_bread(&sbd, jblock);
 		j_inode = lgfs2_inode_get(&sbd, j_bh);
 		if (j_inode == NULL) {
 			fprintf(stderr, "Out of memory\n");
@@ -582,9 +582,9 @@ void dump_journal(const char *journal, uint64_t tblk)
 
 		if (sbd.gfs1) {
 			if (j_bh)
-				brelse(j_bh);
+				lgfs2_brelse(j_bh);
 			abs_block = jblock + ((jb + wrappt) % j_size);
-			j_bh = bread(&sbd, abs_block);
+			j_bh = lgfs2_bread(&sbd, abs_block);
 			buf = j_bh->b_data;
 		} else {
 			int error = fsck_readi(j_inode, (void *)jbuf,
@@ -644,7 +644,7 @@ void dump_journal(const char *journal, uint64_t tblk)
 	}
 	if (j_inode != NULL)
 		inode_put(&j_inode);
-	brelse(j_bh);
+	lgfs2_brelse(j_bh);
 	blockhist = -1; /* So we don't print anything else */
 	free(jbuf);
 	if (!termlines)
gfs2/fsck/afterpass1_common.c +4 -4
index 12a9f647..952275a0 100644
@@ -207,10 +207,10 @@ static int del_eattr_generic(struct gfs2_inode *ip, uint64_t block,
 		ret = delete_block_if_notdup(ip, block, NULL, eatype,
 					     NULL, private);
 		if (!ret) {
-			*bh = bread(ip->i_sbd, block);
+			*bh = lgfs2_bread(ip->i_sbd, block);
 			if (!was_free)
 				ip->i_blocks--;
-			bmodified(ip->i_bh);
+			lgfs2_bmodified(ip->i_bh);
 		}
 	}
 	/* Even if it's a duplicate reference, we want to eliminate the
@@ -218,7 +218,7 @@ static int del_eattr_generic(struct gfs2_inode *ip, uint64_t block,
 	if (ip->i_eattr) {
 		if (block == ip->i_eattr)
 			ip->i_eattr = 0;
-		bmodified(ip->i_bh);
+		lgfs2_bmodified(ip->i_bh);
 	}
 	return ret;
 }
@@ -294,7 +294,7 @@ int delete_eattr_extentry(struct gfs2_inode *ip, int i, __be64 *ea_data_ptr,
 			ea_hdr->ea_num_ptrs = i;
 			ea_hdr->ea_data_len = cpu_to_be32(tot_ealen);
 			*ea_data_ptr = 0;
-			bmodified(leaf_bh);
+			lgfs2_bmodified(leaf_bh);
 			/* Endianness doesn't matter in this case because it's
 			   a single byte. */
 			fsck_bitmap_set(ip, ip->i_eattr,
gfs2/fsck/fs_recovery.c +31 -31

155 lines not on this page · raw message

gfs2/fsck/initialize.c +22 -22

150 lines not on this page · raw message

gfs2/fsck/lost_n_found.c +3 -3
index 338f2a0a..65e13125 100644
@@ -45,7 +45,7 @@ static void add_dotdot(struct gfs2_inode *ip)
 			  set_di_nlink(dip); /* keep inode tree in sync */
 			  log_debug(_("Decrementing its links to %d\n"),
 				    dip->i_nlink);
-			  bmodified(dip->i_bh);
+			  lgfs2_bmodified(dip->i_bh);
 			} else if (!dip->i_nlink) {
 			  log_debug(_("Its link count is zero.\n"));
 			} else {
@@ -53,7 +53,7 @@ static void add_dotdot(struct gfs2_inode *ip)
 			            dip->i_nlink);
 			  dip->i_nlink = 0;
 			  set_di_nlink(dip); /* keep inode tree in sync */
-			  bmodified(dip->i_bh);
+			  lgfs2_bmodified(dip->i_bh);
 			}
 		} else {
 			log_debug(_("Directory (0x%"PRIx64")'s link to parent "
@@ -243,6 +243,6 @@ int add_inode_to_lf(struct gfs2_inode *ip){
 	log_notice(_("Added inode #%"PRIu64" (0x%"PRIx64") to lost+found\n"),
 	           ip->i_num.in_addr, ip->i_num.in_addr);
 	lgfs2_dinode_out(lf_dip, lf_dip->i_bh->b_data);
-	bwrite(lf_dip->i_bh);
+	lgfs2_bwrite(lf_dip->i_bh);
 	return 0;
 }
gfs2/fsck/metawalk.c +22 -22

161 lines not on this page · raw message

gfs2/fsck/pass1.c +29 -29

225 lines not on this page · raw message

gfs2/fsck/pass1b.c +20 -20
index 5b37478d..1fb1cc4c 100644
@@ -114,17 +114,17 @@ static void clone_data_block(struct gfs2_sbd *sdp, struct duptree *dt,
 		log_err(_("Unable to clone data block.\n"));
 	} else {
 		if (metaref.metablock != id->block_no)
-			bh = bread(sdp, metaref.metablock);
+			bh = lgfs2_bread(sdp, metaref.metablock);
 		else
 			bh = ip->i_bh;
 		ptr = (__be64 *)bh->b_data + metaref.off;
 		clone_data(ip, 0, dt->block, &clone, bh, ptr);
 		if (metaref.metablock != id->block_no)
-			brelse(bh);
+			lgfs2_brelse(bh);
 		else
-			bmodified(ip->i_bh);
+			lgfs2_bmodified(ip->i_bh);
 	}
-	fsck_inode_put(&ip); /* out, brelse, free */
+	fsck_inode_put(&ip); /* out, lgfs2_brelse, free */
 }
 
 /* revise_dup_handler - get current information about a duplicate reference
@@ -311,7 +311,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
 				if (ip->i_blocks > 0)
 					ip->i_blocks--;
 				ip->i_flags &= ~GFS2_DIF_EA_INDIRECT;
-				bmodified(ip->i_bh);
+				lgfs2_bmodified(ip->i_bh);
 				dup_listent_delete(dt, id);
 				(dh->ref_inode_count)--;
 			} else {
@@ -365,7 +365,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
 		   still being referenced by a valid dinode. */
 		if (this_ref != REF_AS_EA)
 			delete_all_dups(ip);
-		fsck_inode_put(&ip); /* out, brelse, free */
+		fsck_inode_put(&ip); /* out, lgfs2_brelse, free */
 	}
 	return;
 }
@@ -378,7 +378,7 @@ static int clone_check_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int
 
 	*was_duplicate = 0;
 	*is_valid = 1;
-	*bh = bread(ip->i_sbd, block);
+	*bh = lgfs2_bread(ip->i_sbd, block);
 	return 0;
 }
 
@@ -412,16 +412,16 @@ static int clone_data(struct gfs2_inode *ip, uint64_t metablock,
 	if (query( _("Okay to clone the duplicated reference? (y/n) "))) {
 		error = lgfs2_meta_alloc(ip, &cloneblock);
 		if (!error) {
-			clone_bh = bread(ip->i_sbd, clonet->dup_block);
+			clone_bh = lgfs2_bread(ip->i_sbd, clonet->dup_block);
 			if (clone_bh) {
 				fsck_bitmap_set(ip, cloneblock, _("data"),
 						GFS2_BLKST_USED);
 				clone_bh->b_blocknr = cloneblock;
-				bmodified(clone_bh);
-				brelse(clone_bh);
+				lgfs2_bmodified(clone_bh);
+				lgfs2_brelse(clone_bh);
 				/* Now fix the reference: */
 				*ptr = cpu_to_be64(cloneblock);
-				bmodified(bh);
+				lgfs2_bmodified(bh);
 				log_err(_("Duplicate reference to block %"PRIu64
 				          " (0x%"PRIx64") was cloned to block %"PRIu64
 					  " (0x%"PRIx64").\n"),
@@ -437,7 +437,7 @@ static int clone_data(struct gfs2_inode *ip, uint64_t metablock,
 			return 0;
 		}
 		*ptr = 0;
-		bmodified(bh);
+		lgfs2_bmodified(bh);
 		log_err(_("Duplicate reference to block %"PRIu64" (0x%"PRIx64") was zeroed.\n"),
 		        block, block);
 	} else {
@@ -579,7 +579,7 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
 				ip->i_eattr = 0;
 				ip->i_flags &= ~GFS2_DIF_EA_INDIRECT;
 				ip->i_blocks--;
-				bmodified(ip->i_bh);
+				lgfs2_bmodified(ip->i_bh);
 				fsck_bitmap_set(ip, dt->block,
 						_("reference-repaired EA"),
 						GFS2_BLKST_FREE);
@@ -591,7 +591,7 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
 			}
 		}
 	}
-	fsck_inode_put(&ip); /* out, brelse, free */
+	fsck_inode_put(&ip); /* out, lgfs2_brelse, free */
 	log_debug(_("Done with duplicate reference to block 0x%"PRIx64"\n"), dt->block);
 	dup_delete(dt);
 }
@@ -630,10 +630,10 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
 	   references to it as metadata.  Dinodes with such references are
 	   clearly corrupt and need to be deleted.
 	   And if we're left with a single reference, problem solved. */
-	bh = bread(sdp, dt->block);
+	bh = lgfs2_bread(sdp, dt->block);
 	cmagic = ((struct gfs2_meta_header *)(bh->b_data))->mh_magic;
 	ctype = ((struct gfs2_meta_header *)(bh->b_data))->mh_type;
-	brelse(bh);
+	lgfs2_brelse(bh);
 
 	/* If this is a dinode, any references to it (except in directory
 	   entries) are invalid and should be deleted. */
@@ -763,7 +763,7 @@ static int check_eattr_indir_refs(struct gfs2_inode *ip, uint64_t block,
 
 	error = add_duplicate_ref(ip, block, REF_AS_EA, 1, INODE_VALID);
 	if (!error)
-		*bh = bread(sdp, block);
+		*bh = lgfs2_bread(sdp, block);
 
 	return error;
 }
@@ -777,7 +777,7 @@ static int check_eattr_leaf_refs(struct gfs2_inode *ip, uint64_t block,
 
 	error = add_duplicate_ref(ip, block, REF_AS_EA, 1, INODE_VALID);
 	if (!error)
-		*bh = bread(sdp, block);
+		*bh = lgfs2_bread(sdp, block);
 	return error;
 }
 
@@ -826,7 +826,7 @@ static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode)
 		.check_eattr_extentry = check_eattr_extentry_refs,
 	};
 
-	ip = fsck_load_inode(sdp, inode); /* bread, inode_get */
+	ip = fsck_load_inode(sdp, inode); /* lgfs2_bread, inode_get */
 
 	/* double-check the meta header just to be sure it's metadata */
 	if (ip->i_magic != GFS2_MAGIC ||
@@ -850,7 +850,7 @@ static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode)
 		error = check_inode_eattr(ip, &find_refs);
 
 out:
-	fsck_inode_put(&ip); /* out, brelse, free */
+	fsck_inode_put(&ip); /* out, lgfs2_brelse, free */
 	return error;
 }
 
gfs2/fsck/pass2.c +38 -38

264 lines not on this page · raw message

gfs2/fsck/pass4.c +3 -3
index 78faf71d..25d756d9 100644
@@ -33,7 +33,7 @@ static int fix_link_count(uint32_t counted_links, struct gfs2_inode *ip)
 	if (ip->i_nlink == counted_links)
 		return 0;
 	ip->i_nlink = counted_links;
-	bmodified(ip->i_bh);
+	lgfs2_bmodified(ip->i_bh);
 
 	log_debug(_("Changing inode %"PRIu64" (0x%"PRIx64") to have %u links\n"),
 	          ip->i_num.in_addr, ip->i_num.in_addr, counted_links);
@@ -128,10 +128,10 @@ static void handle_inconsist(struct gfs2_sbd *sdp, uint64_t no_addr,
 	          no_addr, no_addr)) {
 		struct gfs2_inode *ip;
 
-		ip = fsck_load_inode(sdp, no_addr); /* bread, inode_get */
+		ip = fsck_load_inode(sdp, no_addr); /* lgfs2_bread, inode_get */
 		fix_link_count(counted_links, ip);
 		*di_nlink = counted_links;
-		fsck_inode_put(&ip); /* out, brelse, free */
+		fsck_inode_put(&ip); /* out, lgfs2_brelse, free */
 		log_warn(_("Link count updated to %d for inode %"PRIu64" (0x%"PRIx64")\n"),
 		         *di_nlink, no_addr, no_addr);
 	} else {
gfs2/fsck/pass5.c +2 -2
index 7d2e309d..9b8f8375 100644
@@ -48,12 +48,12 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
 		if (sdp->gfs1 && q == GFS2_BLKST_DINODE) {
 			struct gfs2_buffer_head *bh;
 
-			bh = bread(sdp, block);
+			bh = lgfs2_bread(sdp, block);
 			if (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_DI) == 0)
 				count[GFS2_BLKST_DINODE]++;
 			else
 				count[GFS1_BLKST_USEDMETA]++;
-			brelse(bh);
+			lgfs2_brelse(bh);
 		} else {
 			count[q]++;
 		}
gfs2/fsck/rgrepair.c +22 -22

146 lines not on this page · raw message

gfs2/libgfs2/buf.c +9 -9
index cd5fba82..c2cb7461 100644
@@ -22,7 +22,7 @@
   #endif
 #endif
 
-struct gfs2_buffer_head *bget(struct gfs2_sbd *sdp, uint64_t num)
+struct gfs2_buffer_head *lgfs2_bget(struct gfs2_sbd *sdp, uint64_t num)
 {
 	struct gfs2_buffer_head *bh;
 
@@ -38,8 +38,8 @@ struct gfs2_buffer_head *bget(struct gfs2_sbd *sdp, uint64_t num)
 	return bh;
 }
 
-int __breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n,
-	     uint64_t block, int line, const char *caller)
+int __lgfs2_breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n,
+                   uint64_t block, int line, const char *caller)
 {
 	size_t v = (n < IOV_MAX) ? n : IOV_MAX;
 	struct iovec *iov = alloca(v * sizeof(struct iovec));
@@ -52,7 +52,7 @@ int __breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n,
 		ssize_t size = 0;
 
 		for (j = 0; (i + j < n) && (j < IOV_MAX); j++) {
-			bhs[i + j] = bget(sdp, block + i + j);
+			bhs[i + j] = lgfs2_bget(sdp, block + i + j);
 			if (bhs[i + j] == NULL)
 				return -1;
 			iov[j] = bhs[i + j]->iov;
@@ -71,13 +71,13 @@ int __breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n,
 	return 0;
 }
 
-struct gfs2_buffer_head *__bread(struct gfs2_sbd *sdp, uint64_t num, int line,
+struct gfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num, int line,
 				 const char *caller)
 {
 	struct gfs2_buffer_head *bh;
 	ssize_t ret;
 
-	bh = bget(sdp, num);
+	bh = lgfs2_bget(sdp, num);
 	if (bh == NULL)
 		return NULL;
 
@@ -91,7 +91,7 @@ struct gfs2_buffer_head *__bread(struct gfs2_sbd *sdp, uint64_t num, int line,
 	return bh;
 }
 
-int bwrite(struct gfs2_buffer_head *bh)
+int lgfs2_bwrite(struct gfs2_buffer_head *bh)
 {
 	struct gfs2_sbd *sdp = bh->sdp;
 
@@ -101,14 +101,14 @@ int bwrite(struct gfs2_buffer_head *bh)
 	return 0;
 }
 
-int brelse(struct gfs2_buffer_head *bh)
+int lgfs2_brelse(struct gfs2_buffer_head *bh)
 {
 	int error = 0;
 
 	if (bh->b_blocknr == -1)
 		printf("Double free!\n");
 	if (bh->b_modified)
-		error = bwrite(bh);
+		error = lgfs2_bwrite(bh);
 	bh->b_blocknr = -1;
 	if (bh->b_altlist.next && !osi_list_empty(&bh->b_altlist))
 		osi_list_del(&bh->b_altlist);
gfs2/libgfs2/fs_ops.c +88 -88

578 lines not on this page · raw message

gfs2/libgfs2/gfs1.c +14 -14
index 850d7217..79da01a4 100644
@@ -60,9 +60,9 @@ void gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 	}
 
 	*ptr = cpu_to_be64(*block);
-	bmodified(bh);
+	lgfs2_bmodified(bh);
 	ip->i_blocks++;
-	bmodified(ip->i_bh);
+	lgfs2_bmodified(ip->i_bh);
 
 	*new = 1;
 }
@@ -111,7 +111,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 	for (x = 0; x < end_of_metadata; x++) {
 		gfs1_lookup_block(ip, bh, x, &mp, create, new, dblock);
 		if (bh != ip->i_bh)
-			brelse(bh);
+			lgfs2_brelse(bh);
 		if (!*dblock)
 			return;
 
@@ -121,14 +121,14 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 				.mh_type = cpu_to_be32(GFS2_METATYPE_IN),
 				.mh_format = cpu_to_be32(GFS2_FORMAT_IN)
 			};
-			bh = bget(sdp, *dblock);
+			bh = lgfs2_bget(sdp, *dblock);
 			memcpy(bh->b_data, &mh, sizeof(mh));
-			bmodified(bh);
+			lgfs2_bmodified(bh);
 		} else {
 			if (*dblock == ip->i_num.in_addr)
 				bh = ip->i_bh;
 			else
-				bh = bread(sdp, *dblock);
+				bh = lgfs2_bread(sdp, *dblock);
 		}
 	}
 
@@ -160,7 +160,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 	}
 
 	if (bh != ip->i_bh)
-		brelse(bh);
+		lgfs2_brelse(bh);
 }
 
 int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
@@ -211,7 +211,7 @@ int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
 		if (dblock == ip->i_num.in_addr)
 			bh = ip->i_bh;
 		else
-			bh = bread(sdp, dblock);
+			bh = lgfs2_bread(sdp, dblock);
 
 		if (journaled && dblock != ip->i_num.in_addr ) {
 			struct gfs2_meta_header mh = {
@@ -223,9 +223,9 @@ int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
 		}
 
 		memcpy(bh->b_data + offset, (char *)buf + copied, amount);
-		bmodified(bh);
+		lgfs2_bmodified(bh);
 		if (bh != ip->i_bh)
-			brelse(bh);
+			lgfs2_brelse(bh);
 
 		copied += amount;
 		lblock++;
@@ -236,12 +236,12 @@ int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
 	}
 
 	if (ip->i_size < start + copied) {
-		bmodified(ip->i_bh);
+		lgfs2_bmodified(ip->i_bh);
 		ip->i_size = start + copied;
 	}
 	ip->i_mtime = ip->i_ctime = time(NULL);
 	lgfs2_dinode_out(ip, ip->i_bh->b_data);
-	bmodified(ip->i_bh);
+	lgfs2_bmodified(ip->i_bh);
 	return copied;
 }
 
@@ -294,11 +294,11 @@ struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr)
 	struct gfs2_buffer_head *bh;
 	struct gfs2_inode *ip;
 
-	bh = bget(sdp, di_addr);
+	bh = lgfs2_bget(sdp, di_addr);
 	if (bh == NULL)
 		return NULL;
 	if (pread(sdp->device_fd, bh->b_data, sdp->sd_bsize, di_addr * sdp->sd_bsize) != sdp->sd_bsize) {
-		brelse(bh);
+		lgfs2_brelse(bh);
 		return NULL;
 	}
 	ip = __gfs_inode_get(sdp, bh->b_data);
gfs2/libgfs2/libgfs2.h +8 -8
index 6aa97053..05a90900 100644
@@ -458,18 +458,18 @@ extern int lgfs2_field_str(char *str, const size_t size, const char *blk, const
 extern int lgfs2_field_assign(char *blk, const struct lgfs2_metafield *field, const void *val);
 
 /* buf.c */
-extern struct gfs2_buffer_head *bget(struct gfs2_sbd *sdp, uint64_t num);
-extern struct gfs2_buffer_head *__bread(struct gfs2_sbd *sdp, uint64_t num,
+extern struct gfs2_buffer_head *lgfs2_bget(struct gfs2_sbd *sdp, uint64_t num);
+extern struct gfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num,
 					int line, const char *caller);
-extern int __breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n, uint64_t block, int line, const char *caller);
-extern int bwrite(struct gfs2_buffer_head *bh);
-extern int brelse(struct gfs2_buffer_head *bh);
+extern int __lgfs2_breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n, uint64_t block, int line, const char *caller);
+extern int lgfs2_bwrite(struct gfs2_buffer_head *bh);
+extern int lgfs2_brelse(struct gfs2_buffer_head *bh);
 extern uint32_t lgfs2_get_block_type(const char *buf);
 
-#define bmodified(bh) do { bh->b_modified = 1; } while(0)
+#define lgfs2_bmodified(bh) do { bh->b_modified = 1; } while(0)
 
-#define bread(bl, num) __bread(bl, num, __LINE__, __FUNCTION__)
-#define breadm(bl, bhs, n, block) __breadm(bl, bhs, n, block, __LINE__, __FUNCTION__)
+#define lgfs2_bread(bl, num) __lgfs2_bread(bl, num, __LINE__, __FUNCTION__)
+#define lgfs2_breadm(bl, bhs, n, block) __lgfs2_breadm(bl, bhs, n, block, __LINE__, __FUNCTION__)
 
 /* device_geometry.c */
 extern int lgfs2_get_dev_info(int fd, struct lgfs2_dev_info *i);
gfs2/libgfs2/recovery.c +5 -5
index f4cea511..2edfe120 100644
@@ -32,7 +32,7 @@ int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
 	if (!dblock)
 		return -EIO;
 
-	*bh = bread(ip->i_sbd, dblock);
+	*bh = lgfs2_bread(ip->i_sbd, dblock);
 	return 0;
 }
 
@@ -88,7 +88,7 @@ int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
 	tmp->lh_hash = saved_hash;
 	crc = lgfs2_log_header_crc(bh->b_data, ip->i_sbd->sd_bsize);
 	log_header_in(&lh, bh->b_data);
-	brelse(bh);
+	lgfs2_brelse(bh);
 	lh_crc = lh.lh_crc;
 	if (error || lh.lh_blkno != blk || lh.lh_hash != hash)
 		return 1;
@@ -245,7 +245,7 @@ int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head)
 	if (!dblock)
 		return -EIO;
 
-	bh = bread(ip->i_sbd, dblock);
+	bh = lgfs2_bread(ip->i_sbd, dblock);
 	memset(bh->b_data, 0, ip->i_sbd->sd_bsize);
 
 	lh = (struct gfs2_log_header *)bh->b_data;
@@ -258,8 +258,8 @@ int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head)
 	lh->lh_blkno = cpu_to_be32(lblock);
 	hash = lgfs2_log_header_hash(bh->b_data);
 	lh->lh_hash = cpu_to_be32(hash);
-	bmodified(bh);
-	brelse(bh);
+	lgfs2_bmodified(bh);
+	lgfs2_brelse(bh);
 
 	return 0;
 }
gfs2/libgfs2/structures.c +12 -12
index 4029df43..3bf876ea 100644
@@ -166,13 +166,13 @@ static struct gfs2_buffer_head *lgfs2_get_file_buf(struct gfs2_inode *ip, uint64
 
 	if (!prealloc && new &&
 	    ip->i_size < (lbn + 1) << sdp->sd_bsize_shift) {
-		bmodified(ip->i_bh);
+		lgfs2_bmodified(ip->i_bh);
 		ip->i_size = (lbn + 1) << sdp->sd_bsize_shift;
 	}
 	if (dbn == ip->i_num.in_addr)
 		return ip->i_bh;
 	else
-		return bread(sdp, dbn);
+		return lgfs2_bread(sdp, dbn);
 }
 
 int lgfs2_write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blocks)
@@ -192,8 +192,8 @@ int lgfs2_write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blo
 		struct gfs2_buffer_head *bh = lgfs2_get_file_buf(jnl, x, 1);
 		if (!bh)
 			return -1;
-		bmodified(bh);
-		brelse(bh);
+		lgfs2_bmodified(bh);
+		lgfs2_brelse(bh);
 	}
 	crc32c_optimization_init();
 	for (x = 0; x < blocks; x++) {
@@ -217,8 +217,8 @@ int lgfs2_write_journal(struct gfs2_inode *jnl, unsigned bsize, unsigned int blo
 
 		hash = lgfs2_log_header_crc(bh->b_data, bsize);
 		lh->lh_crc = cpu_to_be32(hash);
-		bmodified(bh);
-		brelse(bh);
+		lgfs2_bmodified(bh);
+		lgfs2_brelse(bh);
 
 		if (++seq == blocks)
 			seq = 0;
@@ -291,7 +291,7 @@ struct gfs2_inode *lgfs2_build_inum_range(struct gfs2_inode *per_node, unsigned
 
 	ip->i_size = sizeof(struct gfs2_inum_range);
 	lgfs2_dinode_out(ip, ip->i_bh->b_data);
-	bmodified(ip->i_bh);
+	lgfs2_bmodified(ip->i_bh);
 	return ip;
 }
 
@@ -308,7 +308,7 @@ struct gfs2_inode *lgfs2_build_statfs_change(struct gfs2_inode *per_node, unsign
 
 	ip->i_size = sizeof(struct gfs2_statfs_change);
 	lgfs2_dinode_out(ip, ip->i_bh->b_data);
-	bmodified(ip->i_bh);
+	lgfs2_bmodified(ip->i_bh);
 	return ip;
 }
 
@@ -343,8 +343,8 @@ struct gfs2_inode *lgfs2_build_quota_change(struct gfs2_inode *per_node, unsigne
 
 		memset(bh->b_data, 0, sdp->sd_bsize);
 		memcpy(bh->b_data, &mh, sizeof(mh));
-		bmodified(bh);
-		brelse(bh);
+		lgfs2_bmodified(bh);
+		lgfs2_brelse(bh);
 	}
 	return ip;
 }
@@ -381,7 +381,7 @@ struct gfs2_inode *lgfs2_build_rindex(struct gfs2_sbd *sdp)
 		return NULL;
 
 	ip->i_payload_format = GFS2_FORMAT_RI;
-	bmodified(ip->i_bh);
+	lgfs2_bmodified(ip->i_bh);
 
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
@@ -413,7 +413,7 @@ struct gfs2_inode *lgfs2_build_quota(struct gfs2_sbd *sdp)
 		return NULL;
 
 	ip->i_payload_format = GFS2_FORMAT_QU;
-	bmodified(ip->i_bh);
+	lgfs2_bmodified(ip->i_bh);
 
 	memset(&qu, 0, sizeof(struct gfs2_quota));
 	qu.qu_value = cpu_to_be64(1);
gfs2/libgfs2/super.c +5 -5
index 8dfeee57..119f1cd0 100644
@@ -65,18 +65,18 @@ int read_sb(struct gfs2_sbd *sdp)
 	unsigned int x;
 	int ret;
 
-	bh = bread(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
+	bh = lgfs2_bread(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
 
 	ret = check_sb(bh->b_data);
 	if (ret < 0) {
-		brelse(bh);
+		lgfs2_brelse(bh);
 		return ret;
 	}
 	if (ret == 1)
 		sdp->gfs1 = 1;
 
 	lgfs2_sb_in(sdp, bh->b_data);
-	brelse(bh);
+	lgfs2_brelse(bh);
 	sdp->sd_fsb2bb_shift = sdp->sd_bsize_shift - GFS2_BASIC_BLOCK_SHIFT;
 	if (sdp->sd_bsize < 512 || sdp->sd_bsize != (sdp->sd_bsize & -sdp->sd_bsize)) {
 		return -1;
@@ -184,9 +184,9 @@ static int good_on_disk(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 	struct gfs2_buffer_head *bh;
 	int is_rgrp;
 
-	bh = bread(sdp, rgd->rt_addr);
+	bh = lgfs2_bread(sdp, rgd->rt_addr);
 	is_rgrp = (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_RG) == 0);
-	brelse(bh);
+	lgfs2_brelse(bh);
 	return is_rgrp;
 }
 
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/21 libgfs2: Namespace improvements - fs_ops.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/convert/gfs2_convert.c   | 100 ++++++++++-----------
 gfs2/edit/extended.c          |  24 ++---
 gfs2/edit/hexedit.c           |   8 +-
 gfs2/edit/journal.c           |  10 +--
 gfs2/edit/savemeta.c          |   6 +-
 gfs2/fsck/afterpass1_common.c |   2 +-
 gfs2/fsck/fs_recovery.c       |  24 ++---
 gfs2/fsck/initialize.c        |  82 ++++++++---------
 gfs2/fsck/lost_n_found.c      |  14 +--
 gfs2/fsck/main.c              |  22 ++---
 gfs2/fsck/metawalk.c          |   6 +-
 gfs2/fsck/pass1.c             |  28 +++---
 gfs2/fsck/pass2.c             |  46 +++++-----
 gfs2/fsck/pass3.c             |   4 +-
 gfs2/fsck/rgrepair.c          |  10 +--
 gfs2/fsck/util.c              |   2 +-
 gfs2/glocktop/glocktop.c      |   8 +-
 gfs2/libgfs2/fs_ops.c         | 161 +++++++++++++++++-----------------
 gfs2/libgfs2/gfs1.c           |   8 +-
 gfs2/libgfs2/gfs2l.c          |   6 +-
 gfs2/libgfs2/lang.c           |   6 +-
 gfs2/libgfs2/libgfs2.h        |  55 ++++++------
 gfs2/libgfs2/recovery.c       |   4 +-
 gfs2/libgfs2/rgrp.c           |   2 +-
 gfs2/libgfs2/structures.c     |  52 +++++------
 gfs2/libgfs2/super.c          |   2 +-
 gfs2/mkfs/main_mkfs.c         |  24 ++---
 tests/nukerg.c                |   8 +-
 28 files changed, 361 insertions(+), 363 deletions(-)
gfs2/convert/gfs2_convert.c +50 -50
index 5bfe8acd..bef0cf6f 100644
@@ -183,7 +183,7 @@ static int convert_rgs(struct gfs2_sbd *sbp)
 /* ------------------------------------------------------------------------- */
 /* calc_gfs2_tree_height - calculate new dinode height as if this is gfs2    */
 /*                                                                           */
-/* This is similar to calc_tree_height in libgfs2 but at the point this      */
+/* This is similar to lgfs2_calc_tree_height in libgfs2 but at the point this      */
 /* function is called, I have the wrong (gfs1 not gfs2) constants in place.  */
 /* ------------------------------------------------------------------------- */
 static unsigned int calc_gfs2_tree_height(struct gfs2_inode *ip, uint64_t size)
@@ -254,7 +254,7 @@ static void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 
 /* ------------------------------------------------------------------------- */
 /* fix_metatree - Fix up the metatree to match the gfs2 metapath info        */
-/*                Similar to gfs2_writei in libgfs2 but we're only           */
+/*                Similar to lgfs2_writei in libgfs2 but we're only           */
 /*                interested in rearranging the metadata while leaving the   */
 /*                actual data blocks intact.                                 */
 /* ------------------------------------------------------------------------- */
@@ -273,7 +273,7 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 	mh.mh_type = cpu_to_be32(GFS2_METATYPE_IN);
 	mh.mh_format = cpu_to_be32(GFS2_FORMAT_IN);
 	if (!ip->i_height)
-		unstuff_dinode(ip);
+		lgfs2_unstuff_dinode(ip);
 
 	ptramt = blk->mp.mp_list[blk->height] * sizeof(uint64_t);
 	amount = size;
@@ -283,7 +283,7 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 		/* First, build up the metatree */
 		for (h = 0; h < blk->height; h++) {
 			new = 0;
-			lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
+			lgfs2_lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
 			if (bh != ip->i_bh)
 				lgfs2_brelse(bh);
 			if (!block)
@@ -431,7 +431,7 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 	mh.mh_format = cpu_to_be32(GFS2_FORMAT_IN);
 
 	if (!ip->i_height)
-		unstuff_dinode(ip);
+		lgfs2_unstuff_dinode(ip);
 
 	ptramt = blk->mp.mp_list[blk->height];
 	amount = size;
@@ -441,7 +441,7 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 		/* First, build up the metatree */
 		for (h = 0; h < blk->height; h++) {
 			new = 0;
-			lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
+			lgfs2_lookup_block(ip, bh, h, &blk->mp, 1, &new, &block);
 			if (bh != ip->i_bh)
 				lgfs2_brelse(bh);
 			if (!block)
@@ -563,7 +563,7 @@ static int get_inode_metablocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip, str
 			/* Free the block so we can reuse it. This allows us to
 			   convert a "full" file system. */
 			ip->i_blocks--;
-			gfs2_free_block(sbp, block);
+			lgfs2_free_block(sbp, block);
 		}
 	}
 	return 0;
@@ -665,7 +665,7 @@ static int fix_ind_jdata(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint32_t d
 		/* Free the block so we can reuse it. This allows us to
 		   convert a "full" file system */
 		ip->i_blocks--;
-		gfs2_free_block(sbp, block);
+		lgfs2_free_block(sbp, block);
 
 		len = bufsize;
 		jdata_mp_gfs1_to_gfs2(sbp, di_height, gfs2_hgt, &newblk->mp, &gfs2mp,
@@ -941,11 +941,11 @@ static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
 	}
 
 	lgfs2_bmodified(inode->i_bh);
-	inode_put(&inode); /* does gfs2_dinode_out if modified */
+	lgfs2_inode_put(&inode); /* does gfs2_dinode_out if modified */
 	sbp->md.next_inum++; /* update inode count */
 	return 0;
 err_freei:
-	inode_put(&inode);
+	lgfs2_inode_put(&inode);
 	return -1;
 } /* adjust_inode */
 
@@ -1112,7 +1112,7 @@ static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
 	if (eablk)
 		*eablk = fix_inode->i_eattr;
 
-	inode_put(&fix_inode);
+	lgfs2_inode_put(&fix_inode);
 	return 0;
 }/* fetch_inum */
 
@@ -1131,7 +1131,7 @@ static int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
 	struct gfs2_dirent *dent;
 	int de; /* directory entry index */
 	
-	error = gfs2_dirent_first(dip, bh, &dent);
+	error = lgfs2_dirent_first(dip, bh, &dent);
 	if (error != IS_LEAF && error != IS_DINODE) {
 		log_crit(_("Error retrieving directory.\n"));
 		return -1;
@@ -1226,7 +1226,7 @@ static int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
 		}
 
 	skip_next:
-		error = gfs2_dirent_next(dip, bh, &dent);
+		error = lgfs2_dirent_next(dip, bh, &dent);
 		if (error) {
 			if (error == -ENOENT) /* beyond the end of this bh */
 				error = 0;
@@ -1257,7 +1257,7 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip
 		struct gfs2_leaf *leaf;
 		__be64 buf;
 
-		error = gfs2_readi(dip, (char *)&buf, leaf_num * sizeof(uint64_t),
+		error = lgfs2_readi(dip, (char *)&buf, leaf_num * sizeof(uint64_t),
 						   sizeof(uint64_t));
 		if (!error) /* end of file */
 			return 0; /* success */
@@ -1276,7 +1276,7 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip
 
 		prev_leaf_block = leaf_block;
 		/* read the leaf buffer in */
-		error = gfs2_get_leaf(dip, leaf_block, &bh_leaf);
+		error = lgfs2_get_leaf(dip, leaf_block, &bh_leaf);
 		if (error) {
 			log_crit(_("Error reading leaf %"PRIu64"\n"), leaf_block);
 			break;
@@ -1308,19 +1308,19 @@ static int process_directory(struct gfs2_sbd *sbp, uint64_t dirblock, uint64_t d
 	if (dip->i_flags & GFS2_DIF_EXHASH) {
 		if (fix_one_directory_exhash(sbp, dip, dentmod)) {
 			log_crit(_("Error fixing exhash directory.\n"));
-			inode_put(&dip);
+			lgfs2_inode_put(&dip);
 			return -1;
 		}
 	} else {
 		error = process_dirent_info(dip, sbp, dip->i_bh, dip->i_entries, dentmod);
 		if (error && error != -EISDIR) {
 			log_crit(_("Error fixing linear directory.\n"));
-			inode_put(&dip);
+			lgfs2_inode_put(&dip);
 			return -1;
 		}
 	}
 	lgfs2_bmodified(dip->i_bh);
-	inode_put(&dip);
+	lgfs2_inode_put(&dip);
 	return 0;
 }
 /* ------------------------------------------------------------------------- */
@@ -1404,7 +1404,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
 		}
 
 		/* initialize the symlink inode to be a directory */
-		error = init_dinode(sbp, &bh, &fix, S_IFDIR | 0755, 0, &dir);
+		error = lgfs2_init_dinode(sbp, &bh, &fix, S_IFDIR | 0755, 0, &dir);
 		if (error != 0)
 			return -1;
 
@@ -1412,7 +1412,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
 		if (fix_inode == NULL)
 			return -1;
 		fix_inode->i_eattr = eablk; /*fix extended attribute */
-		inode_put(&fix_inode);
+		lgfs2_inode_put(&fix_inode);
 		lgfs2_bmodified(bh);
 		lgfs2_brelse(bh);
 
@@ -1455,7 +1455,7 @@ static int read_gfs1_jiindex(struct gfs2_sbd *sdp)
 		return -1;
 	}
 	/* ugly hack
-	 * Faking the gfs1_jindex inode as a directory to gfs2_readi
+	 * Faking the gfs1_jindex inode as a directory to lgfs2_readi
 	 * so it skips the metaheader struct in the data blocks
 	 * in the inode. gfs2_jindex inode doesn't have metaheaders
 	 * in the data blocks */
@@ -1465,7 +1465,7 @@ static int read_gfs1_jiindex(struct gfs2_sbd *sdp)
 	for (j = 0; ; j++) {
 		uint32_t nseg;
 
-		error = gfs2_readi(ip, buf, j * sizeof(struct gfs_jindex),
+		error = lgfs2_readi(ip, buf, j * sizeof(struct gfs_jindex),
 						   sizeof(struct gfs_jindex));
 		if(!error)
 			break;
@@ -1674,8 +1674,8 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
 	}
 	printf("\n");
 	fflush(stdout);
-	inode_put(&sbp->md.riinode);
-	inode_put(&sbp->md.jiinode);
+	lgfs2_inode_put(&sbp->md.riinode);
+	lgfs2_inode_put(&sbp->md.jiinode);
 	log_debug(_("%d rgs found.\n"), rgcount);
 	return 0;
 }/* fill_super_block */
@@ -1901,7 +1901,7 @@ static void update_inode_file(struct gfs2_sbd *sdp)
 	int count;
 
 	buf = cpu_to_be64(sdp->md.next_inum);
-	count = gfs2_writei(ip, &buf, 0, sizeof(uint64_t));
+	count = lgfs2_writei(ip, &buf, 0, sizeof(uint64_t));
 	if (count != sizeof(uint64_t)) {
 		fprintf(stderr, "update_inode_file\n");
 		exit(1);
@@ -1923,7 +1923,7 @@ static void write_statfs_file(struct gfs2_sbd *sdp)
 	sc.sc_free = cpu_to_be64(sdp->blks_total - sdp->blks_alloced);
 	sc.sc_dinodes = cpu_to_be64(sdp->dinodes_alloced);
 
-	count = gfs2_writei(ip, &sc, 0, sizeof(sc));
+	count = lgfs2_writei(ip, &sc, 0, sizeof(sc));
 	if (count != sizeof(sc)) {
 		fprintf(stderr, "Failed to write statfs file\n");
 		exit(1);
@@ -1941,19 +1941,19 @@ static void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
 	fflush(stdout);
 	/* Delete the old gfs1 Journal index: */
 	lgfs2_inum_in(&inum, &gfs1_sb.sb_jindex_di);
-	gfs2_freedi(sbp, inum.in_addr);
+	lgfs2_freedi(sbp, inum.in_addr);
 
 	/* Delete the old gfs1 rgindex: */
 	lgfs2_inum_in(&inum, &gfs1_sb.sb_rindex_di);
-	gfs2_freedi(sbp, inum.in_addr);
+	lgfs2_freedi(sbp, inum.in_addr);
 
 	/* Delete the old gfs1 Quota file: */
 	lgfs2_inum_in(&inum, &gfs1_sb.sb_quota_di);
-	gfs2_freedi(sbp, inum.in_addr);
+	lgfs2_freedi(sbp, inum.in_addr);
 
 	/* Delete the old gfs1 License file: */
 	lgfs2_inum_in(&inum, &gfs1_sb.sb_license_di);
-	gfs2_freedi(sbp, inum.in_addr);
+	lgfs2_freedi(sbp, inum.in_addr);
 }
 
 /* ------------------------------------------------------------------------- */
@@ -1963,7 +1963,7 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
 {
 	unsigned int j;
 
-	sdp->md.jiinode = createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
+	sdp->md.jiinode = lgfs2_createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
 				  GFS2_DIF_SYSTEM);
 	if (sdp->md.jiinode == NULL) {
 		return errno;
@@ -1980,17 +1980,17 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
 		printf(_("Writing journal #%d..."), j + 1);
 		fflush(stdout);
 		sprintf(name, "journal%u", j);
-		sdp->md.journal[j] = createi(sdp->md.jiinode, name, S_IFREG |
+		sdp->md.journal[j] = lgfs2_createi(sdp->md.jiinode, name, S_IFREG |
 					     0600, GFS2_DIF_SYSTEM);
 		lgfs2_write_journal(sdp->md.journal[j], sdp->sd_bsize,
 		                    sdp->jsize << 20 >> sdp->sd_bsize_shift);
-		inode_put(&sdp->md.journal[j]);
+		lgfs2_inode_put(&sdp->md.journal[j]);
 		printf(_("done.\n"));
 		fflush(stdout);
 	}
 
 	free(sdp->md.journal);
-	inode_put(&sdp->md.jiinode);
+	lgfs2_inode_put(&sdp->md.jiinode);
 	return 0;
 }
 
@@ -2091,7 +2091,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
 	struct gfs2_inode *per_node;
 	unsigned int j;
 
-	per_node = createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
+	per_node = lgfs2_createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
 			   GFS2_DIF_SYSTEM);
 	if (per_node == NULL) {
 		log_crit(_("Error building '%s': %s\n"), "per_node", strerror(errno));
@@ -2106,7 +2106,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
 			         strerror(errno));
 			return 1;
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 
 		ip = lgfs2_build_statfs_change(per_node, j);
 		if (ip == NULL) {
@@ -2114,7 +2114,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
 			         strerror(errno));
 			return 1;
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 
 		ip = lgfs2_build_quota_change(per_node, j);
 		if (ip == NULL) {
@@ -2122,9 +2122,9 @@ static int build_per_node(struct gfs2_sbd *sdp)
 			         strerror(errno));
 			return 1;
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 	}
-	inode_put(&per_node);
+	lgfs2_inode_put(&per_node);
 	return 0;
 }
 
@@ -2139,7 +2139,7 @@ static void copy_quotas(struct gfs2_sbd *sdp)
 	struct gfs2_inode *oq_ip, *nq_ip;
 	int err;
 
-	err = gfs2_lookupi(sdp->master_dir, "quota", 5, &nq_ip);
+	err = lgfs2_lookupi(sdp->master_dir, "quota", 5, &nq_ip);
 	if (err) {
 		fprintf(stderr, _("Couldn't lookup new quota file: %d\n"), err);
 		exit(1);
@@ -2163,10 +2163,10 @@ static void copy_quotas(struct gfs2_sbd *sdp)
 	oq_ip->i_size = 0;
 
 	lgfs2_bmodified(nq_ip->i_bh);
-	inode_put(&nq_ip);
+	lgfs2_inode_put(&nq_ip);
 
 	lgfs2_bmodified(oq_ip->i_bh);
-	inode_put(&oq_ip);
+	lgfs2_inode_put(&oq_ip);
 }
 
 static int gfs2_query(struct gfs2_options *opts, const char *dev)
@@ -2314,7 +2314,7 @@ int main(int argc, char **argv)
 			log_notice(_("Reduced journal size to %u MB to accommodate "
 				   "GFS2 file system structures.\n"), sb2.jsize);
 		/* Build the master subdirectory. */
-		lgfs2_build_master(&sb2); /* Does not do inode_put */
+		lgfs2_build_master(&sb2); /* Does not do lgfs2_inode_put */
 		sb2.sd_meta_dir = sb2.master_dir->i_num;
 		/* Build empty journal index file. */
 		error = conv_build_jindex(&sb2);
@@ -2331,14 +2331,14 @@ int main(int argc, char **argv)
 			exit(-1);
 		}
 		/* Create the empty inode number file */
-		sb2.md.inum = lgfs2_build_inum(&sb2); /* Does not do inode_put */
+		sb2.md.inum = lgfs2_build_inum(&sb2); /* Does not do lgfs2_inode_put */
 		if (sb2.md.inum == NULL) {
 			log_crit(_("Error building inum inode: %s\n"),
 			         strerror(error));
 			exit(-1);
 		}
 		/* Create the statfs file */
-		sb2.md.statfs = lgfs2_build_statfs(&sb2); /* Does not do inode_put */
+		sb2.md.statfs = lgfs2_build_statfs(&sb2); /* Does not do lgfs2_inode_put */
 		if (sb2.md.statfs == NULL) {
 			log_crit(_("Error building statfs inode: %s\n"),
 			         strerror(error));
@@ -2353,7 +2353,7 @@ int main(int argc, char **argv)
 			         strerror(errno));
 			exit(-1);
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 		/* Create the quota file */
 		ip = lgfs2_build_quota(&sb2);
 		if (ip == NULL) {
@@ -2361,7 +2361,7 @@ int main(int argc, char **argv)
 			         strerror(error));
 			exit(-1);
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 
 		/* Copy out the master dinode */
 		if (sb2.master_dir->i_bh->b_modified)
@@ -2375,9 +2375,9 @@ int main(int argc, char **argv)
 
 		write_statfs_file(&sb2);
 
-		inode_put(&sb2.master_dir);
-		inode_put(&sb2.md.inum);
-		inode_put(&sb2.md.statfs);
+		lgfs2_inode_put(&sb2.master_dir);
+		lgfs2_inode_put(&sb2.md.inum);
+		lgfs2_inode_put(&sb2.md.statfs);
 
 		fsync(sb2.device_fd); /* write the buffers to disk */
 
gfs2/edit/extended.c +12 -12
index 89720a53..ee410220 100644
@@ -433,7 +433,7 @@ static int print_gfs_jindex(struct gfs2_inode *dij)
 	eol(0);
 	lines_per_row[dmode] = 4;
 	for (print_entry_ndx=0; ; print_entry_ndx++) {
-		error = gfs2_readi(dij, (void *)&jbuf,
+		error = lgfs2_readi(dij, (void *)&jbuf,
 				   print_entry_ndx*sizeof(struct gfs_jindex),
 				   sizeof(struct gfs_jindex));
 		ji = (struct gfs_jindex *)jbuf;
@@ -484,7 +484,7 @@ static int print_gfs2_jindex(void)
 				print_gfs2("dirty.");
 		}
 		eol(0);
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 	}
 	return 0;
 }
@@ -508,7 +508,7 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex)
 
 		roff = print_entry_ndx * sizeof(struct gfs2_rindex);
 
-		error = gfs2_readi(dip, &ri, roff, sizeof(struct gfs2_rindex));
+		error = lgfs2_readi(dip, &ri, roff, sizeof(struct gfs2_rindex));
 		if (!error) /* end of file */
 			break;
 		lgfs2_rindex_in(&rg, &ri);
@@ -556,7 +556,7 @@ static int print_inum(struct gfs2_inode *dii)
 	__be64 inum;
 	int rc;
 	
-	rc = gfs2_readi(dii, (void *)&inum, 0, sizeof(inum));
+	rc = lgfs2_readi(dii, (void *)&inum, 0, sizeof(inum));
 	if (!rc) {
 		print_gfs2("The inum file is empty.");
 		eol(0);
@@ -578,7 +578,7 @@ static int print_statfs(struct gfs2_inode *dis)
 	struct gfs2_statfs_change sc;
 	int rc;
 
-	rc = gfs2_readi(dis, (void *)&sc, 0, sizeof(sc));
+	rc = lgfs2_readi(dis, (void *)&sc, 0, sizeof(sc));
 	if (!rc) {
 		print_gfs2("The statfs file is empty.");
 		eol(0);
@@ -605,7 +605,7 @@ static int print_quota(struct gfs2_inode *diq)
 	print_gfs2("quota entries found: %"PRIu64".", diq->i_size / sizeof(q));
 	eol(0);
 	for (i=0; ; i++) {
-		error = gfs2_readi(diq, &q, i * sizeof(q), sizeof(q));
+		error = lgfs2_readi(diq, &q, i * sizeof(q), sizeof(q));
 		if (!error)
 			break;
 		if (error != sizeof(q)) {
@@ -633,7 +633,7 @@ int display_extended(void)
 		if (tmp_inode == NULL)
 			return -1;
 		parse_rindex(tmp_inode, TRUE);
-		inode_put(&tmp_inode);
+		lgfs2_inode_put(&tmp_inode);
 		lgfs2_brelse(tmp_bh);
 	} else if (block_is_journals(block)) {
 		if (sbd.gfs1)
@@ -655,7 +655,7 @@ int display_extended(void)
 		if (tmp_inode == NULL)
 			return -1;
 		parse_rindex(tmp_inode, FALSE);
-		inode_put(&tmp_inode);
+		lgfs2_inode_put(&tmp_inode);
 		lgfs2_brelse(tmp_bh);
 	} else if (block_is_jindex(block)) {
 		tmp_bh = lgfs2_bread(&sbd, block);
@@ -663,7 +663,7 @@ int display_extended(void)
 		if (tmp_inode == NULL)
 			return -1;
 		print_gfs_jindex(tmp_inode);
-		inode_put(&tmp_inode);
+		lgfs2_inode_put(&tmp_inode);
 		lgfs2_brelse(tmp_bh);
 	}
 	else if (block_is_inum_file(block)) {
@@ -672,7 +672,7 @@ int display_extended(void)
 		if (tmp_inode == NULL)
 			return -1;
 		print_inum(tmp_inode);
-		inode_put(&tmp_inode);
+		lgfs2_inode_put(&tmp_inode);
 		lgfs2_brelse(tmp_bh);
 	}
 	else if (block_is_statfs_file(block)) {
@@ -681,7 +681,7 @@ int display_extended(void)
 		if (tmp_inode == NULL)
 			return -1;
 		print_statfs(tmp_inode);
-		inode_put(&tmp_inode);
+		lgfs2_inode_put(&tmp_inode);
 		lgfs2_brelse(tmp_bh);
 	}
 	else if (block_is_quota_file(block)) {
@@ -690,7 +690,7 @@ int display_extended(void)
 		if (tmp_inode == NULL)
 			return -1;
 		print_quota(tmp_inode);
-		inode_put(&tmp_inode);
+		lgfs2_inode_put(&tmp_inode);
 		lgfs2_brelse(tmp_bh);
 	}
 	return 0;
gfs2/edit/hexedit.c +4 -4
index 5521bf30..22e70830 100644
@@ -692,7 +692,7 @@ static void rgcount(void)
 {
 	printf("%"PRId64" RGs in this file system.\n",
 	       sbd.md.riinode->i_size / sizeof(struct gfs2_rindex));
-	inode_put(&sbd.md.riinode);
+	lgfs2_inode_put(&sbd.md.riinode);
 	gfs2_rgrp_free(&sbd, &sbd.rgtree);
 	exit(EXIT_SUCCESS);
 }
@@ -715,7 +715,7 @@ static uint64_t find_rgrp_block(struct gfs2_inode *dif, int rg)
 			sizeof(struct gfs2_meta_header);
 		gfs1_adj += sizeof(struct gfs2_meta_header);
 	}
-	amt = gfs2_readi(dif, &ri, foffset + gfs1_adj, sizeof(ri));
+	amt = lgfs2_readi(dif, &ri, foffset + gfs1_adj, sizeof(ri));
 	if (!amt) /* end of file */
 		return 0;
 	return be64_to_cpu(ri.ri_addr);
@@ -741,7 +741,7 @@ static uint64_t get_rg_addr(int rgnum)
 	else
 		fprintf(stderr, "Error: File system only has %"PRId64" RGs.\n",
 			riinode->i_size / sizeof(struct gfs2_rindex));
-	inode_put(&riinode);
+	lgfs2_inode_put(&riinode);
 	return rgblk;
 }
 
@@ -925,7 +925,7 @@ static void read_superblock(int fd)
 		if (sbd.master_dir == NULL) {
 			sbd.md.riinode = NULL;
 		} else {
-			gfs2_lookupi(sbd.master_dir, "rindex", 6, &sbd.md.riinode);
+			lgfs2_lookupi(sbd.master_dir, "rindex", 6, &sbd.md.riinode);
 		}
 	}
 	lgfs2_brelse(bh);
gfs2/edit/journal.c +5 -5
index 29986c3e..91d0a925 100644
@@ -60,14 +60,14 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
 		jiinode = lgfs2_inode_get(&sbd, jindex_bh);
 		if (jiinode == NULL)
 			return 0;
-		amtread = gfs2_readi(jiinode, &jidx,
+		amtread = lgfs2_readi(jiinode, &jidx,
 				   journal_num * sizeof(struct gfs_jindex),
 				   sizeof(struct gfs_jindex));
 		if (amtread) {
 			jblock = be64_to_cpu(jidx.ji_addr);
 			*j_size = (uint64_t)be32_to_cpu(jidx.ji_nsegment) * 0x10;
 		}
-		inode_put(&jiinode);
+		lgfs2_inode_put(&jiinode);
 	} else {
 		struct gfs2_dinode *jdi;
 
@@ -99,7 +99,7 @@ static void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
 }
 
 /**
- * fsck_readi - same as libgfs2's gfs2_readi, but sets absolute block #
+ * fsck_readi - same as libgfs2's lgfs2_readi, but sets absolute block #
  *              of the first bit of data read.
  */
 static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
@@ -144,7 +144,7 @@ static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
 		if (amount > sdp->sd_bsize - o)
 			amount = sdp->sd_bsize - o;
 		if (!extlen)
-			block_map(ip, lblock, &not_new, &dblock, &extlen,
+			lgfs2_block_map(ip, lblock, &not_new, &dblock, &extlen,
 				  FALSE);
 		if (dblock) {
 			lbh = lgfs2_bread(sdp, dblock);
@@ -643,7 +643,7 @@ void dump_journal(const char *journal, uint64_t tblk)
 		}
 	}
 	if (j_inode != NULL)
-		inode_put(&j_inode);
+		lgfs2_inode_put(&j_inode);
 	lgfs2_brelse(j_bh);
 	blockhist = -1; /* So we don't print anything else */
 	free(jbuf);
gfs2/edit/savemeta.c +3 -3
index 941472aa..3b2152df 100644
@@ -278,7 +278,7 @@ static int init_per_node_lookup(void)
 	}
 
 	do_dinode_extended(per_node_di->i_bh->b_data);
-	inode_put(&per_node_di);
+	lgfs2_inode_put(&per_node_di);
 
 	for (i = 0; i < indirect_blocks; i++) {
 		int d;
@@ -956,10 +956,10 @@ static void get_journal_inode_blocks(void)
 				fprintf(stderr, "Error reading journal inode: %s\n", strerror(errno));
 				return;
 			}
-			amt = gfs2_readi(j_inode, (void *)&jbuf,
+			amt = lgfs2_readi(j_inode, (void *)&jbuf,
 					 journal * sizeof(struct gfs_jindex),
 					 sizeof(struct gfs_jindex));
-			inode_put(&j_inode);
+			lgfs2_inode_put(&j_inode);
 			if (!amt)
 				break;
 			ji = (struct gfs_jindex *)jbuf;
gfs2/fsck/afterpass1_common.c +1 -1
index 952275a0..04249e10 100644
@@ -123,7 +123,7 @@ static int remove_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 	lgfs2_dirent_in(&d, dent);
 
 	if (d.dr_inum.in_addr == *dentryblock)
-		dirent2_del(ip, bh, prev_de, dent);
+		lgfs2_dirent2_del(ip, bh, prev_de, dent);
 	else
 		(*count)++;
 
gfs2/fsck/fs_recovery.c +12 -12
index f8e4403e..6f186c92 100644
@@ -427,7 +427,7 @@ static int check_journal_seq_no(struct gfs2_inode *ip, int fix)
 		highest_seq++;
 		prev_seq = highest_seq;
 		log_warn(_("Renumbering it as 0x%"PRIx64"\n"), highest_seq);
-		block_map(ip, blk, &new, &dblock, NULL, 0);
+		lgfs2_block_map(ip, blk, &new, &dblock, NULL, 0);
 		bh = lgfs2_bread(ip->i_sbd, dblock);
 		((struct gfs2_log_header *)bh->b_data)->lh_sequence = cpu_to_be64(highest_seq);
 		lgfs2_bmodified(bh);
@@ -692,7 +692,7 @@ int replay_journals(struct gfs2_sbd *sdp, int preen, int force_check,
 			if (error)
 				/* Don't use fsck_inode_put here because it's a
 				   system file and we need to dismantle it. */
-				inode_put(&sdp->md.journal[i]);
+				lgfs2_inode_put(&sdp->md.journal[i]);
 			error = 0; /* bad journal is non-fatal */
 		}
 		if (!sdp->md.journal[i]) {
@@ -768,7 +768,7 @@ int ji_update(struct gfs2_sbd *sdp)
 		if (sdp->gfs1) {
 			struct gfs_jindex *ji;
 
-			error = gfs2_readi(ip,
+			error = lgfs2_readi(ip,
 					   buf, i * sizeof(struct gfs_jindex),
 					   sizeof(struct gfs_jindex));
 			if (!error)
@@ -786,7 +786,7 @@ int ji_update(struct gfs2_sbd *sdp)
 			/* FIXME check snprintf return code */
 			snprintf(journal_name, JOURNAL_NAME_SIZE,
 				 "journal%u", i);
-			gfs2_lookupi(sdp->md.jiinode, journal_name,
+			lgfs2_lookupi(sdp->md.jiinode, journal_name,
 				     strlen(journal_name), &jip);
 			sdp->md.journal[i] = jip;
 		}
@@ -852,7 +852,7 @@ int build_jindex(struct gfs2_sbd *sdp)
 {
 	struct gfs2_inode *jindex;
 
-	jindex = createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
+	jindex = lgfs2_createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
 			 GFS2_DIF_SYSTEM);
 	if (jindex == NULL) {
 		return errno;
@@ -862,10 +862,10 @@ int build_jindex(struct gfs2_sbd *sdp)
 		int ret = lgfs2_build_journal(sdp, j, jindex);
 		if (ret)
 			return ret;
-		inode_put(&sdp->md.journal[j]);
+		lgfs2_inode_put(&sdp->md.journal[j]);
 	}
 	free(sdp->md.journal);
-	inode_put(&jindex);
+	lgfs2_inode_put(&jindex);
 	return 0;
 }
 
@@ -884,7 +884,7 @@ int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
 	if (sdp->gfs1)
 		sdp->md.jiinode = lgfs2_inode_read(sdp, sdp->sd_jindex_di.in_addr);
 	else
-		gfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
+		lgfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
 
 	if (!sdp->md.jiinode) {
 		int err;
@@ -906,7 +906,7 @@ int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
 			log_crit(_("Error %d rebuilding jindex\n"), err);
 			return err;
 		}
-		gfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
+		lgfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
 	}
 
 	/* check for irrelevant entries in jindex. Can't use check_dir because
@@ -929,8 +929,8 @@ int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
 					   "valid jindex file.\n"));
 				return -1;
 			}
-			inode_put(&sdp->md.jiinode);
-			gfs2_dirent_del(sdp->master_dir, "jindex", 6);
+			lgfs2_inode_put(&sdp->md.jiinode);
+			lgfs2_dirent_del(sdp->master_dir, "jindex", 6);
 			log_err(_("Corrupt journal index was removed.\n"));
 			error = build_jindex(sdp);
 			if (error) {
@@ -938,7 +938,7 @@ int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
 					  "index: Cannot continue.\n"));
 				return error;
 			}
-			gfs2_lookupi(sdp->master_dir, "jindex", 6,
+			lgfs2_lookupi(sdp->master_dir, "jindex", 6,
 				     &sdp->md.jiinode);
 		}
 	}
gfs2/fsck/initialize.c +41 -41

281 lines not on this page · raw message

gfs2/fsck/lost_n_found.c +7 -7
index 65e13125..8c66bea8 100644
@@ -77,12 +77,12 @@ static void add_dotdot(struct gfs2_inode *ip)
 				    "in directory tree.\n"),
 			          ip->i_num.in_addr);
 	}
-	if (gfs2_dirent_del(ip, "..", 2))
+	if (lgfs2_dirent_del(ip, "..", 2))
 		log_warn( _("add_inode_to_lf:  Unable to remove "
 			    "\"..\" directory entry.\n"));
 
 	no = lf_dip->i_num;
-	err = dir_add(ip, "..", 2, &no, (sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
+	err = lgfs2_dir_add(ip, "..", 2, &no, (sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
 	if (err) {
 		log_crit(_("Error adding .. directory: %s\n"),
 			 strerror(errno));
@@ -103,16 +103,16 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
 	root_entries = sdp->md.rooti->i_entries;
 	log_info( _("Locating/Creating lost+found directory\n"));
 
-	/* if this is gfs1, we have to trick createi into using
+	/* if this is gfs1, we have to trick lgfs2_createi into using
 	   no_formal_ino = no_addr, so we set next_inum to the
 	   free block we're about to allocate. */
 	if (sdp->gfs1)
 		sdp->md.next_inum = find_free_blk(sdp);
 	mode = (sdp->gfs1 ? DT2IF(GFS_FILE_DIR) : S_IFDIR) | 0700;
 	if (sdp->gfs1)
-		lf_dip = gfs_createi(sdp->md.rooti, "lost+found", mode, 0);
+		lf_dip = lgfs2_gfs_createi(sdp->md.rooti, "lost+found", mode, 0);
 	else
-		lf_dip = createi(sdp->md.rooti, "lost+found",
+		lf_dip = lgfs2_createi(sdp->md.rooti, "lost+found",
 				 S_IFDIR | 0700, 0);
 	if (lf_dip == NULL) {
 		log_crit(_("Error creating lost+found: %s\n"),
@@ -120,7 +120,7 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
 		exit(FSCK_ERROR);
 	}
 
-	/* createi will have incremented the di_nlink link count for the root
+	/* lgfs2_createi will have incremented the di_nlink link count for the root
 	   directory.  We must set the nlink value in the hash table to keep
 	   them in sync so that pass4 can detect and fix any descrepancies. */
 	set_di_nlink(sdp->md.rooti);
@@ -226,7 +226,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
 	}
 
 	no = ip->i_num;
-	err = dir_add(lf_dip, tmp_name, strlen(tmp_name), &no, inode_type);
+	err = lgfs2_dir_add(lf_dip, tmp_name, strlen(tmp_name), &no, inode_type);
 	if (err) {
 		log_crit(_("Error adding directory %s: %s\n"),
 			 tmp_name, strerror(errno));
gfs2/fsck/main.c +11 -11
index 446f4f85..3c432be8 100644
@@ -167,7 +167,7 @@ static int check_statfs(struct gfs2_sbd *sdp)
 		return 0;
 	}
 	/* Read the current statfs values */
-	count = gfs2_readi(sdp->md.statfs, &sc, 0, sdp->md.statfs->i_size);
+	count = lgfs2_readi(sdp->md.statfs, &sc, 0, sdp->md.statfs->i_size);
 	if (count != sizeof(struct gfs2_statfs_change)) {
 		log_err(_("Failed to read statfs values (%d of %"PRIu64" read)\n"),
 		        count, sdp->md.statfs->i_size);
@@ -328,22 +328,22 @@ int main(int argc, char **argv)
 
 	/* Free up our system inodes */
 	if (!sdp->gfs1)
-		inode_put(&sdp->md.inum);
-	inode_put(&sdp->md.statfs);
+		lgfs2_inode_put(&sdp->md.inum);
+	lgfs2_inode_put(&sdp->md.statfs);
 	for (j = 0; j < sdp->md.journals; j++)
-		inode_put(&sdp->md.journal[j]);
+		lgfs2_inode_put(&sdp->md.journal[j]);
 	free(sdp->md.journal);
 	sdp->md.journal = NULL;
-	inode_put(&sdp->md.jiinode);
-	inode_put(&sdp->md.riinode);
-	inode_put(&sdp->md.qinode);
+	lgfs2_inode_put(&sdp->md.jiinode);
+	lgfs2_inode_put(&sdp->md.riinode);
+	lgfs2_inode_put(&sdp->md.qinode);
 	if (!sdp->gfs1)
-		inode_put(&sdp->md.pinode);
-	inode_put(&sdp->md.rooti);
+		lgfs2_inode_put(&sdp->md.pinode);
+	lgfs2_inode_put(&sdp->md.rooti);
 	if (!sdp->gfs1)
-		inode_put(&sdp->master_dir);
+		lgfs2_inode_put(&sdp->master_dir);
 	if (lf_dip)
-		inode_put(&lf_dip);
+		lgfs2_inode_put(&lf_dip);
 
 	if (!opts.no && errors_corrected)
 		log_notice( _("Writing changes to disk\n"));
gfs2/fsck/metawalk.c +3 -3
index 2f0ba6c2..a5b3fe36 100644
@@ -231,7 +231,7 @@ struct gfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp, uint64_t block)
 	if (lf_dip && lf_dip->i_num.in_addr == block)
 		return lf_dip;
 	if (!sdp->gfs1)
-		return is_system_inode(sdp, block);
+		return lgfs2_is_system_inode(sdp, block);
 
 	if (sdp->md.statfs && block == sdp->md.statfs->i_num.in_addr)
 		return sdp->md.statfs;
@@ -287,7 +287,7 @@ struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 	return ip;
 }
 
-/* fsck_inode_put - same as inode_put() in libgfs2 but system inodes
+/* fsck_inode_put - same as lgfs2_inode_put() in libgfs2 but system inodes
    get special treatment. */
 void fsck_inode_put(struct gfs2_inode **ip_in)
 {
@@ -296,7 +296,7 @@ void fsck_inode_put(struct gfs2_inode **ip_in)
 
 	sysip = fsck_system_inode(ip->i_sbd, ip->i_num.in_addr);
 	if (!sysip)
-		inode_put(ip_in);
+		lgfs2_inode_put(ip_in);
 }
 
 /**
gfs2/fsck/pass1.c +14 -14
index 0e67ee35..c2d6cae4 100644
@@ -154,7 +154,7 @@ static int pass1_repair_leaf(struct gfs2_inode *ip, uint64_t *leaf_no,
 	if (ip->i_sbd->gfs1)
 		gfs1_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
 	else
-		gfs2_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
+		lgfs2_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
 	free(padbuf);
 	log_err(_("Directory Inode %"PRIu64" (0x%"PRIx64") patched.\n"),
 	        ip->i_num.in_addr, ip->i_num.in_addr);
@@ -1463,7 +1463,7 @@ static int check_system_inode(struct gfs2_sbd *sdp,
 			gfs2_blockmap_set(bl, iblock, GFS2_BLKST_FREE);
 			check_n_fix_bitmap(sdp, (*sysinode)->i_rgd, iblock, 0,
 					   GFS2_BLKST_FREE);
-			inode_put(sysinode);
+			lgfs2_inode_put(sysinode);
 		}
 	}
 	if (*sysinode) {
@@ -1490,8 +1490,8 @@ static int check_system_inode(struct gfs2_sbd *sdp,
 				   "flag. It should be rebuilt.\n"), filename);
 			if (sysdir && query(_("Delete the corrupt %s system "
 					      "inode? (y/n) "), filename)) {
-				inode_put(sysinode);
-				gfs2_dirent_del(sysdir, filename,
+				lgfs2_inode_put(sysinode);
+				lgfs2_dirent_del(sysdir, filename,
 						strlen(filename));
 				/* Set the blockmap (but not bitmap) back to
 				   'free' so that it gets checked like any
@@ -1567,7 +1567,7 @@ static int build_a_journal(struct gfs2_sbd *sdp)
 
 	/* First, try to delete the journal if it's in jindex */
 	sprintf(name, "journal%u", sdp->md.journals);
-	gfs2_dirent_del(sdp->md.jiinode, name, strlen(name));
+	lgfs2_dirent_del(sdp->md.jiinode, name, strlen(name));
 	/* Now rebuild it */
 	err = lgfs2_build_journal(sdp, sdp->md.journals, sdp->md.jiinode);
 	if (err) {
@@ -1582,7 +1582,7 @@ int build_per_node(struct gfs2_sbd *sdp)
 	struct gfs2_inode *per_node;
 	unsigned int j;
 
-	per_node = createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
+	per_node = lgfs2_createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
 			   GFS2_DIF_SYSTEM);
 	if (per_node == NULL) {
 		log_err(_("Error building '%s': %s\n"), "per_node", strerror(errno));
@@ -1597,7 +1597,7 @@ int build_per_node(struct gfs2_sbd *sdp)
 			        strerror(errno));
 			return 1;
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 
 		ip = lgfs2_build_statfs_change(per_node, j);
 		if (ip == NULL) {
@@ -1605,7 +1605,7 @@ int build_per_node(struct gfs2_sbd *sdp)
 			        strerror(errno));
 			return 1;
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 
 		ip = lgfs2_build_quota_change(per_node, j);
 		if (ip == NULL) {
@@ -1613,9 +1613,9 @@ int build_per_node(struct gfs2_sbd *sdp)
 			        strerror(errno));
 			return 1;
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 	}
-	inode_put(&per_node);
+	lgfs2_inode_put(&per_node);
 	return 0;
 }
 
@@ -1624,7 +1624,7 @@ static int build_inum(struct gfs2_sbd *sdp)
 	struct gfs2_inode *ip = lgfs2_build_inum(sdp);
 	if (ip == NULL)
 		return -1;
-	inode_put(&ip);
+	lgfs2_inode_put(&ip);
 	return 0;
 }
 
@@ -1633,7 +1633,7 @@ static int build_statfs(struct gfs2_sbd *sdp)
 	struct gfs2_inode *ip = lgfs2_build_statfs(sdp);
 	if (ip == NULL)
 		return -1;
-	inode_put(&ip);
+	lgfs2_inode_put(&ip);
 	return 0;
 }
 
@@ -1642,7 +1642,7 @@ static int build_rindex(struct gfs2_sbd *sdp)
 	struct gfs2_inode *ip = lgfs2_build_rindex(sdp);
 	if (ip == NULL)
 		return -1;
-	inode_put(&ip);
+	lgfs2_inode_put(&ip);
 	return 0;
 }
 
@@ -1651,7 +1651,7 @@ static int build_quota(struct gfs2_sbd *sdp)
 	struct gfs2_inode *ip = lgfs2_build_quota(sdp);
 	if (ip == NULL)
 		return -1;
-	inode_put(&ip);
+	lgfs2_inode_put(&ip);
 	return 0;
 }
 
gfs2/fsck/pass2.c +23 -23

176 lines not on this page · raw message

gfs2/fsck/pass3.c +2 -2
index fce3c7f9..e2e20483 100644
@@ -36,12 +36,12 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
 	 * '..' entry for this directory in
 	 * this case? */
 
-	if (gfs2_dirent_del(ip, filename, filename_len))
+	if (lgfs2_dirent_del(ip, filename, filename_len))
 		log_warn( _("Unable to remove \"..\" directory entry.\n"));
 	else
 		decr_link_count(olddotdot, block, sdp->gfs1, _("old \"..\""));
 	no = pip->i_num;
-	err = dir_add(ip, filename, filename_len, &no,
+	err = lgfs2_dir_add(ip, filename, filename_len, &no,
 		      (sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
 	if (err) {
 		log_err(_("Error adding directory %s: %s\n"),
gfs2/fsck/rgrepair.c +5 -5
index 5dddaefb..825a6398 100644
@@ -64,7 +64,7 @@ static void find_journaled_rgs(struct gfs2_sbd *sdp)
 		jblocks = ip->i_size / sdp->sd_bsize;
 		false_count = 0;
 		for (b = 0; b < jblocks; b++) {
-			block_map(ip, b, &new, &dblock, NULL, 0);
+			lgfs2_block_map(ip, b, &new, &dblock, NULL, 0);
 			if (!dblock)
 				break;
 			bh = lgfs2_bread(sdp, dblock);
@@ -234,7 +234,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
 		struct gfs2_rindex ri;
 
 		/* read in the second RG index entry for this subd. */
-		gfs2_readi(sdp->md.riinode, &ri, sizeof(ri), sizeof(ri));
+		lgfs2_readi(sdp->md.riinode, &ri, sizeof(ri), sizeof(ri));
 
 		if (be64_to_cpu(ri.ri_addr) > LGFS2_SB_ADDR(sdp) + 1) { /* sanity check */
 			log_warn( _("rgrp 2 is damaged: getting dist from index: "));
@@ -681,8 +681,8 @@ static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
 	error = 0;
 out:
 	for (j = 0; j < sdp->md.journals; j++)
-		inode_put(&sdp->md.journal[j]);
-	inode_put(&sdp->md.jiinode);
+		lgfs2_inode_put(&sdp->md.journal[j]);
+	lgfs2_inode_put(&sdp->md.jiinode);
 	free(sdp->md.journal);
 	return error;
 }
@@ -1143,7 +1143,7 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
 		if (rindex_modified) {
 			if (query( _("Fix the index? (y/n)"))) {
 				lgfs2_rindex_out(expected, (char *)&buf);
-				gfs2_writei(sdp->md.riinode, (char *)&buf,
+				lgfs2_writei(sdp->md.riinode, (char *)&buf,
 					    rg * sizeof(struct gfs2_rindex),
 					    sizeof(struct gfs2_rindex));
 				actual->rt_addr = expected->rt_addr;
gfs2/fsck/util.c +1 -1
index f4d137ed..549c087b 100644
@@ -578,7 +578,7 @@ __be64 *get_dir_hash(struct gfs2_inode *ip)
 	if (tbl == NULL)
 		return NULL;
 
-	ret = gfs2_readi(ip, tbl, 0, hsize);
+	ret = lgfs2_readi(ip, tbl, 0, hsize);
 	if (ret != hsize) {
 		free(tbl);
 		return NULL;
gfs2/glocktop/glocktop.c +4 -4
index 9fc7bc64..130cc8a9 100644
@@ -630,15 +630,15 @@ static const char *show_inode(const char *id, int fd, uint64_t block)
 		subdepth++;
 		/* Backtrack the directory to its source */
 		while (1) {
-			error = gfs2_lookupi(ip, "..", 2, &parent);
+			error = lgfs2_lookupi(ip, "..", 2, &parent);
 			if (error)
 				break;
 			/* Stop at the root inode */
 			if (ip->i_num.in_addr == parent->i_num.in_addr) {
-				inode_put(&parent);
+				lgfs2_inode_put(&parent);
 				break;
 			}
-			inode_put(&ip);
+			lgfs2_inode_put(&ip);
 			ip = parent;
 			dirarray[subdepth++] = parent->i_num.in_addr;
 		}
@@ -657,7 +657,7 @@ static const char *show_inode(const char *id, int fd, uint64_t block)
 		inode_type = "socket ";
 	} else
 		inode_type = "file? ";
-	inode_put(&ip);
+	lgfs2_inode_put(&ip);
 	return inode_type;
 }
 
gfs2/libgfs2/fs_ops.c +80 -81

542 lines not on this page · raw message

gfs2/libgfs2/gfs1.c +4 -4
index 79da01a4..5cee3df8 100644
@@ -95,15 +95,15 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 
 	bsize = (fs_is_jdata(ip)) ? sdp->sd_jbsize : sdp->sd_bsize;
 
-	height = calc_tree_height(ip, (lblock + 1) * bsize);
+	height = lgfs2_calc_tree_height(ip, (lblock + 1) * bsize);
 	if (ip->i_height < height) {
 		if (!create)
 			return;
 
-		build_height(ip, height);
+		lgfs2_build_height(ip, height);
 	}
 
-	find_metapath(ip, lblock, &mp);
+	lgfs2_find_metapath(ip, lblock, &mp);
 	end_of_metadata = ip->i_height - 1;
 
 	bh = ip->i_bh;
@@ -181,7 +181,7 @@ int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
 
 	if (!ip->i_height && /* stuffed */
 	    ((start + size) > (sdp->sd_bsize - sizeof(struct gfs_dinode))))
-		unstuff_dinode(ip);
+		lgfs2_unstuff_dinode(ip);
 
 	if (journaled) {
 		lblock = offset / sdp->sd_jbsize;
gfs2/libgfs2/gfs2l.c +3 -3
index cc4f94fc..12862507 100644
@@ -139,7 +139,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
 	}
 
 	sdp->master_dir = lgfs2_inode_read(sdp, sdp->sd_meta_dir.in_addr);
-	gfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
+	lgfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
 	sdp->fssize = sdp->device.length;
 	if (sdp->md.riinode) {
 		rindex_read(sdp, &count, &ok);
@@ -191,8 +191,8 @@ int main(int argc, char *argv[])
 	}
 
 	gfs2_rgrp_free(&sbd, &sbd.rgtree);
-	inode_put(&sbd.md.riinode);
-	inode_put(&sbd.master_dir);
+	lgfs2_inode_put(&sbd.md.riinode);
+	lgfs2_inode_put(&sbd.master_dir);
 	lgfs2_lang_free(&state);
 	free(opts.fspath);
 	return 0;
gfs2/libgfs2/lang.c +3 -3
index dd46cd21..6b5d4449 100644
@@ -163,12 +163,12 @@ static uint64_t ast_lookup_path(char *path, struct gfs2_sbd *sbd)
 	while (ip != NULL) {
 		if (segment == NULL) { // No more segments
 			bn = ip->i_num.in_addr;
-			inode_put(&ip);
+			lgfs2_inode_put(&ip);
 			return bn;
 		}
 		ast_string_unescape(segment);
-		err = gfs2_lookupi(ip, segment, strlen(segment), &iptmp);
-		inode_put(&ip);
+		err = lgfs2_lookupi(ip, segment, strlen(segment), &iptmp);
+		lgfs2_inode_put(&ip);
 		if (err != 0) {
 			errno = -err;
 			break;
gfs2/libgfs2/libgfs2.h +27 -28

89 lines not on this page · raw message

gfs2/libgfs2/recovery.c +2 -2
index 2edfe120..3984e1e3 100644
@@ -28,7 +28,7 @@ int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
 	int new = 0;
 	uint64_t dblock;
 
-	block_map(ip, blk, &new, &dblock, NULL, 0);
+	lgfs2_block_map(ip, blk, &new, &dblock, NULL, 0);
 	if (!dblock)
 		return -EIO;
 
@@ -241,7 +241,7 @@ int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head)
 
 	lblock = head->lh_blkno;
 	gfs2_replay_incr_blk(ip, &lblock);
-	block_map(ip, lblock, &new, &dblock, NULL, 0);
+	lgfs2_block_map(ip, lblock, &new, &dblock, NULL, 0);
 	if (!dblock)
 		return -EIO;
 
gfs2/libgfs2/rgrp.c +1 -1
index c6dfb228..4a522546 100644
@@ -483,7 +483,7 @@ lgfs2_rgrp_t lgfs2_rindex_read_one(struct gfs2_inode *rip, lgfs2_rgrps_t rgs, un
 	if (rip == NULL || rgs == NULL)
 		return NULL;
 
-	ret = gfs2_readi(rip, &ri, off, sizeof(struct gfs2_rindex));
+	ret = lgfs2_readi(rip, &ri, off, sizeof(struct gfs2_rindex));
 	if (ret != sizeof(struct gfs2_rindex))
 		return NULL;
 
gfs2/libgfs2/structures.c +26 -26

171 lines not on this page · raw message

gfs2/libgfs2/super.c +1 -1
index 119f1cd0..b32c89c9 100644
@@ -213,7 +213,7 @@ int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
 		struct gfs2_rindex ri;
 		uint64_t addr;
 
-		error = gfs2_readi(sdp->md.riinode, &ri,
+		error = lgfs2_readi(sdp->md.riinode, &ri,
 		                   rg * sizeof(struct gfs2_rindex),
 		                   sizeof(struct gfs2_rindex));
 		if (!error)
gfs2/mkfs/main_mkfs.c +12 -12
index 318c24f2..3b0f5b4e 100644
@@ -686,7 +686,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 	struct gfs2_inode *per_node;
 	unsigned int j;
 
-	per_node = createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
+	per_node = lgfs2_createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
 			   GFS2_DIF_SYSTEM);
 	if (per_node == NULL) {
 		fprintf(stderr, _("Error building '%s': %s\n"), "per_node", strerror(errno));
@@ -705,7 +705,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 			printf("\nInum Range %u:\n", j);
 			dinode_print(ip->i_bh->b_data);
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 
 		ip = lgfs2_build_statfs_change(per_node, j);
 		if (ip == NULL) {
@@ -717,7 +717,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 			printf("\nStatFS Change %u:\n", j);
 			dinode_print(ip->i_bh->b_data);
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 
 		ip = lgfs2_build_quota_change(per_node, j);
 		if (ip == NULL) {
@@ -729,13 +729,13 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 			printf("\nQuota Change %u:\n", j);
 			dinode_print(ip->i_bh->b_data);
 		}
-		inode_put(&ip);
+		lgfs2_inode_put(&ip);
 	}
 	if (opts->debug) {
 		printf("\nper_node:\n");
 		dinode_print(per_node->i_bh->b_data);
 	}
-	inode_put(&per_node);
+	lgfs2_inode_put(&per_node);
 	return 0;
 }
 
@@ -1012,7 +1012,7 @@ static int create_jindex(struct gfs2_sbd *sdp, struct mkfs_opts *opts, struct lg
 		printf("Jindex:\n");
 		dinode_print(jindex->i_bh->b_data);
 	}
-	inode_put(&jindex);
+	lgfs2_inode_put(&jindex);
 	return 0;
 }
 
@@ -1325,7 +1325,7 @@ int main(int argc, char *argv[])
 		printf("\nResource Index:\n");
 		dinode_print(ip->i_bh->b_data);
 	}
-	inode_put(&ip);
+	lgfs2_inode_put(&ip);
 	if (!opts.quiet) {
 		printf("%s", _("Creating quota file: "));
 		fflush(stdout);
@@ -1339,7 +1339,7 @@ int main(int argc, char *argv[])
 		printf("\nQuota:\n");
 		dinode_print(ip->i_bh->b_data);
 	}
-	inode_put(&ip);
+	lgfs2_inode_put(&ip);
 	if (!opts.quiet)
 		printf("%s", _("Done\n"));
 
@@ -1364,10 +1364,10 @@ int main(int argc, char *argv[])
 		printf("\nStatfs:\n");
 		statfs_change_print(&sc);
 	}
-	inode_put(&sbd.md.rooti);
-	inode_put(&sbd.master_dir);
-	inode_put(&sbd.md.inum);
-	inode_put(&sbd.md.statfs);
+	lgfs2_inode_put(&sbd.md.rooti);
+	lgfs2_inode_put(&sbd.master_dir);
+	lgfs2_inode_put(&sbd.md.inum);
+	lgfs2_inode_put(&sbd.md.statfs);
 
 	lgfs2_rgrps_free(&rgs);
 
tests/nukerg.c +4 -4
index a831e459..81424e17 100644
@@ -232,7 +232,7 @@ static int nuke_ris(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, unsigned *rinums, s
 			printf("Nuking rindex entry %u.\n", i);
 
 			off = i * sizeof(struct gfs2_rindex);
-			bytes = gfs2_writei(sdp->md.riinode, &blankri, off,
+			bytes = lgfs2_writei(sdp->md.riinode, &blankri, off,
 						sizeof(struct gfs2_rindex));
 			if (bytes != sizeof(struct gfs2_rindex)) {
 				fprintf(stderr, "Write failed (%d bytes): %s",
@@ -250,7 +250,7 @@ static lgfs2_rgrps_t read_rindex(struct gfs2_sbd *sdp)
 	unsigned rgcount;
 	unsigned i;
 
-	gfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
+	lgfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
 	if (sdp->md.riinode == NULL) {
 		perror("Failed to look up rindex");
 		return NULL;
@@ -336,8 +336,8 @@ int main(int argc, char **argv)
 	if (opts.got_rinums && nuke_ris(&sbd, rgs, opts.rinums, opts.rinum_count) != 0)
 		exit(1);
 
-	inode_put(&sbd.md.riinode);
-	inode_put(&sbd.master_dir);
+	lgfs2_inode_put(&sbd.md.riinode);
+	lgfs2_inode_put(&sbd.master_dir);
 	lgfs2_rgrps_free(&rgs);
 	fsync(sbd.device_fd);
 	close(sbd.device_fd);
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/21 libgfs2: Namespace improvements - fs_bits.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/convert/gfs2_convert.c |  2 +-
 gfs2/edit/hexedit.c         |  2 +-
 gfs2/edit/savemeta.c        |  4 ++--
 gfs2/fsck/metawalk.c        |  2 +-
 gfs2/fsck/pass5.c           |  4 ++--
 gfs2/fsck/rgrepair.c        |  2 +-
 gfs2/libgfs2/check_rgrp.c   |  2 +-
 gfs2/libgfs2/fs_bits.c      | 22 +++++++++++-----------
 gfs2/libgfs2/fs_ops.c       |  8 ++++----
 gfs2/libgfs2/lang.c         |  2 +-
 gfs2/libgfs2/libgfs2.h      |  9 +++------
 gfs2/libgfs2/rgrp.c         |  8 ++++----
 gfs2/libgfs2/structures.c   |  2 +-
 gfs2/libgfs2/super.c        |  2 +-
 14 files changed, 34 insertions(+), 37 deletions(-)
gfs2/convert/gfs2_convert.c +1 -1
index bef0cf6f..9bf92ed4 100644
@@ -968,7 +968,7 @@ static int next_rg_meta(struct rgrp_tree *rgd, uint64_t *block, int first)
 	}
 	for (; i < length; i++){
 		bits = &rgd->bits[i];
-		blk = gfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
+		blk = lgfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
 		                   bits->bi_len, blk, GFS2_BLKST_DINODE);
 		if(blk != BFITNOENT){
 			*block = blk + (bits->bi_start * GFS2_NBBY) + rgd->rt_data0;
gfs2/edit/hexedit.c +1 -1
index 22e70830..ab5fa933 100644
@@ -1664,7 +1664,7 @@ static void find_change_block_alloc(int *newval)
 		if (rgd) {
 			gfs2_rgrp_read(&sbd, rgd);
 			if (newval) {
-				if (gfs2_set_bitmap(rgd, ablock, *newval))
+				if (lgfs2_set_bitmap(rgd, ablock, *newval))
 					printf("-1 (block invalid or part of an rgrp).\n");
 				else
 					printf("%d\n", *newval);
gfs2/edit/savemeta.c +2 -2
index 3b2152df..1d22df2e 100644
@@ -804,7 +804,7 @@ static int save_leaf_chain(struct metafd *mfd, struct gfs2_sbd *sdp, char *buf)
 		uint64_t blk = be64_to_cpu(leaf->lf_next);
 		ssize_t r;
 
-		if (gfs2_check_range(sdp, blk) != 0)
+		if (lgfs2_check_range(sdp, blk) != 0)
 			return 0;
 
 		r = pread(sdp->device_fd, buf, sdp->sd_bsize, sdp->sd_bsize * blk);
@@ -1041,7 +1041,7 @@ static char *rgrp_read(struct gfs2_sbd *sdp, uint64_t addr, unsigned blocks)
 	off_t off = addr * sdp->sd_bsize;
 	char *buf;
 
-	if (blocks == 0 || gfs2_check_range(sdp, addr))
+	if (blocks == 0 || lgfs2_check_range(sdp, addr))
 		return NULL;
 
 	buf = calloc(1, len);
gfs2/fsck/metawalk.c +1 -1
index a5b3fe36..a401e792 100644
@@ -77,7 +77,7 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 	   bitmap state was free (and therefore it no longer is) we have to
 	   subtract to the free space.  If the type changed from dinode to 
 	   data or data to dinode, no change in free space. */
-	gfs2_set_bitmap(rgd, blk, new_state);
+	lgfs2_set_bitmap(rgd, blk, new_state);
 	if (new_state == GFS2_BLKST_FREE) {
 		rgd->rt_free++;
 		rewrite_rgrp = 1;
gfs2/fsck/pass5.c +2 -2
index 9b8f8375..976c8641 100644
@@ -69,7 +69,7 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
 			if (query(_("Do you want to reclaim the block? "
 				   "(y/n) "))) {
 				lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
-				if (gfs2_set_bitmap(rg, block, GFS2_BLKST_FREE))
+				if (lgfs2_set_bitmap(rg, block, GFS2_BLKST_FREE))
 					log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") bitmap not fixed.\n"),
 					        block, block);
 				else {
@@ -94,7 +94,7 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
 			if (query(_("Fix bitmap for block %"PRIu64" (0x%"PRIx64")? (y/n) "),
 			          block, block)) {
 				lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
-				if (gfs2_set_bitmap(rg, block, q))
+				if (lgfs2_set_bitmap(rg, block, q))
 					log_err( _("Repair failed.\n"));
 				else
 					log_err( _("Fixed.\n"));
gfs2/fsck/rgrepair.c +1 -1
index 825a6398..6f15d2d4 100644
@@ -429,7 +429,7 @@ static uint64_t hunt_and_peck(struct gfs2_sbd *sdp, uint64_t blk,
 
 	/* Skip ahead the previous amount: we might get lucky.
 	   If we're close to the end of the device, take the rest. */
-	if (gfs2_check_range(sdp, blk + last_bump))
+	if (lgfs2_check_range(sdp, blk + last_bump))
 		return sdp->fssize - blk;
 
 	bh = lgfs2_bread(sdp, blk + last_bump);
gfs2/libgfs2/check_rgrp.c +1 -1
index 5178c7a7..2dc2e7be 100644
@@ -118,7 +118,7 @@ START_TEST(test_rbm_find_lastblock)
 		memset(rg->bits[i].bi_data, 0xff, rgs->sdp->sd_bsize);
 
 	/* ...except the final one */
-	err = gfs2_set_bitmap(rg, rg->rt_data0 + rg->rt_data - 1, GFS2_BLKST_FREE);
+	err = lgfs2_set_bitmap(rg, rg->rt_data0 + rg->rt_data - 1, GFS2_BLKST_FREE);
 	ck_assert_int_eq(err, 0);
 
 	err = lgfs2_rbm_find(&rbm, GFS2_BLKST_FREE, &minext);
gfs2/libgfs2/fs_bits.c +11 -11
index 8399e486..940ebf3c 100644
@@ -21,7 +21,7 @@
 #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
 
 /**
- * gfs2_bit_search
+ * bit_search
  * @ptr: Pointer to bitmap data
  * @mask: Mask to use (normally 0x55555.... but adjusted for search start)
  * @state: The state we are searching for
@@ -38,7 +38,7 @@
  * single test (on 64 bit arches).
  */
 
-static inline uint64_t gfs2_bit_search(const __le64 *ptr,
+static inline uint64_t bit_search(const __le64 *ptr,
 				       unsigned long long mask,
 				       uint8_t state)
 {
@@ -56,7 +56,7 @@ static inline uint64_t gfs2_bit_search(const __le64 *ptr,
 }
 
 /**
- * gfs2_bitfit - Find a free block in the bitmaps
+ * lgfs2_bitfit - Find a free block in the bitmaps
  * @buffer: the buffer that holds the bitmaps
  * @buflen: the length (in bytes) of the buffer
  * @goal: the block to try to allocate
@@ -64,7 +64,7 @@ static inline uint64_t gfs2_bit_search(const __le64 *ptr,
  *
  * Return: the block number that was allocated
  */
-unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
+unsigned long lgfs2_bitfit(const unsigned char *buf, const unsigned int len,
 			  unsigned long goal, unsigned char state)
 {
 	uint32_t spoint = (goal << 1) & ((8 * sizeof(uint64_t)) - 1);
@@ -79,10 +79,10 @@ unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
 
 	/* Mask off bits we don't care about@the start of the search */
 	mask <<= spoint;
-	tmp = gfs2_bit_search(ptr, mask, state);
+	tmp = bit_search(ptr, mask, state);
 	ptr++;
 	while(tmp == 0 && ptr < end) {
-		tmp = gfs2_bit_search(ptr, 0x5555555555555555ULL, state);
+		tmp = bit_search(ptr, 0x5555555555555555ULL, state);
 		ptr++;
 	}
 	/* Mask off any bits which are more than len bytes from the start */
@@ -99,13 +99,13 @@ unsigned long gfs2_bitfit(const unsigned char *buf, const unsigned int len,
 }
 
 /*
- * check_range - check if blkno is within FS limits
+ * lgfs2_check_range - check if blkno is within FS limits
  * @sdp: super block
  * @blkno: block number
  *
  * Returns: 0 if ok, -1 if out of bounds
  */
-int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
+int lgfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
 {
 	if((blkno > sdp->fssize) || (blkno <= LGFS2_SB_ADDR(sdp)))
 		return -1;
@@ -113,7 +113,7 @@ int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
 }
 
 /*
- * gfs2_set_bitmap
+ * lgfs2_set_bitmap
  * @sdp: super block
  * @blkno: block number relative to file system
  * @state: one of three possible states
@@ -123,7 +123,7 @@ int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
  *
  * Returns: 0 on success, -1 on error
  */
-int gfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
+int lgfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
 {
 	int           buf;
 	uint32_t        rgrp_block;
@@ -160,7 +160,7 @@ int gfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
 }
 
 /*
- * gfs2_get_bitmap - get value of FS bitmap
+ * lgfs2_get_bitmap - get value of FS bitmap
  * @sdp: super block
  * @blkno: block number relative to file system
  *
gfs2/libgfs2/fs_ops.c +4 -4
index 432031e1..077677a4 100644
@@ -121,7 +121,7 @@ static uint64_t find_free_block(struct rgrp_tree *rgd)
 		unsigned long blk = 0;
 		struct gfs2_bitmap *bits = &rgd->bits[bm];
 
-		blk = gfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
+		blk = lgfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
 		                  bits->bi_len, blk, GFS2_BLKST_FREE);
 		if (blk != BFITNOENT) {
 			blkno = blk + (bits->bi_start * GFS2_NBBY) + rgd->rt_data0;
@@ -136,7 +136,7 @@ static int blk_alloc_in_rg(struct gfs2_sbd *sdp, unsigned state, struct rgrp_tre
 	if (blkno == 0)
 		return -1;
 
-	if (gfs2_set_bitmap(rgd, blkno, state))
+	if (lgfs2_set_bitmap(rgd, blkno, state))
 		return -1;
 
 	if (state == GFS2_BLKST_DINODE) {
@@ -1902,7 +1902,7 @@ void lgfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
 	/* Adjust the free space count for the freed block */
 	rgd = gfs2_blk2rgrpd(sdp, block); /* find the rg for indir block */
 	if (rgd) {
-		gfs2_set_bitmap(rgd, block, GFS2_BLKST_FREE);
+		lgfs2_set_bitmap(rgd, block, GFS2_BLKST_FREE);
 		rgd->rt_free++; /* adjust the free count */
 		if (sdp->gfs1)
 			lgfs2_gfs_rgrp_out(rgd, rgd->bits[0].bi_data);
@@ -1968,7 +1968,7 @@ int lgfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
 		}
 	}
 	rgd = gfs2_blk2rgrpd(sdp, diblock);
-	gfs2_set_bitmap(rgd, diblock, GFS2_BLKST_FREE);
+	lgfs2_set_bitmap(rgd, diblock, GFS2_BLKST_FREE);
 	lgfs2_inode_put(&ip);
 	/* lgfs2_inode_put deallocated the extra block used by the disk inode, */
 	/* so adjust it in the superblock struct */
gfs2/libgfs2/lang.c +1 -1
index 6b5d4449..57849e60 100644
@@ -266,7 +266,7 @@ static uint64_t ast_lookup_block_num(struct ast_node *ast, struct gfs2_sbd *sbd)
 		bn = ast_lookup_block_num(ast->ast_left, sbd) + ast->ast_num;
 		break;
 	case AST_EX_ADDRESS:
-		if (gfs2_check_range(sbd, ast->ast_num))
+		if (lgfs2_check_range(sbd, ast->ast_num))
 			break;
 		bn = ast->ast_num;
 		break;
gfs2/libgfs2/libgfs2.h +3 -6
index d4f232ce..c6f0fb9e 100644
@@ -479,19 +479,16 @@ extern void fix_device_geometry(struct gfs2_sbd *sdp);
 #define BFITNOENT (0xFFFFFFFF)
 
 /* functions with blk #'s that are buffer relative */
-extern unsigned long gfs2_bitfit(const unsigned char *buffer,
+extern unsigned long lgfs2_bitfit(const unsigned char *buffer,
 				 const unsigned int buflen,
 				 unsigned long goal, unsigned char old_state);
 
 /* functions with blk #'s that are rgrp relative */
-extern uint32_t gfs2_blkalloc_internal(struct rgrp_tree *rgd, uint32_t goal,
-				       unsigned char old_state,
-				       unsigned char new_state, int do_it);
-extern int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno);
+extern int lgfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno);
 
 /* functions with blk #'s that are file system relative */
 extern int lgfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd);
-extern int gfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
+extern int lgfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
 
 extern uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks,
                                     uint32_t *ri_data) __attribute__((nonnull(3)));
gfs2/libgfs2/rgrp.c +4 -4
index 4a522546..39b8b69b 100644
@@ -193,7 +193,7 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 	off_t offset = rgd->rt_addr * sdp->sd_bsize;
 	char *buf;
 
-	if (length == 0 || gfs2_check_range(sdp, rgd->rt_addr))
+	if (length == 0 || lgfs2_check_range(sdp, rgd->rt_addr))
 		return -1;
 
 	buf = calloc(1, length);
@@ -951,7 +951,7 @@ int lgfs2_rbm_find(struct lgfs2_rbm *rbm, uint8_t state, uint32_t *minext)
 		if ((rbm->rgd->rt_free < *minext) && (state == GFS2_BLKST_FREE))
 			goto next_bitmap;
 
-		offset = gfs2_bitfit(buf, bi->bi_len, rbm->offset, state);
+		offset = lgfs2_bitfit(buf, bi->bi_len, rbm->offset, state);
 		if (offset == BFITNOENT)
 			goto next_bitmap;
 
@@ -1009,13 +1009,13 @@ unsigned lgfs2_alloc_extent(const struct lgfs2_rbm *rbm, int state, const unsign
 	const uint64_t block = lgfs2_rbm_to_block(rbm);
 	unsigned len;
 
-	gfs2_set_bitmap(rbm->rgd, block, state);
+	lgfs2_set_bitmap(rbm->rgd, block, state);
 
 	for (len = 1; len < elen; len++) {
 		int ret = lgfs2_rbm_from_block(&pos, block + len);
 		if (ret || lgfs2_testbit(&pos) != GFS2_BLKST_FREE)
 			break;
-		gfs2_set_bitmap(pos.rgd, block + len, GFS2_BLKST_USED);
+		lgfs2_set_bitmap(pos.rgd, block + len, GFS2_BLKST_USED);
 	}
 	return len;
 }
gfs2/libgfs2/structures.c +1 -1
index ff4c5522..fc0a59cc 100644
@@ -504,7 +504,7 @@ unsigned lgfs2_bm_scan(struct rgrp_tree *rgd, unsigned idx, uint64_t *buf, uint8
 	uint32_t blk = 0;
 
 	while(blk < (bi->bi_len * GFS2_NBBY)) {
-		blk = gfs2_bitfit((uint8_t *)bi->bi_data + bi->bi_offset,
+		blk = lgfs2_bitfit((uint8_t *)bi->bi_data + bi->bi_offset,
 				  bi->bi_len, blk, state);
 		if (blk == BFITNOENT)
 			break;
gfs2/libgfs2/super.c +1 -1
index b32c89c9..15f89a30 100644
@@ -222,7 +222,7 @@ int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
 			return -1;
 
 		addr = be64_to_cpu(ri.ri_addr);
-		if (gfs2_check_range(sdp, addr) != 0) {
+		if (lgfs2_check_range(sdp, addr) != 0) {
 			*ok = 0;
 			if (prev_rgd == NULL)
 				continue;
Signature · 1 line
2.34.1
#5 lore raw

PATCH 5/21 libgfs2: Namespace improvements - gfs1.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/fsck/pass1.c      |  2 +-
 gfs2/fsck/pass2.c      |  2 +-
 gfs2/fsck/util.h       |  2 +-
 gfs2/libgfs2/fs_ops.c  | 12 ++++++------
 gfs2/libgfs2/gfs1.c    | 16 ++++++++--------
 gfs2/libgfs2/libgfs2.h |  8 ++++----
 6 files changed, 21 insertions(+), 21 deletions(-)
gfs2/fsck/pass1.c +1 -1
index c2d6cae4..2b3379a7 100644
@@ -152,7 +152,7 @@ static int pass1_repair_leaf(struct gfs2_inode *ip, uint64_t *leaf_no,
 	          " (0x%"PRIx64") at index: 0x%x for 0x%x pointers.\n"),
 	        ip->i_num.in_addr, ip->i_num.in_addr, lindex, ref_count);
 	if (ip->i_sbd->gfs1)
-		gfs1_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
+		lgfs2_gfs1_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
 	else
 		lgfs2_writei(ip, padbuf, lindex * sizeof(uint64_t), pad_size);
 	free(padbuf);
gfs2/fsck/pass2.c +1 -1
index 71e10e96..3d732772 100644
@@ -1000,7 +1000,7 @@ static int write_new_leaf(struct gfs2_inode *dip, int start_lindex,
 	        dip->i_num.in_addr, dip->i_num.in_addr,
 		start_lindex, (unsigned long)pad_size / sizeof(uint64_t));
 	if (dip->i_sbd->gfs1)
-		count = gfs1_writei(dip, padbuf, start_lindex *
+		count = lgfs2_gfs1_writei(dip, padbuf, start_lindex *
 				    sizeof(uint64_t), pad_size);
 	else
 		count = lgfs2_writei(dip, padbuf, start_lindex *
gfs2/fsck/util.h +1 -1
index 5f9c488b..ae654bf4 100644
@@ -82,7 +82,7 @@ static const inline char *block_type_string(int q)
 
 static inline int is_dir(struct gfs2_inode *ip, int gfs1)
 {
-	if (gfs1 && is_gfs_dir(ip))
+	if (gfs1 && lgfs2_is_gfs_dir(ip))
 		return 1;
 	if (S_ISDIR(ip->i_mode))
 		return 1;
gfs2/libgfs2/fs_ops.c +6 -6
index 077677a4..1d5ef8e6 100644
@@ -235,7 +235,7 @@ void lgfs2_unstuff_dinode(struct gfs2_inode *ip)
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	struct gfs2_buffer_head *bh;
 	uint64_t block = 0;
-	int isdir = S_ISDIR(ip->i_mode) || is_gfs_dir(ip);
+	int isdir = S_ISDIR(ip->i_mode) || lgfs2_is_gfs_dir(ip);
 
 	if (ip->i_size) {
 		if (lgfs2_meta_alloc(ip, &block))
@@ -612,7 +612,7 @@ int lgfs2_readi(struct gfs2_inode *ip, void *buf, uint64_t offset, unsigned int
 
 		if (!extlen) {
 			if (sdp->gfs1)
-				gfs1_block_map(ip, lblock, &not_new, &dblock,
+				lgfs2_gfs1_block_map(ip, lblock, &not_new, &dblock,
 					       &extlen, 0);
 			else
 				lgfs2_block_map(ip, lblock, &not_new, &dblock,
@@ -935,7 +935,7 @@ void lgfs2_dir_split_leaf(struct gfs2_inode *dip, uint32_t start, uint64_t leaf_
 		lp[x] = cpu_to_be64(bn);
 
 	if (dip->i_sbd->gfs1)
-		count = gfs1_writei(dip, (char *)lp, start * sizeof(uint64_t),
+		count = lgfs2_gfs1_writei(dip, (char *)lp, start * sizeof(uint64_t),
 				    half_len * sizeof(uint64_t));
 	else
 		count = lgfs2_writei(dip, (char *)lp, start * sizeof(uint64_t),
@@ -1043,7 +1043,7 @@ static void dir_double_exhash(struct gfs2_inode *dip)
 		}
 
 		if (sdp->gfs1)
-			count = gfs1_writei(dip, (char *)buf +
+			count = lgfs2_gfs1_writei(dip, (char *)buf +
 					    sdp->sd_hash_bsize,
 					    block * sdp->sd_bsize, sdp->sd_bsize);
 		else
@@ -1763,7 +1763,7 @@ int lgfs2_dir_search(struct gfs2_inode *dip, const char *filename, int len,
 {
 	int error;
 
-	if(!S_ISDIR(dip->i_mode) && !is_gfs_dir(dip))
+	if(!S_ISDIR(dip->i_mode) && !lgfs2_is_gfs_dir(dip))
 		return -1;
 
 	if (dip->i_flags & GFS2_DIF_EXHASH)
@@ -1851,7 +1851,7 @@ int lgfs2_dirent_del(struct gfs2_inode *dip, const char *filename, int len)
 {
 	int error;
 
-	if(!S_ISDIR(dip->i_mode) && !is_gfs_dir(dip))
+	if(!S_ISDIR(dip->i_mode) && !lgfs2_is_gfs_dir(dip))
 		return -1;
 
 	if (dip->i_flags & GFS2_DIF_EXHASH)
gfs2/libgfs2/gfs1.c +8 -8
index 5cee3df8..2b864137 100644
@@ -31,14 +31,14 @@ gfs1_metapointer(char *buf, unsigned int height, struct metapath *mp)
 	return ((__be64 *)(buf + head_size)) + mp->mp_list[height];
 }
 
-int is_gfs_dir(struct gfs2_inode *ip)
+int lgfs2_is_gfs_dir(struct gfs2_inode *ip)
 {
 	if (ip->i_di_type == GFS_FILE_DIR)
 		return 1;
 	return 0;
 }
 
-void gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+void lgfs2_gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 		  unsigned int height, struct metapath *mp,
 		  int create, int *new, uint64_t *block)
 {
@@ -67,7 +67,7 @@ void gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 	*new = 1;
 }
 
-void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
+void lgfs2_gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 		    uint64_t *dblock, uint32_t *extlen, int prealloc)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -109,7 +109,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 	bh = ip->i_bh;
 
 	for (x = 0; x < end_of_metadata; x++) {
-		gfs1_lookup_block(ip, bh, x, &mp, create, new, dblock);
+		lgfs2_gfs1_lookup_block(ip, bh, x, &mp, create, new, dblock);
 		if (bh != ip->i_bh)
 			lgfs2_brelse(bh);
 		if (!*dblock)
@@ -133,7 +133,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 	}
 
 	if (!prealloc)
-		gfs1_lookup_block(ip, bh, end_of_metadata, &mp, create, new,
+		lgfs2_gfs1_lookup_block(ip, bh, end_of_metadata, &mp, create, new,
 				  dblock);
 
 	if (extlen && *dblock) {
@@ -147,7 +147,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 			nptrs = (end_of_metadata) ? sdp->sd_inptrs : sdp->sd_diptrs;
 
 			while (++mp.mp_list[end_of_metadata] < nptrs) {
-				gfs1_lookup_block(ip, bh, end_of_metadata, &mp,
+				lgfs2_gfs1_lookup_block(ip, bh, end_of_metadata, &mp,
 						  0, &tmp_new,
 						  &tmp_dblock);
 
@@ -163,7 +163,7 @@ void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 		lgfs2_brelse(bh);
 }
 
-int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
+int lgfs2_gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
 		unsigned int size)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -203,7 +203,7 @@ int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
 
 		if (!extlen){
 			new = 1;
-			gfs1_block_map(ip, lblock, &new, &dblock, &extlen, 0);
+			lgfs2_gfs1_block_map(ip, lblock, &new, &dblock, &extlen, 0);
 			if (!dblock)
 				return -1;
 		}
gfs2/libgfs2/libgfs2.h +4 -4
index c6f0fb9e..e74918ab 100644
@@ -710,14 +710,14 @@ struct gfs_log_descriptor {
 	uint8_t ld_reserved[64];
 };
 
-extern int is_gfs_dir(struct gfs2_inode *ip);
-extern void gfs1_lookup_block(struct gfs2_inode *ip,
+extern int lgfs2_is_gfs_dir(struct gfs2_inode *ip);
+extern void lgfs2_gfs1_lookup_block(struct gfs2_inode *ip,
 			      struct gfs2_buffer_head *bh,
 			      unsigned int height, struct metapath *mp,
 			      int create, int *new, uint64_t *block);
-extern void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
+extern void lgfs2_gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 			   uint64_t *dblock, uint32_t *extlen, int prealloc);
-extern int gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
+extern int lgfs2_gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
 		       unsigned int size);
 extern struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf);
 extern struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr);
Signature · 1 line
2.34.1
#6 lore raw

PATCH 6/21 libgfs2: Namespace improvements - misc.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/convert/gfs2_convert.c | 12 ++++++------
 gfs2/edit/hexedit.c         |  2 +-
 gfs2/fsck/initialize.c      |  2 +-
 gfs2/libgfs2/check_rgrp.c   |  2 +-
 gfs2/libgfs2/gfs2l.c        |  2 +-
 gfs2/libgfs2/libgfs2.h      |  4 ++--
 gfs2/libgfs2/misc.c         |  8 ++++----
 gfs2/mkfs/main_grow.c       |  2 +-
 gfs2/mkfs/main_jadd.c       |  2 +-
 gfs2/mkfs/main_mkfs.c       |  2 +-
 tests/nukerg.c              |  2 +-
 11 files changed, 20 insertions(+), 20 deletions(-)
gfs2/convert/gfs2_convert.c +6 -6
index 9bf92ed4..90964ae1 100644
@@ -1585,7 +1585,7 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
 	sbp->dinodes_alloced = 0; /* dinodes allocated - total them up later */
 	sbp->sd_bsize = GFS2_DEFAULT_BSIZE;
 	sbp->rgtree.osi_node = NULL;
-	if (compute_constants(sbp)) {
+	if (lgfs2_compute_constants(sbp)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
 		exit(-1);
 	}
@@ -1605,13 +1605,13 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
 		sizeof(uint64_t);
 	sbp->sd_jbsize = sbp->sd_bsize - sizeof(struct gfs2_meta_header);
 	lgfs2_brelse(bh);
-	if (compute_heightsize(sbp->sd_bsize, sbp->sd_heightsize, &sbp->sd_max_height,
+	if (lgfs2_compute_heightsize(sbp->sd_bsize, sbp->sd_heightsize, &sbp->sd_max_height,
 				sbp->sd_bsize, sbp->sd_diptrs, sbp->sd_inptrs)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
 		exit(-1);
 	}
 
-	if (compute_heightsize(sbp->sd_bsize, sbp->sd_jheightsize, &sbp->sd_max_jheight,
+	if (lgfs2_compute_heightsize(sbp->sd_bsize, sbp->sd_jheightsize, &sbp->sd_max_jheight,
 				sbp->sd_jbsize, sbp->sd_diptrs, sbp->sd_inptrs)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
 		exit(-1);
@@ -1622,13 +1622,13 @@ static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
 	gfs2_inptrs = (sbp->sd_bsize - sizeof(struct gfs2_meta_header)) /
                 sizeof(uint64_t); /* How many ptrs can we fit on a block? */
 	memset(gfs2_heightsize, 0, sizeof(gfs2_heightsize));
-	if (compute_heightsize(sbp->sd_bsize, gfs2_heightsize, &gfs2_max_height,
+	if (lgfs2_compute_heightsize(sbp->sd_bsize, gfs2_heightsize, &gfs2_max_height,
 				sbp->sd_bsize, sbp->sd_diptrs, gfs2_inptrs)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
 		exit(-1);
 	}
 	memset(gfs2_jheightsize, 0, sizeof(gfs2_jheightsize));
-	if (compute_heightsize(sbp->sd_bsize, gfs2_jheightsize, &gfs2_max_jheight,
+	if (lgfs2_compute_heightsize(sbp->sd_bsize, gfs2_jheightsize, &gfs2_max_jheight,
 				sbp->sd_jbsize, sbp->sd_diptrs, gfs2_inptrs)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
 		exit(-1);
@@ -2299,7 +2299,7 @@ int main(int argc, char **argv)
 		int jreduce = 0;
 
 		/* Now we've got to treat it as a gfs2 file system */
-		if (compute_constants(&sb2)) {
+		if (lgfs2_compute_constants(&sb2)) {
 			log_crit("%s\n", _("Failed to compute file system constants"));
 			exit(-1);
 		}
gfs2/edit/hexedit.c +1 -1
index ab5fa933..ffb714bf 100644
@@ -899,7 +899,7 @@ static void read_superblock(int fd)
 		perror(device);
 		exit(-1);
 	}
-	if(compute_constants(&sbd)) {
+	if(lgfs2_compute_constants(&sbd)) {
 		fprintf(stderr, "Failed to compute constants.\n");
 		exit(-1);
 	}
gfs2/fsck/initialize.c +1 -1
index 63024a87..f1586374 100644
@@ -1341,7 +1341,7 @@ static int fill_super_block(struct gfs2_sbd *sdp)
 	sdp->rgtree.osi_node = NULL;
 
 	sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
-	if (compute_constants(sdp)) {
+	if (lgfs2_compute_constants(sdp)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
 		return FSCK_ERROR;
 	}
gfs2/libgfs2/check_rgrp.c +1 -1
index 2dc2e7be..d2e7b4fb 100644
@@ -35,7 +35,7 @@ static void mockup_rgrps(void)
 	ck_assert(ftruncate(sdp->device_fd, MOCK_DEV_SIZE) == 0);
 
 	sdp->sd_bsize = 4096;
-	compute_constants(sdp);
+	lgfs2_compute_constants(sdp);
 
 	rgs = lgfs2_rgrps_init(sdp, 0, 0);
 	ck_assert(rgs != NULL);
gfs2/libgfs2/gfs2l.c +1 -1
index 12862507..c31748b0 100644
@@ -120,7 +120,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
 	memset(sdp, 0, sizeof(*sdp));
 	sdp->sd_bsize = GFS2_BASIC_BLOCK;
 	sdp->device_fd = fd;
-	ret = compute_constants(sdp);
+	ret = lgfs2_compute_constants(sdp);
 	if (ret != 0) {
 		perror("Bad constants");
 		return 1;
gfs2/libgfs2/libgfs2.h +2 -2
index e74918ab..5eb08baf 100644
@@ -725,9 +725,9 @@ extern void lgfs2_gfs_rgrp_in(const lgfs2_rgrp_t rg, void *buf);
 extern void lgfs2_gfs_rgrp_out(const lgfs2_rgrp_t rg, void *buf);
 
 /* misc.c */
-extern int compute_heightsize(unsigned bsize, uint64_t *heightsize,
+extern int lgfs2_compute_heightsize(unsigned bsize, uint64_t *heightsize,
 		uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs);
-extern int compute_constants(struct gfs2_sbd *sdp);
+extern int lgfs2_compute_constants(struct gfs2_sbd *sdp);
 extern int lgfs2_open_mnt(const char *path, int dirflags, int *dirfd, int devflags, int *devfd, struct mntent **mnt);
 extern int lgfs2_open_mnt_dev(const char *path, int flags, struct mntent **mnt);
 extern int lgfs2_open_mnt_dir(const char *path, int flags, struct mntent **mnt);
gfs2/libgfs2/misc.c +4 -4
index 8f1014ea..6092fa5c 100644
@@ -12,7 +12,7 @@
 #define PAGE_SIZE (4096)
 #define DIV_RU(x, y) (((x) + (y) - 1) / (y))
 
-int compute_heightsize(unsigned bsize, uint64_t *heightsize,
+int lgfs2_compute_heightsize(unsigned bsize, uint64_t *heightsize,
 	uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs)
 {
 	heightsize[0] = bsize - sizeof(struct gfs2_dinode);
@@ -36,7 +36,7 @@ int compute_heightsize(unsigned bsize, uint64_t *heightsize,
 	return 0;
 }
 
-int compute_constants(struct gfs2_sbd *sdp)
+int lgfs2_compute_constants(struct gfs2_sbd *sdp)
 {
 	sdp->md.next_inum = 1;
 
@@ -55,11 +55,11 @@ int compute_constants(struct gfs2_sbd *sdp)
 	sdp->sd_blocks_per_bitmap = (sdp->sd_bsize - sizeof(struct gfs2_meta_header))
 	                             * GFS2_NBBY;
 
-	if (compute_heightsize(sdp->sd_bsize, sdp->sd_heightsize, &sdp->sd_max_height,
+	if (lgfs2_compute_heightsize(sdp->sd_bsize, sdp->sd_heightsize, &sdp->sd_max_height,
 				sdp->sd_bsize, sdp->sd_diptrs, sdp->sd_inptrs)) {
 		return -1;
 	}
-	if (compute_heightsize(sdp->sd_bsize, sdp->sd_jheightsize, &sdp->sd_max_jheight,
+	if (lgfs2_compute_heightsize(sdp->sd_bsize, sdp->sd_jheightsize, &sdp->sd_max_jheight,
 				sdp->sd_jbsize, sdp->sd_diptrs, sdp->sd_inptrs)) {
 		return -1;
 	}
gfs2/mkfs/main_grow.c +1 -1
index 9690021b..4ce24c90 100644
@@ -394,7 +394,7 @@ int main(int argc, char *argv[])
 		}
 		sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
 		sdp->sd_bsize = sdp->sd_bsize;
-		if (compute_constants(sdp)) {
+		if (lgfs2_compute_constants(sdp)) {
 			log_crit("%s\n", _("Failed to compute file system constants"));
 			exit(EXIT_FAILURE);
 		}
gfs2/mkfs/main_jadd.c +1 -1
index 0a7f1f33..e11b63f6 100644
@@ -679,7 +679,7 @@ int main(int argc, char *argv[])
 		goto umount_meta;
 	}
 
-	if ((ret = compute_constants(sdp))) {
+	if ((ret = lgfs2_compute_constants(sdp))) {
 		perror(_("Failed to compute file system constants"));
 		goto free_paths;
 	}
gfs2/mkfs/main_mkfs.c +1 -1
index 3b0f5b4e..5a8ede04 100644
@@ -1064,7 +1064,7 @@ static int sbd_init(struct gfs2_sbd *sdp, struct mkfs_opts *opts, unsigned bsize
 	sdp->sd_bsize_shift = ffs(bsize) - 1;
 	uuid_generate(sdp->sd_uuid);
 
-	if (compute_constants(sdp)) {
+	if (lgfs2_compute_constants(sdp)) {
 		perror(_("Failed to compute file system constants"));
 		return -1;
 	}
tests/nukerg.c +1 -1
index 81424e17..49bbda74 100644
@@ -280,7 +280,7 @@ static int fill_super_block(struct gfs2_sbd *sdp)
 {
 	sdp->sd_bsize = GFS2_BASIC_BLOCK;
 
-	if (compute_constants(sdp) != 0) {
+	if (lgfs2_compute_constants(sdp) != 0) {
 		fprintf(stderr, "Failed to compute file system constants.\n");
 		return 1;
 	}
Signature · 1 line
2.34.1
#7 lore raw

PATCH 7/21 libgfs2: Namespace improvements - rgrp.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/convert/gfs2_convert.c | 10 +++---
 gfs2/edit/hexedit.c         | 60 +++++++++++++++++-----------------
 gfs2/edit/journal.c         |  2 +-
 gfs2/edit/savemeta.c        |  2 +-
 gfs2/fsck/fs_recovery.c     |  2 +-
 gfs2/fsck/fsck.h            |  2 +-
 gfs2/fsck/initialize.c      |  6 ++--
 gfs2/fsck/metawalk.c        |  2 +-
 gfs2/fsck/pass1.c           |  2 +-
 gfs2/fsck/pass5.c           |  4 +--
 gfs2/fsck/rgrepair.c        | 64 ++++++++++++++++++-------------------
 gfs2/fsck/util.h            |  2 +-
 gfs2/libgfs2/fs_bits.c      |  2 +-
 gfs2/libgfs2/fs_ops.c       |  8 ++---
 gfs2/libgfs2/gfs2l.c        |  2 +-
 gfs2/libgfs2/lang.c         |  6 ++--
 gfs2/libgfs2/libgfs2.h      | 22 +++++--------
 gfs2/libgfs2/rgrp.c         | 22 ++++++-------
 gfs2/libgfs2/super.c        |  4 +--
 19 files changed, 109 insertions(+), 115 deletions(-)
gfs2/convert/gfs2_convert.c +5 -5
index 90964ae1..1608b1ad 100644
@@ -1532,7 +1532,7 @@ static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
 		next = osi_next(n);
 		rgd = (struct rgrp_tree *)n;
 		/* Read resource group header */
-		errblock = gfs2_rgrp_read(sdp, rgd);
+		errblock = lgfs2_rgrp_read(sdp, rgd);
 		if (errblock)
 			return errblock;
 		count2++;
@@ -1552,7 +1552,7 @@ static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
 	return 0;
 
  fail:
-	gfs2_rgrp_free(sdp, &sdp->rgtree);
+	lgfs2_rgrp_free(sdp, &sdp->rgtree);
 	return -1;
 }
 
@@ -1848,7 +1848,7 @@ static int journ_space_to_rg(struct gfs2_sbd *sdp)
 		         ji_addr, rgdhigh->rt_addr);
 		ri_addr = ji_addr;
 		/* Allocate a new rgd entry which includes rg and ri. */
-		rgd = rgrp_insert(&sdp->rgtree, ri_addr);
+		rgd = lgfs2_rgrp_insert(&sdp->rgtree, ri_addr);
 		/* convert the gfs1 rgrp into a new gfs2 rgrp */
 		size = ji_nsegs * be32_to_cpu(gfs1_sb.sb_seg_size);
 		rgd->rt_flags = 0;
@@ -1866,7 +1866,7 @@ static int journ_space_to_rg(struct gfs2_sbd *sdp)
 		rgd->rt_free = rgd->rt_data;
 		rgd->rt_bitbytes = rgd->rt_data / GFS2_NBBY;
 
-		if (gfs2_compute_bitstructs(sdp->sd_bsize, rgd)) {
+		if (lgfs2_compute_bitstructs(sdp->sd_bsize, rgd)) {
 			log_crit(_("gfs2_convert: Error converting bitmaps.\n"));
 			exit(-1);
 		}
@@ -2382,7 +2382,7 @@ int main(int argc, char **argv)
 		fsync(sb2.device_fd); /* write the buffers to disk */
 
 		/* Now free all the in memory */
-		gfs2_rgrp_free(&sb2, &sb2.rgtree);
+		lgfs2_rgrp_free(&sb2, &sb2.rgtree);
 		log_notice(_("Committing changes to disk.\n"));
 		fflush(stdout);
 		/* Set filesystem type in superblock to gfs2.  We do this at the */
gfs2/edit/hexedit.c +30 -30

210 lines not on this page · raw message

gfs2/edit/journal.c +1 -1
index 91d0a925..2bc94514 100644
@@ -546,7 +546,7 @@ void dump_journal(const char *journal, uint64_t tblk)
 	if (tblk) {
 		uint64_t wp;
 
-		rgd = gfs2_blk2rgrpd(&sbd, tblk);
+		rgd = lgfs2_blk2rgrpd(&sbd, tblk);
 		if (!rgd) {
 			print_gfs2("Can't locate the rgrp for block 0x%"PRIx64,
 				   tblk);
gfs2/edit/savemeta.c +1 -1
index 1d22df2e..21c67989 100644
@@ -1207,7 +1207,7 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
 	close(sbd.device_fd);
 	destroy_per_node_lookup();
 	free(indirect);
-	gfs2_rgrp_free(&sbd, &sbd.rgtree);
+	lgfs2_rgrp_free(&sbd, &sbd.rgtree);
 	exit(0);
 }
 
gfs2/fsck/fs_recovery.c +1 -1
index 6f186c92..bd0fd731 100644
@@ -167,7 +167,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 			error = -EIO;
 		} else {
 			lgfs2_bmodified(bh_ip);
-			rgd = gfs2_blk2rgrpd(sdp, blkno);
+			rgd = lgfs2_blk2rgrpd(sdp, blkno);
 			if (rgd && blkno < rgd->rt_data0)
 				refresh_rgrp(sdp, rgd, bh_ip, blkno);
 		}
gfs2/fsck/fsck.h +1 -1
index 7b991614..055ae975 100644
@@ -183,7 +183,7 @@ static inline int valid_block_ip(struct gfs2_inode *ip, uint64_t blk)
 	if (blk <= LGFS2_SB_ADDR(sdp))
 		return 0;
 	if (rgd == NULL || !rgrp_contains_block(rgd, blk)) {
-		rgd = gfs2_blk2rgrpd(sdp, blk);
+		rgd = lgfs2_blk2rgrpd(sdp, blk);
 		if (rgd == NULL)
 			return 0;
 	}
gfs2/fsck/initialize.c +3 -3
index f1586374..18522a35 100644
@@ -112,7 +112,7 @@ static void gfs2_inodetree_free(void)
 static void empty_super_block(struct gfs2_sbd *sdp)
 {
 	log_info( _("Freeing buffers.\n"));
-	gfs2_rgrp_free(sdp, &sdp->rgtree);
+	lgfs2_rgrp_free(sdp, &sdp->rgtree);
 
 	gfs2_inodetree_free();
 	gfs2_dirtree_free();
@@ -675,7 +675,7 @@ static int read_rgrps(struct gfs2_sbd *sdp, uint64_t expected)
 		if (ra_window < RA_WINDOW/2)
 			ra_window = gfs2_rgrp_reada(sdp, ra_window, n);
 		/* Read resource group header */
-		errblock = gfs2_rgrp_read(sdp, rgd);
+		errblock = lgfs2_rgrp_read(sdp, rgd);
 		if (errblock)
 			return errblock;
 		ra_window--;
@@ -693,7 +693,7 @@ static int read_rgrps(struct gfs2_sbd *sdp, uint64_t expected)
 
  fail:
 	posix_fadvise(sdp->device_fd, 0, 0, POSIX_FADV_NORMAL);
-	gfs2_rgrp_free(sdp, &sdp->rgtree);
+	lgfs2_rgrp_free(sdp, &sdp->rgtree);
 	return -1;
 }
 
gfs2/fsck/metawalk.c +1 -1
index a401e792..2612b0cb 100644
@@ -44,7 +44,7 @@ int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 	if (prevrgd && rgrp_contains_block(prevrgd, blk)) {
 		rgd = prevrgd;
 	} else if (rgd == NULL || !rgrp_contains_block(rgd, blk)) {
-		rgd = gfs2_blk2rgrpd(sdp, blk);
+		rgd = lgfs2_blk2rgrpd(sdp, blk);
 		prevrgd = rgd;
 	}
 	old_state = lgfs2_get_bitmap(sdp, blk, rgd);
gfs2/fsck/pass1.c +1 -1
index 2b3379a7..f747a7a5 100644
@@ -430,7 +430,7 @@ static int undo_reference(struct gfs2_inode *ip, uint64_t block, int meta,
 		}
 	}
 	if (!meta) {
-		rgd = gfs2_blk2rgrpd(ip->i_sbd, block);
+		rgd = lgfs2_blk2rgrpd(ip->i_sbd, block);
 		old_bitmap_state = lgfs2_get_bitmap(ip->i_sbd, block, rgd);
 		if (old_bitmap_state == GFS2_BLKST_DINODE)
 			return -1;
gfs2/fsck/pass5.c +2 -2
index 976c8641..9aba38e6 100644
@@ -68,7 +68,7 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
 			        block, block);
 			if (query(_("Do you want to reclaim the block? "
 				   "(y/n) "))) {
-				lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
+				lgfs2_rgrp_t rg = lgfs2_blk2rgrpd(sdp, block);
 				if (lgfs2_set_bitmap(rg, block, GFS2_BLKST_FREE))
 					log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") bitmap not fixed.\n"),
 					        block, block);
@@ -93,7 +93,7 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
 
 			if (query(_("Fix bitmap for block %"PRIu64" (0x%"PRIx64")? (y/n) "),
 			          block, block)) {
-				lgfs2_rgrp_t rg = gfs2_blk2rgrpd(sdp, block);
+				lgfs2_rgrp_t rg = lgfs2_blk2rgrpd(sdp, block);
 				if (lgfs2_set_bitmap(rg, block, q))
 					log_err( _("Repair failed.\n"));
 				else
gfs2/fsck/rgrepair.c +32 -32

211 lines not on this page · raw message

gfs2/fsck/util.h +1 -1
index ae654bf4..278ac139 100644
@@ -68,7 +68,7 @@ static inline int bitmap_type(struct gfs2_sbd *sdp, uint64_t bblock)
 {
 	struct rgrp_tree *rgd;
 
-	rgd = gfs2_blk2rgrpd(sdp, bblock);
+	rgd = lgfs2_blk2rgrpd(sdp, bblock);
 	return lgfs2_get_bitmap(sdp, bblock, rgd);
 }
 
gfs2/libgfs2/fs_bits.c +1 -1
index 940ebf3c..db5e2772 100644
@@ -183,7 +183,7 @@ int lgfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd
 	struct gfs2_bitmap *bi;
 
 	if (rgd == NULL) {
-		rgd = gfs2_blk2rgrpd(sdp, blkno);
+		rgd = lgfs2_blk2rgrpd(sdp, blkno);
 		if(rgd == NULL)
 			return -1;
 	}
gfs2/libgfs2/fs_ops.c +4 -4
index 1d5ef8e6..4e10ab4f 100644
@@ -178,7 +178,7 @@ static int block_alloc(struct gfs2_sbd *sdp, const uint64_t blksreq, int state,
 		return -1;
 
 	if (rgt->bits[0].bi_data == NULL) {
-		if (gfs2_rgrp_read(sdp, rgt))
+		if (lgfs2_rgrp_read(sdp, rgt))
 			return -1;
 		release = 1;
 	}
@@ -186,7 +186,7 @@ static int block_alloc(struct gfs2_sbd *sdp, const uint64_t blksreq, int state,
 	bn = find_free_block(rgt);
 	ret = blk_alloc_in_rg(sdp, state, rgt, bn, dinode);
 	if (release)
-		gfs2_rgrp_relse(sdp, rgt);
+		lgfs2_rgrp_relse(sdp, rgt);
 	*blkno = bn;
 	return ret;
 }
@@ -1900,7 +1900,7 @@ void lgfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
 	struct rgrp_tree *rgd;
 
 	/* Adjust the free space count for the freed block */
-	rgd = gfs2_blk2rgrpd(sdp, block); /* find the rg for indir block */
+	rgd = lgfs2_blk2rgrpd(sdp, block); /* find the rg for indir block */
 	if (rgd) {
 		lgfs2_set_bitmap(rgd, block, GFS2_BLKST_FREE);
 		rgd->rt_free++; /* adjust the free count */
@@ -1967,7 +1967,7 @@ int lgfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
 			}
 		}
 	}
-	rgd = gfs2_blk2rgrpd(sdp, diblock);
+	rgd = lgfs2_blk2rgrpd(sdp, diblock);
 	lgfs2_set_bitmap(rgd, diblock, GFS2_BLKST_FREE);
 	lgfs2_inode_put(&ip);
 	/* lgfs2_inode_put deallocated the extra block used by the disk inode, */
gfs2/libgfs2/gfs2l.c +1 -1
index c31748b0..2ec4a1a1 100644
@@ -190,7 +190,7 @@ int main(int argc, char *argv[])
 		lgfs2_lang_result_free(&result);
 	}
 
-	gfs2_rgrp_free(&sbd, &sbd.rgtree);
+	lgfs2_rgrp_free(&sbd, &sbd.rgtree);
 	lgfs2_inode_put(&sbd.md.riinode);
 	lgfs2_inode_put(&sbd.master_dir);
 	lgfs2_lang_free(&state);
gfs2/libgfs2/lang.c +3 -3
index 57849e60..e1c5aba0 100644
@@ -365,13 +365,13 @@ static int ast_get_bitstate(uint64_t bn, struct gfs2_sbd *sbd)
 {
 	int ret = 0;
 	int state = 0;
-	struct rgrp_tree *rgd = gfs2_blk2rgrpd(sbd, bn);
+	struct rgrp_tree *rgd = lgfs2_blk2rgrpd(sbd, bn);
 	if (rgd == NULL) {
 		fprintf(stderr, "Could not find resource group for block %"PRIu64"\n", bn);
 		return -1;
 	}
 
-	ret = gfs2_rgrp_read(sbd, rgd);
+	ret = lgfs2_rgrp_read(sbd, rgd);
 	if (ret != 0) {
 		fprintf(stderr, "Failed to read resource group for block %"PRIu64": %d\n", bn, ret);
 		return -1;
@@ -383,7 +383,7 @@ static int ast_get_bitstate(uint64_t bn, struct gfs2_sbd *sbd)
 		return -1;
 	}
 
-	gfs2_rgrp_relse(sbd, rgd);
+	lgfs2_rgrp_relse(sbd, rgd);
 	return state;
 }
 
gfs2/libgfs2/libgfs2.h +8 -14
index 5eb08baf..b204b763 100644
@@ -490,9 +490,6 @@ extern int lgfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno);
 extern int lgfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd);
 extern int lgfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
 
-extern uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks,
-                                    uint32_t *ri_data) __attribute__((nonnull(3)));
-
 /* fs_ops.c */
 #define IS_LEAF     (1)
 #define IS_DINODE   (2)
@@ -746,20 +743,17 @@ extern int lgfs2_find_jhead(struct gfs2_inode *ip, struct lgfs2_log_header *head
 extern int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head);
 
 /* rgrp.c */
-extern int gfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd);
-extern struct rgrp_tree *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk);
+extern uint32_t lgfs2_rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks,
+                                    uint32_t *ri_data) __attribute__((nonnull(3)));
+extern int lgfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd);
+extern struct rgrp_tree *lgfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk);
 extern int lgfs2_rgrp_crc_check(char *buf);
 extern void lgfs2_rgrp_crc_set(char *buf);
-extern uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
-extern void gfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
-extern struct rgrp_tree *rgrp_insert(struct osi_root *rgtree,
+extern uint64_t lgfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
+extern void lgfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd);
+extern struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree,
 				     uint64_t rgblock);
-extern void gfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree);
-/* figure out the size of the given resource group, in blocks */
-static inline unsigned int rgrp_size(struct rgrp_tree *rgrp)
-{
-	return rgrp->rt_data + rgrp->rt_length;
-}
+extern void lgfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree);
 
 /* structures.c */
 extern int lgfs2_build_master(struct gfs2_sbd *sdp);
gfs2/libgfs2/rgrp.c +11 -11
index 39b8b69b..a359f2fe 100644
@@ -30,12 +30,12 @@ static void compute_bitmaps(lgfs2_rgrp_t rg, const unsigned bsize)
 }
 
 /**
- * gfs2_compute_bitstructs - Compute the bitmap sizes
+ * lgfs2_compute_bitstructs - Compute the bitmap sizes
  * bsize: Block size
  * rgd: The resource group descriptor
  * Returns: 0 on success, -1 on error
  */
-int gfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd)
+int lgfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd)
 {
 	uint32_t length = rgd->rt_length;
 	uint32_t bytes_left;
@@ -86,7 +86,7 @@ errbits:
  *
  * Returns: Ths resource group, or NULL if not found
  */
-struct rgrp_tree *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk)
+struct rgrp_tree *lgfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk)
 {
 	struct rgrp_tree *rgd = (struct rgrp_tree *)sdp->rgtree.osi_node;
 	while (rgd) {
@@ -183,11 +183,11 @@ void lgfs2_rgrp_crc_set(char *buf)
 }
 
 /**
- * gfs2_rgrp_read - read in the resource group information from disk.
+ * lgfs2_rgrp_read - read in the resource group information from disk.
  * @rgd - resource group structure
  * returns: 0 if no error, otherwise the block number that failed
  */
-uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+uint64_t lgfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 {
 	unsigned length = rgd->rt_length * sdp->sd_bsize;
 	off_t offset = rgd->rt_addr * sdp->sd_bsize;
@@ -227,7 +227,7 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 	return 0;
 }
 
-void gfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+void lgfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 {
 	if (rgd->bits == NULL)
 		return;
@@ -250,7 +250,7 @@ void gfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 		rgd->bits[i].bi_data = NULL;
 }
 
-struct rgrp_tree *rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
+struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
 {
 	struct osi_node **newn = &rgtree->osi_node, *parent = NULL;
 	struct rgrp_tree *data;
@@ -279,7 +279,7 @@ struct rgrp_tree *rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
 	return data;
 }
 
-void gfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree)
+void lgfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree)
 {
 	struct rgrp_tree *rgd;
 	struct osi_node *n;
@@ -289,7 +289,7 @@ void gfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree)
 	while ((n = osi_first(rgrp_tree))) {
 		rgd = (struct rgrp_tree *)n;
 
-		gfs2_rgrp_relse(sdp, rgd);
+		lgfs2_rgrp_relse(sdp, rgd);
 		free(rgd->bits);
 		rgd->bits = NULL;
 		osi_erase(&rgd->node, rgrp_tree);
@@ -523,7 +523,7 @@ void lgfs2_rgrps_free(lgfs2_rgrps_t *rgs)
  * needed for bitmaps. Also calculate the adjusted number of free data blocks
  * in the resource group and store it in *ri_data.
  */
-uint32_t rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks, uint32_t *ri_data)
+uint32_t lgfs2_rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks, uint32_t *ri_data)
 {
 	uint32_t mappable = 0;
 	uint32_t bitblocks = 0;
@@ -579,7 +579,7 @@ uint64_t lgfs2_rindex_entry_new(lgfs2_rgrps_t rgs, struct gfs2_rindex *ri, uint6
 	if (addr + len > rgs->sdp->device.length)
 		return 0;
 
-	ri_length = rgblocks2bitblocks(rgs->sdp->sd_bsize, len, &ri_data);
+	ri_length = lgfs2_rgblocks2bitblocks(rgs->sdp->sd_bsize, len, &ri_data);
 	ri->ri_addr = cpu_to_be64(addr);
 	ri->ri_length = cpu_to_be32(ri_length);
 	ri->ri_data = cpu_to_be32(ri_data);
gfs2/libgfs2/super.c +2 -2
index 15f89a30..da605ded 100644
@@ -228,7 +228,7 @@ int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
 				continue;
 			addr = prev_rgd->rt_data0 + prev_rgd->rt_data;
 		}
-		rgd = rgrp_insert(&sdp->rgtree, addr);
+		rgd = lgfs2_rgrp_insert(&sdp->rgtree, addr);
 		rgd->rt_length = be32_to_cpu(ri.ri_length);
 		rgd->rt_data0 = be64_to_cpu(ri.ri_data0);
 		rgd->rt_data = be32_to_cpu(ri.ri_data);
@@ -248,7 +248,7 @@ int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
 			prev_length = rgd->rt_addr - prev_rgd->rt_addr;
 		}
 
-		if(gfs2_compute_bitstructs(sdp->sd_bsize, rgd))
+		if(lgfs2_compute_bitstructs(sdp->sd_bsize, rgd))
 			*ok = 0;
 
 		(*rgcount)++;
Signature · 1 line
2.34.1
#8 lore raw

PATCH 8/21 libgfs2: Namespace improvements - super.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/convert/gfs2_convert.c |  2 +-
 gfs2/edit/hexedit.c         |  2 +-
 gfs2/edit/savemeta.c        |  2 +-
 gfs2/fsck/initialize.c      |  6 +++---
 gfs2/fsck/rgrepair.c        |  2 +-
 gfs2/libgfs2/gfs2l.c        |  4 ++--
 gfs2/libgfs2/libgfs2.h      |  8 ++++----
 gfs2/libgfs2/super.c        | 14 +++++++-------
 gfs2/mkfs/main_grow.c       |  2 +-
 tests/nukerg.c              |  2 +-
 10 files changed, 22 insertions(+), 22 deletions(-)
gfs2/convert/gfs2_convert.c +1 -1
index 1608b1ad..c6b388a6 100644
@@ -1526,7 +1526,7 @@ static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
 	struct osi_node *n, *next = NULL;
 	int ok;
 
-	if (rindex_read(sdp, &count1, &ok))
+	if (lgfs2_rindex_read(sdp, &count1, &ok))
 		goto fail;
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
gfs2/edit/hexedit.c +1 -1
index b0f110c1..fc1b5f4f 100644
@@ -939,7 +939,7 @@ static int read_rindex(void)
 
 	sbd.fssize = sbd.device.length;
 	if (sbd.md.riinode) /* If we found the rindex */
-		rindex_read(&sbd, &count, &ok);
+		lgfs2_rindex_read(&sbd, &count, &ok);
 
 	if (!OSI_EMPTY_ROOT(&sbd.rgtree)) {
 		struct rgrp_tree *rg = (struct rgrp_tree *)osi_last(&sbd.rgtree);
gfs2/edit/savemeta.c +1 -1
index 21c67989..ffb11342 100644
@@ -1254,7 +1254,7 @@ static int restore_super(struct metafd *mfd, void *buf, int printonly)
 	int ret;
 
 	lgfs2_sb_in(&sbd, buf);
-	ret = check_sb(buf);
+	ret = lgfs2_check_sb(buf);
 	if (ret < 0) {
 		fprintf(stderr, "Error: Invalid superblock in metadata file.\n");
 		return -1;
gfs2/fsck/initialize.c +3 -3
index 18522a35..2740fa7d 100644
@@ -721,7 +721,7 @@ static int fetch_rgrps_level(struct gfs2_sbd *sdp, enum rgindex_trust_level lvl,
 	if (rindex_repair(sdp, lvl, ok) != 0)
 		goto fail;
 
-	if (rindex_read(sdp, count, ok) != 0 || !*ok)
+	if (lgfs2_rindex_read(sdp, count, ok) != 0 || !*ok)
 		goto fail;
 
 	ret = read_rgrps(sdp, *count);
@@ -1345,12 +1345,12 @@ static int fill_super_block(struct gfs2_sbd *sdp)
 		log_crit("%s\n", _("Failed to compute file system constants"));
 		return FSCK_ERROR;
 	}
-	ret = read_sb(sdp);
+	ret = lgfs2_read_sb(sdp);
 	if (ret < 0) {
 		if (sb_repair(sdp) != 0)
 			return -1; /* unrepairable, so exit */
 		/* Now that we've tried to repair it, re-read it. */
-		ret = read_sb(sdp);
+		ret = lgfs2_read_sb(sdp);
 		if (ret < 0)
 			return FSCK_ERROR;
 	}
gfs2/fsck/rgrepair.c +1 -1
index 8c2dd35d..333a77a5 100644
@@ -999,7 +999,7 @@ int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
 	}
 	/* Read in the rindex */
 	sdp->rgtree.osi_node = NULL; /* Just to be safe */
-	rindex_read(sdp, &sdp->rgrps, ok);
+	lgfs2_rindex_read(sdp, &sdp->rgrps, ok);
 	if (sdp->md.riinode->i_size % sizeof(struct gfs2_rindex)) {
 		log_warn( _("WARNING: rindex file has an invalid size.\n"));
 		if (!query( _("Truncate the rindex size? (y/n)"))) {
gfs2/libgfs2/gfs2l.c +2 -2
index 2ec4a1a1..a247bed2 100644
@@ -132,7 +132,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
 	}
 	fix_device_geometry(sdp);
 
-	ret = read_sb(sdp);
+	ret = lgfs2_read_sb(sdp);
 	if (ret != 0) {
 		perror("Could not read sb");
 		return 1;
@@ -142,7 +142,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
 	lgfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
 	sdp->fssize = sdp->device.length;
 	if (sdp->md.riinode) {
-		rindex_read(sdp, &count, &ok);
+		lgfs2_rindex_read(sdp, &count, &ok);
 	} else {
 		perror("Failed to look up rindex");
 		return 1;
gfs2/libgfs2/libgfs2.h +4 -4
index b204b763..aede5cda 100644
@@ -778,10 +778,10 @@ extern struct gfs2_inode *lgfs2_build_statfs_change(struct gfs2_inode *per_node,
 extern struct gfs2_inode *lgfs2_build_quota_change(struct gfs2_inode *per_node, unsigned int j);
 
 /* super.c */
-extern int check_sb(void *sbp);
-extern int read_sb(struct gfs2_sbd *sdp);
-extern int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok);
-extern int write_sb(struct gfs2_sbd *sdp);
+extern int lgfs2_check_sb(void *sbp);
+extern int lgfs2_read_sb(struct gfs2_sbd *sdp);
+extern int lgfs2_rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok);
+extern int lgfs2_write_sb(struct gfs2_sbd *sdp);
 
 /* ondisk.c */
 extern uint32_t gfs2_disk_hash(const char *data, int len);
gfs2/libgfs2/super.c +7 -7
index da605ded..c8186b20 100644
@@ -13,7 +13,7 @@
 #include "osi_list.h"
 
 /**
- * check_sb - Check superblock
+ * lgfs2_check_sb - Check superblock
  * @sb: The superblock
  *
  * Checks the version code of the FS is one that we understand how to
@@ -22,7 +22,7 @@
  *
  * Returns: -1 on failure, 1 if this is gfs (gfs1), 2 if this is gfs2
  */
-int check_sb(void *sbp)
+int lgfs2_check_sb(void *sbp)
 {
 	struct gfs2_sb *sb = sbp;
 
@@ -48,7 +48,7 @@ int check_sb(void *sbp)
 
 
 /*
- * read_sb: read the super block from disk
+ * lgfs2_read_sb: read the super block from disk
  * sdp: in-core super block
  *
  * This function reads in the super block from disk and
@@ -58,7 +58,7 @@ int check_sb(void *sbp)
  * Returns: 0 on success, -1 on failure
  * sdp->gfs1 will be set if this is gfs (gfs1)
  */
-int read_sb(struct gfs2_sbd *sdp)
+int lgfs2_read_sb(struct gfs2_sbd *sdp)
 {
 	struct gfs2_buffer_head *bh;
 	uint64_t space = 0;
@@ -67,7 +67,7 @@ int read_sb(struct gfs2_sbd *sdp)
 
 	bh = lgfs2_bread(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
 
-	ret = check_sb(bh->b_data);
+	ret = lgfs2_check_sb(bh->b_data);
 	if (ret < 0) {
 		lgfs2_brelse(bh);
 		return ret;
@@ -191,14 +191,14 @@ static int good_on_disk(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 }
 
 /**
- * rindex_read - read in the rg index file
+ * lgfs2_rindex_read - read in the rg index file
  * @sdp: the incore superblock pointer
  * @rgcount: return count of the rgs.
  * @ok: return whether rindex is consistent
  *
  * Returns: 0 on success, -1 on failure
  */
-int rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
+int lgfs2_rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
 {
 	unsigned int rg;
 	int error;
gfs2/mkfs/main_grow.c +1 -1
index 4ce24c90..298ba2a6 100644
@@ -398,7 +398,7 @@ int main(int argc, char *argv[])
 			log_crit("%s\n", _("Failed to compute file system constants"));
 			exit(EXIT_FAILURE);
 		}
-		if (read_sb(sdp) < 0) {
+		if (lgfs2_read_sb(sdp) < 0) {
 			fprintf(stderr, _("Error reading superblock.\n"));
 			exit(EXIT_FAILURE);
 		}
tests/nukerg.c +1 -1
index 49bbda74..e24151ef 100644
@@ -284,7 +284,7 @@ static int fill_super_block(struct gfs2_sbd *sdp)
 		fprintf(stderr, "Failed to compute file system constants.\n");
 		return 1;
 	}
-	if (read_sb(sdp) != 0) {
+	if (lgfs2_read_sb(sdp) != 0) {
 		perror("Failed to read superblock\n");
 		return 1;
 	}
Signature · 1 line
2.34.1
#9 lore raw

PATCH 9/21 libgfs2: Namespace improvements - gfs2_disk_hash.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/fsck/pass2.c             |  2 +-
 gfs2/libgfs2/fs_ops.c         | 12 ++++++------
 gfs2/libgfs2/gfs2_disk_hash.c |  5 ++---
 gfs2/libgfs2/libgfs2.h        |  7 +++----
 gfs2/libgfs2/rgrp.c           |  4 ++--
 gfs2/libgfs2/structures.c     |  2 +-
 6 files changed, 15 insertions(+), 17 deletions(-)
gfs2/fsck/pass2.c +1 -1
index 3d732772..d394f6bf 100644
@@ -470,7 +470,7 @@ static int basic_dentry_checks(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 		return 1;
 	}
 
-	calculated_hash = gfs2_disk_hash(tmp_name, d->dr_name_len);
+	calculated_hash = lgfs2_disk_hash(tmp_name, d->dr_name_len);
 	if (d->dr_hash != calculated_hash){
 	        log_err( _("Dir entry with bad hash or name length\n"
 			   "\tHash found         = %u (0x%x)\n"
gfs2/libgfs2/fs_ops.c +6 -6
index 4e10ab4f..4e3736ca 100644
@@ -1148,7 +1148,7 @@ static int dir_e_add(struct gfs2_inode *dip, const char *filename, int len,
 	uint64_t leaf_no, bn;
 	int err = 0;
 
-	hash = gfs2_disk_hash(filename, len);
+	hash = lgfs2_disk_hash(filename, len);
 restart:
 	/* Have to kludge because (hash >> 32) gives hash for some reason. */
 	if (dip->i_depth)
@@ -1313,7 +1313,7 @@ static int dir_l_add(struct gfs2_inode *dip, const char *filename, int len,
 	}
 
 	lgfs2_inum_out(inum, &dent->de_inum);
-	de_hash = gfs2_disk_hash(filename, len);
+	de_hash = lgfs2_disk_hash(filename, len);
 	dent->de_hash = cpu_to_be32(de_hash);
 	dent->de_type = cpu_to_be16(type);
 	memcpy((char *)(dent + 1), filename, len);
@@ -1376,7 +1376,7 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, st
 		uint32_t hash;
 		uint16_t len;
 
-		hash = gfs2_disk_hash(".", 1);
+		hash = lgfs2_disk_hash(".", 1);
 		len = GFS2_DIRENT_SIZE(1);
 		de.de_inum = di->di_num;
 		de.de_hash = cpu_to_be32(hash);
@@ -1387,7 +1387,7 @@ static int __init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, st
 		p[sizeof(de)] = '.';
 		p += len;
 
-		hash = gfs2_disk_hash("..", 2);
+		hash = lgfs2_disk_hash("..", 2);
 		len = sdp->sd_bsize - (p - bh->b_data);
 		de.de_inum.no_formal_ino = cpu_to_be64(parent->in_formal_ino);
 		de.de_inum.no_addr = cpu_to_be64(parent->in_addr);
@@ -1598,7 +1598,7 @@ static int leaf_search(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
 	else
 		return -1;
 
-	hash = gfs2_disk_hash(filename, len);
+	hash = lgfs2_disk_hash(filename, len);
 
 	do{
 		if (!dent->de_inum.no_formal_ino){
@@ -1650,7 +1650,7 @@ static int linked_leaf_search(struct gfs2_inode *dip, const char *filename,
 
 	/*  Figure out the address of the leaf node.  */
 
-	hash = gfs2_disk_hash(filename, len);
+	hash = lgfs2_disk_hash(filename, len);
 	lindex = hash >> (32 - dip->i_depth);
 
 	error = get_first_leaf(dip, lindex, &bh_next);
gfs2/libgfs2/gfs2_disk_hash.c +2 -3
index 959f5ddc..07632a28 100644
@@ -40,7 +40,7 @@ static const uint32_t crc_32_tab[] =
 };
 
 /**
- * gfs2_disk_hash - hash an array of data
+ * lgfs2_disk_hash - hash an array of data
  * @data: the data to be hashed
  * @len: the length of data to be hashed
  *
@@ -59,7 +59,7 @@ static const uint32_t crc_32_tab[] =
  * Returns: the hash
  */
 
-uint32_t gfs2_disk_hash(const char *data, int len)
+uint32_t lgfs2_disk_hash(const char *data, int len)
 {
 	uint32_t hash = 0xFFFFFFFF;
 
@@ -71,4 +71,3 @@ uint32_t gfs2_disk_hash(const char *data, int len)
 	return hash;
 }
 
-
gfs2/libgfs2/libgfs2.h +3 -4
index aede5cda..5c2f1aa7 100644
@@ -783,11 +783,10 @@ extern int lgfs2_read_sb(struct gfs2_sbd *sdp);
 extern int lgfs2_rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok);
 extern int lgfs2_write_sb(struct gfs2_sbd *sdp);
 
-/* ondisk.c */
-extern uint32_t gfs2_disk_hash(const char *data, int len);
-
-/* Translation functions */
+/* gfs2_disk_hash.c */
+extern uint32_t lgfs2_disk_hash(const char *data, int len);
 
+/* ondisk.c */
 extern void lgfs2_inum_in(struct lgfs2_inum *i, void *inp);
 extern void lgfs2_inum_out(const struct lgfs2_inum *i, void *inp);
 extern void lgfs2_sb_in(struct gfs2_sbd *sdp, void *buf);
gfs2/libgfs2/rgrp.c +2 -2
index a359f2fe..78b6812a 100644
@@ -163,7 +163,7 @@ int lgfs2_rgrp_crc_check(char *buf)
 		return 0;
 
 	rg->rg_crc = 0;
-	if (be32_to_cpu(crc) != gfs2_disk_hash(buf, sizeof(struct gfs2_rgrp)))
+	if (be32_to_cpu(crc) != lgfs2_disk_hash(buf, sizeof(struct gfs2_rgrp)))
 		ret = 1;
 	rg->rg_crc = crc;
 	return ret;
@@ -178,7 +178,7 @@ void lgfs2_rgrp_crc_set(char *buf)
 	uint32_t crc;
 
 	rg->rg_crc = 0;
-	crc = gfs2_disk_hash(buf, sizeof(struct gfs2_rgrp));
+	crc = lgfs2_disk_hash(buf, sizeof(struct gfs2_rgrp));
 	rg->rg_crc = cpu_to_be32(crc);
 }
 
gfs2/libgfs2/structures.c +1 -1
index fc0a59cc..a0de2477 100644
@@ -81,7 +81,7 @@ uint32_t lgfs2_log_header_hash(char *buf)
 	/* lh_hash only CRCs the fields in the old lh, which ends where lh_crc is now */
 	const off_t v1_end = offsetof(struct gfs2_log_header, lh_hash) + 4;
 
-	return gfs2_disk_hash(buf, v1_end);
+	return lgfs2_disk_hash(buf, v1_end);
 }
 
 uint32_t lgfs2_log_header_crc(char *buf, unsigned bsize)
Signature · 1 line
2.34.1
#10 lore raw

PATCH 10/21 libgfs2: Remove revoke function declarations from libgfs2.h

In reply to Andrew Price

These functions are actually defined in fsck.gfs2 code and can be made static.

---
 gfs2/fsck/fs_recovery.c | 14 +++++++-------
 gfs2/libgfs2/libgfs2.h  |  4 ----
 2 files changed, 7 insertions(+), 11 deletions(-)
gfs2/fsck/fs_recovery.c +7 -7
index bd0fd731..5bd46301 100644
@@ -33,7 +33,7 @@ struct gfs2_revoke_replay {
 	unsigned int rr_where;
 };
 
-int gfs2_revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
+static int revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 {
 	osi_list_t *tmp, *head = &sd_revoke_list;
 	struct gfs2_revoke_replay *rr;
@@ -62,7 +62,7 @@ int gfs2_revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 	return 1;
 }
 
-int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
+static int revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 {
 	osi_list_t *tmp;
 	struct gfs2_revoke_replay *rr;
@@ -86,7 +86,7 @@ int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 	return (wrap) ? (a || b) : (a && b);
 }
 
-void gfs2_revoke_clean(struct gfs2_sbd *sdp)
+static void revoke_clean(struct gfs2_sbd *sdp)
 {
 	osi_list_t *head = &sd_revoke_list;
 	struct gfs2_revoke_replay *rr;
@@ -144,7 +144,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 
 		blkno = be64_to_cpu(*ptr);
 		ptr++;
-		if (gfs2_revoke_check(sdp, blkno, start))
+		if (revoke_check(sdp, blkno, start))
 			continue;
 
 		error = gfs2_replay_read_block(ip, start, &bh_log);
@@ -213,7 +213,7 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 			blkno = be64_to_cpu(*(__be64 *)(bh->b_data + offset));
 			log_info(_("Journal replay processing revoke for block #%"PRIu64" (0x%"PRIx64") for journal+0x%x\n"),
 			         blkno, blkno, start);
-			error = gfs2_revoke_add(sdp, blkno, start);
+			error = revoke_add(sdp, blkno, start);
 			if (error < 0)
 				return error;
 			else if (error)
@@ -255,7 +255,7 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 
 		sd_found_jblocks++;
 
-		if (gfs2_revoke_check(sdp, blkno, start))
+		if (revoke_check(sdp, blkno, start))
 			continue;
 
 		error = gfs2_replay_read_block(ip, start, &bh_log);
@@ -578,7 +578,7 @@ static int gfs2_recover_journal(struct gfs2_inode *ip, int j, int preen,
 		}
 	}
 	log_info( _("jid=%u: Found %u revoke tags\n"), j, sd_found_revokes);
-	gfs2_revoke_clean(sdp);
+	revoke_clean(sdp);
 	error = lgfs2_clean_journal(ip, &head);
 	if (error)
 		goto out;
gfs2/libgfs2/libgfs2.h +0 -4
index 5c2f1aa7..e9e0c184 100644
@@ -733,10 +733,6 @@ extern int lgfs2_open_mnt_dir(const char *path, int flags, struct mntent **mnt);
 extern void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk);
 extern int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
 				  struct gfs2_buffer_head **bh);
-extern int gfs2_revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where);
-extern int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno,
-			     unsigned int where);
-extern void gfs2_revoke_clean(struct gfs2_sbd *sdp);
 extern int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
                                 struct lgfs2_log_header *head);
 extern int lgfs2_find_jhead(struct gfs2_inode *ip, struct lgfs2_log_header *head);
Signature · 1 line
2.34.1
#11 lore raw

PATCH 11/21 libgfs2: Namespace improvements - recovery.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/fsck/fs_recovery.c | 22 +++++++++++-----------
 gfs2/libgfs2/libgfs2.h  |  4 ++--
 gfs2/libgfs2/recovery.c |  8 ++++----
 3 files changed, 17 insertions(+), 17 deletions(-)
gfs2/fsck/fs_recovery.c +11 -11
index 5bd46301..4a2d1259 100644
@@ -135,9 +135,9 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA)
 		return 0;
 
-	gfs2_replay_incr_blk(ip, &start);
+	lgfs2_replay_incr_blk(ip, &start);
 
-	for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
+	for (; blks; lgfs2_replay_incr_blk(ip, &start), blks--) {
 		struct gfs2_meta_header *mhp;
 
 		sd_found_metablocks++;
@@ -147,7 +147,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 		if (revoke_check(sdp, blkno, start))
 			continue;
 
-		error = gfs2_replay_read_block(ip, start, &bh_log);
+		error = lgfs2_replay_read_block(ip, start, &bh_log);
 		if (error)
 			return error;
 
@@ -200,8 +200,8 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 
 	offset = sizeof(struct gfs2_log_descriptor);
 
-	for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
-		error = gfs2_replay_read_block(ip, start, &bh);
+	for (; blks; lgfs2_replay_incr_blk(ip, &start), blks--) {
+		error = lgfs2_replay_read_block(ip, start, &bh);
 		if (error)
 			return error;
 
@@ -246,8 +246,8 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_JDATA)
 		return 0;
 
-	gfs2_replay_incr_blk(ip, &start);
-	for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
+	lgfs2_replay_incr_blk(ip, &start);
+	for (; blks; lgfs2_replay_incr_blk(ip, &start), blks--) {
 		blkno = be64_to_cpu(*ptr);
 		ptr++;
 		esc = be64_to_cpu(*ptr);
@@ -258,7 +258,7 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 		if (revoke_check(sdp, blkno, start))
 			continue;
 
-		error = gfs2_replay_read_block(ip, start, &bh_log);
+		error = lgfs2_replay_read_block(ip, start, &bh_log);
 		if (error)
 			return error;
 
@@ -313,7 +313,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
 	while (start != end) {
 		struct gfs2_meta_header *mhp;
 
-		error = gfs2_replay_read_block(ip, start, &bh);
+		error = lgfs2_replay_read_block(ip, start, &bh);
 		if (error)
 			return error;
 		mhp = (struct gfs2_meta_header *)bh->b_data;
@@ -330,7 +330,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
 
 			error = lgfs2_get_log_header(ip, start, &lh);
 			if (!error) {
-				gfs2_replay_incr_blk(ip, &start);
+				lgfs2_replay_incr_blk(ip, &start);
 				lgfs2_bmodified(bh);
 				lgfs2_brelse(bh);
 				continue;
@@ -369,7 +369,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
 		}
 
 		while (length--)
-			gfs2_replay_incr_blk(ip, &start);
+			lgfs2_replay_incr_blk(ip, &start);
 
 		lgfs2_bmodified(bh);
 		lgfs2_brelse(bh);
gfs2/libgfs2/libgfs2.h +2 -2
index e9e0c184..d091e180 100644
@@ -730,8 +730,8 @@ extern int lgfs2_open_mnt_dev(const char *path, int flags, struct mntent **mnt);
 extern int lgfs2_open_mnt_dir(const char *path, int flags, struct mntent **mnt);
 
 /* recovery.c */
-extern void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk);
-extern int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
+extern void lgfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk);
+extern int lgfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
 				  struct gfs2_buffer_head **bh);
 extern int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
                                 struct lgfs2_log_header *head);
gfs2/libgfs2/recovery.c +4 -4
index 3984e1e3..483661e4 100644
@@ -14,7 +14,7 @@
 #include <string.h>
 #include "libgfs2.h"
 
-void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
+void lgfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
 {
 	uint32_t jd_blocks = ip->i_size / ip->i_sbd->sd_bsize;
 
@@ -22,7 +22,7 @@ void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
                 *blk = 0;
 }
 
-int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
+int lgfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
 			   struct gfs2_buffer_head **bh)
 {
 	int new = 0;
@@ -77,7 +77,7 @@ int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
 	uint32_t crc;
 	int error;
 
-	error = gfs2_replay_read_block(ip, blk, &bh);
+	error = lgfs2_replay_read_block(ip, blk, &bh);
 	if (error)
 		return error;
 
@@ -240,7 +240,7 @@ int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head)
 	uint64_t dblock;
 
 	lblock = head->lh_blkno;
-	gfs2_replay_incr_blk(ip, &lblock);
+	lgfs2_replay_incr_blk(ip, &lblock);
 	lgfs2_block_map(ip, lblock, &new, &dblock, NULL, 0);
 	if (!dblock)
 		return -EIO;
Signature · 1 line
2.34.1
#12 lore raw

PATCH 12/21 libgfs2: Namespace improvements - device_geometry.c

In reply to Andrew Price

Use the lgfs2_ prefix in libgfs2 interface names.

---
 gfs2/edit/hexedit.c            | 2 +-
 gfs2/fsck/rgrepair.c           | 2 +-
 gfs2/libgfs2/device_geometry.c | 2 +-
 gfs2/libgfs2/gfs2l.c           | 2 +-
 gfs2/libgfs2/libgfs2.h         | 2 +-
 gfs2/mkfs/main_grow.c          | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
gfs2/edit/hexedit.c +1 -1
index fc1b5f4f..3415b41f 100644
@@ -909,7 +909,7 @@ static void read_superblock(int fd)
 	else {
 		block = starting_blk = 0;
 	}
-	fix_device_geometry(&sbd);
+	lgfs2_fix_device_geometry(&sbd);
 	if(sbd.gfs1) {
 		sbd.sd_inptrs = (sbd.sd_bsize - sizeof(struct gfs_indirect)) /
 			sizeof(uint64_t);
gfs2/fsck/rgrepair.c +1 -1
index 333a77a5..37d20aed 100644
@@ -818,7 +818,7 @@ static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, int *num_rgs)
 	*num_rgs = sdp->md.riinode->i_size / sizeof(struct gfs2_rindex);
 
 	rgcalc.osi_node = NULL;
-	fix_device_geometry(sdp);
+	lgfs2_fix_device_geometry(sdp);
 
 	/* Try all possible rgrp sizes: 2048, 1024, 512, 256, 128, 64, 32 */
 	for (sdp->rgsize = GFS2_DEFAULT_RGSIZE; sdp->rgsize >= 32;
gfs2/libgfs2/device_geometry.c +1 -1
index cb1ed6d5..86ad84bd 100644
@@ -92,7 +92,7 @@ size_check:
  *
  */
 
-void fix_device_geometry(struct gfs2_sbd *sdp)
+void lgfs2_fix_device_geometry(struct gfs2_sbd *sdp)
 {
 	struct device *device = &sdp->device;
 
gfs2/libgfs2/gfs2l.c +1 -1
index a247bed2..b8c4ca41 100644
@@ -130,7 +130,7 @@ static int openfs(const char *path, struct gfs2_sbd *sdp)
 		perror("Failed to gather device info");
 		return 1;
 	}
-	fix_device_geometry(sdp);
+	lgfs2_fix_device_geometry(sdp);
 
 	ret = lgfs2_read_sb(sdp);
 	if (ret != 0) {
gfs2/libgfs2/libgfs2.h +1 -1
index d091e180..39097e68 100644
@@ -473,7 +473,7 @@ extern uint32_t lgfs2_get_block_type(const char *buf);
 
 /* device_geometry.c */
 extern int lgfs2_get_dev_info(int fd, struct lgfs2_dev_info *i);
-extern void fix_device_geometry(struct gfs2_sbd *sdp);
+extern void lgfs2_fix_device_geometry(struct gfs2_sbd *sdp);
 
 /* fs_bits.c */
 #define BFITNOENT (0xFFFFFFFF)
gfs2/mkfs/main_grow.c +1 -1
index 298ba2a6..b2959285 100644
@@ -406,7 +406,7 @@ int main(int argc, char *argv[])
 			fprintf(stderr, _("cannot grow gfs1 filesystem\n"));
 			exit(EXIT_FAILURE);
 		}
-		fix_device_geometry(sdp);
+		lgfs2_fix_device_geometry(sdp);
 		mfs.context = copy_context_opt(mnt);
 		if (mount_gfs2_meta(&mfs, mnt->mnt_dir, (print_level > MSG_NOTICE))) {
 			perror(_("Failed to mount GFS2 meta file system"));
Signature · 1 line
2.34.1
#13 lore raw

PATCH 13/21 libgfs2: Namespace improvements - struct gfs2_inode

In reply to Andrew Price

Rename to struct lgfs2_inode.

---
 gfs2/convert/gfs2_convert.c   |  46 ++++++------
 gfs2/edit/extended.c          |  14 ++--
 gfs2/edit/hexedit.c           |   4 +-
 gfs2/edit/journal.c           |   8 +--
 gfs2/edit/savemeta.c          |   4 +-
 gfs2/fsck/afterpass1_common.c |  24 +++----
 gfs2/fsck/afterpass1_common.h |  12 ++--
 gfs2/fsck/fs_recovery.c       |  28 ++++----
 gfs2/fsck/fsck.h              |  10 +--
 gfs2/fsck/initialize.c        |  20 +++---
 gfs2/fsck/link.c              |   6 +-
 gfs2/fsck/link.h              |   4 +-
 gfs2/fsck/lost_n_found.c      |   8 +--
 gfs2/fsck/lost_n_found.h      |   4 +-
 gfs2/fsck/main.c              |   2 +-
 gfs2/fsck/metawalk.c          |  58 +++++++--------
 gfs2/fsck/metawalk.h          |  48 ++++++-------
 gfs2/fsck/pass1.c             | 112 ++++++++++++++---------------
 gfs2/fsck/pass1b.c            |  34 ++++-----
 gfs2/fsck/pass2.c             |  74 +++++++++----------
 gfs2/fsck/pass3.c             |   4 +-
 gfs2/fsck/pass4.c             |   6 +-
 gfs2/fsck/rgrepair.c          |   2 +-
 gfs2/fsck/util.c              |  10 +--
 gfs2/fsck/util.h              |  14 ++--
 gfs2/glocktop/glocktop.c      |   4 +-
 gfs2/libgfs2/fs_ops.c         |  98 ++++++++++++-------------
 gfs2/libgfs2/gfs1.c           |  22 +++---
 gfs2/libgfs2/lang.c           |   2 +-
 gfs2/libgfs2/libgfs2.h        | 130 +++++++++++++++++-----------------
 gfs2/libgfs2/ondisk.c         |   4 +-
 gfs2/libgfs2/recovery.c       |  14 ++--
 gfs2/libgfs2/rgrp.c           |   2 +-
 gfs2/libgfs2/structures.c     |  44 ++++++------
 gfs2/mkfs/main_mkfs.c         |  10 +--
 35 files changed, 443 insertions(+), 443 deletions(-)
gfs2/convert/gfs2_convert.c +23 -23
index c6b388a6..21611b1a 100644
@@ -186,7 +186,7 @@ static int convert_rgs(struct gfs2_sbd *sbp)
 /* This is similar to lgfs2_calc_tree_height in libgfs2 but at the point this      */
 /* function is called, I have the wrong (gfs1 not gfs2) constants in place.  */
 /* ------------------------------------------------------------------------- */
-static unsigned int calc_gfs2_tree_height(struct gfs2_inode *ip, uint64_t size)
+static unsigned int calc_gfs2_tree_height(struct lgfs2_inode *ip, uint64_t size)
 {
 	uint64_t *arr;
 	unsigned int max, height;
@@ -258,7 +258,7 @@ static void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 /*                interested in rearranging the metadata while leaving the   */
 /*                actual data blocks intact.                                 */
 /* ------------------------------------------------------------------------- */
-static void fix_metatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
+static void fix_metatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
 		  struct blocklist *blk, __be64 *first_nonzero_ptr,
 		  unsigned int size)
 {
@@ -416,7 +416,7 @@ static void jdata_mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 	}
 }
 
-static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
+static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
 			      struct blocklist *blk, char *srcptr,
 			      unsigned int size)
 {
@@ -485,7 +485,7 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 	return block;
 }
 
-static int get_inode_metablocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip, struct blocklist *blocks)
+static int get_inode_metablocks(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, struct blocklist *blocks)
 {
 	struct blocklist *blk, *newblk;
 	struct gfs2_buffer_head *bh, *dibh = ip->i_bh;
@@ -569,7 +569,7 @@ static int get_inode_metablocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip, str
 	return 0;
 }
 
-static int fix_ind_reg_or_dir(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint32_t di_height,
+static int fix_ind_reg_or_dir(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t di_height,
 		       uint32_t gfs2_hgt, struct blocklist *blk, struct blocklist *blocks)
 {
 	unsigned int len, bufsize;
@@ -611,7 +611,7 @@ static int fix_ind_reg_or_dir(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint3
 	return 0;
 }
 
-static int fix_ind_jdata(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint32_t di_height, 
+static int fix_ind_jdata(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t di_height, 
 		  uint32_t gfs2_hgt, uint64_t dinode_size, struct blocklist *blk, 
 		  struct blocklist *blocks)
 {
@@ -681,7 +681,7 @@ static int fix_ind_jdata(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint32_t d
 	return 0;
 }
 
-static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip)
+static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct lgfs2_inode *ip)
 {
 	uint64_t dinode_size;
 	uint32_t gfs2_hgt, di_height;
@@ -774,7 +774,7 @@ static int has_cdpn(const char *str)
 	return 0;
 }
 
-static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct gfs2_inode *ip)
+static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct lgfs2_inode *ip)
 {
 	char *linkptr = NULL;
 
@@ -809,7 +809,7 @@ static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, s
  * to fix the header. gfs1 uses gfs_indirect as the header which is 64 bytes
  * bigger than gfs2_meta_header that gfs2 uses.
  */
-static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct gfs2_inode *ip)
+static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct lgfs2_inode *ip)
 {
 	int len, old_hdr_sz, new_hdr_sz;
 	struct gfs2_buffer_head *eabh;
@@ -845,7 +845,7 @@ static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct g
 /* ------------------------------------------------------------------------- */
 static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
 {
-	struct gfs2_inode *inode;
+	struct lgfs2_inode *inode;
 	struct inode_block *fixdir;
 	int inode_was_gfs1;
 
@@ -1102,7 +1102,7 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
 		      struct lgfs2_inum *inum, uint64_t *eablk)
 {
-	struct gfs2_inode *fix_inode;
+	struct lgfs2_inode *fix_inode;
 
 	fix_inode = lgfs2_inode_read(sbp, iblock);
 	if (fix_inode == NULL)
@@ -1124,7 +1124,7 @@ static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure, -EISDIR when dentmod marked DT_DIR  */
 /* ------------------------------------------------------------------------- */
-static int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
+static int process_dirent_info(struct lgfs2_inode *dip, struct gfs2_sbd *sbp,
 			       struct gfs2_buffer_head *bh, int dir_entries, uint64_t dentmod)
 {
 	int error = 0;
@@ -1244,7 +1244,7 @@ static int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip, uint64_t dentmod)
+static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct lgfs2_inode *dip, uint64_t dentmod)
 {
 	struct gfs2_buffer_head *bh_leaf;
 	int error;
@@ -1298,7 +1298,7 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip
 
 static int process_directory(struct gfs2_sbd *sbp, uint64_t dirblock, uint64_t dentmod)
 {
-	struct gfs2_inode *dip;
+	struct lgfs2_inode *dip;
 	int error = 0;
 	/* read in the directory inode */
 	dip = lgfs2_inode_read(sbp, dirblock);
@@ -1383,7 +1383,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
 		struct lgfs2_inum fix, dir;
 		struct inode_dir_block *l_fix;
 		struct gfs2_buffer_head *bh = NULL;
-		struct gfs2_inode *fix_inode;
+		struct lgfs2_inode *fix_inode;
 		uint64_t eablk;
 
 		l_fix = osi_list_entry(tmp, struct inode_dir_block, list);
@@ -1434,7 +1434,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
 /* ------------------------------------------------------------------------- */
 static int read_gfs1_jiindex(struct gfs2_sbd *sdp)
 {
-	struct gfs2_inode *ip = sdp->md.jiinode;
+	struct lgfs2_inode *ip = sdp->md.jiinode;
 	char buf[sizeof(struct gfs_jindex)];
 	unsigned int j;
 	int error=0;
@@ -1896,7 +1896,7 @@ static int journ_space_to_rg(struct gfs2_sbd *sdp)
 /* ------------------------------------------------------------------------- */
 static void update_inode_file(struct gfs2_sbd *sdp)
 {
-	struct gfs2_inode *ip = sdp->md.inum;
+	struct lgfs2_inode *ip = sdp->md.inum;
 	__be64 buf;
 	int count;
 
@@ -1915,7 +1915,7 @@ static void update_inode_file(struct gfs2_sbd *sdp)
  */
 static void write_statfs_file(struct gfs2_sbd *sdp)
 {
-	struct gfs2_inode *ip = sdp->md.statfs;
+	struct lgfs2_inode *ip = sdp->md.statfs;
 	struct gfs2_statfs_change sc;
 	int count;
 
@@ -1970,7 +1970,7 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
 	}
 
 	sdp->md.journal = malloc(sdp->md.journals *
-				 sizeof(struct gfs2_inode *));
+				 sizeof(struct lgfs2_inode *));
 	if (sdp->md.journal == NULL) {
 		return errno;
 	}
@@ -2088,7 +2088,7 @@ static int check_fit(struct gfs2_sbd *sdp)
 
 static int build_per_node(struct gfs2_sbd *sdp)
 {
-	struct gfs2_inode *per_node;
+	struct lgfs2_inode *per_node;
 	unsigned int j;
 
 	per_node = lgfs2_createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
@@ -2098,7 +2098,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
 		return -1;
 	}
 	for (j = 0; j < sdp->md.journals; j++) {
-		struct gfs2_inode *ip;
+		struct lgfs2_inode *ip;
 
 		ip = lgfs2_build_inum_range(per_node, j);
 		if (ip == NULL) {
@@ -2136,7 +2136,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
 static void copy_quotas(struct gfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
-	struct gfs2_inode *oq_ip, *nq_ip;
+	struct lgfs2_inode *oq_ip, *nq_ip;
 	int err;
 
 	err = lgfs2_lookupi(sdp->master_dir, "quota", 5, &nq_ip);
@@ -2295,7 +2295,7 @@ int main(int argc, char **argv)
 	/* Create our system files and directories.       */
 	/* ---------------------------------------------- */
 	if (!error) {
-		struct gfs2_inode *ip;
+		struct lgfs2_inode *ip;
 		int jreduce = 0;
 
 		/* Now we've got to treat it as a gfs2 file system */
gfs2/edit/extended.c +7 -7
index ee410220..8aed9fa9 100644
@@ -421,7 +421,7 @@ static void print_block_details(struct iinfo *ind, int level, int cur_height,
 	free(more_indir);
 }
 
-static int print_gfs_jindex(struct gfs2_inode *dij)
+static int print_gfs_jindex(struct lgfs2_inode *dij)
 {
 	int error, start_line;
 	struct gfs_jindex *ji;
@@ -464,7 +464,7 @@ static int print_gfs2_jindex(void)
 {
 	int d, error;
 	struct lgfs2_log_header head;
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 
 	for (d = 0; d < indirect->ii[0].dirents; d++) {
 		if (strncmp(indirect->ii[0].dirent[d].filename, "journal", 7))
@@ -489,7 +489,7 @@ static int print_gfs2_jindex(void)
 	return 0;
 }
 
-static int parse_rindex(struct gfs2_inode *dip, int print_rindex)
+static int parse_rindex(struct lgfs2_inode *dip, int print_rindex)
 {
 	int error, start_line;
 	struct gfs2_rindex ri;
@@ -550,7 +550,7 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex)
 	return error;
 }
 
-static int print_inum(struct gfs2_inode *dii)
+static int print_inum(struct lgfs2_inode *dii)
 {
 	uint64_t inodenum;
 	__be64 inum;
@@ -573,7 +573,7 @@ static int print_inum(struct gfs2_inode *dii)
 	return 0;
 }
 
-static int print_statfs(struct gfs2_inode *dis)
+static int print_statfs(struct lgfs2_inode *dis)
 {
 	struct gfs2_statfs_change sc;
 	int rc;
@@ -595,7 +595,7 @@ static int print_statfs(struct gfs2_inode *dis)
 	return 0;
 }
 
-static int print_quota(struct gfs2_inode *diq)
+static int print_quota(struct lgfs2_inode *diq)
 {
 	struct gfs2_quota q;
 	int i, error;
@@ -622,7 +622,7 @@ static int print_quota(struct gfs2_inode *diq)
 
 int display_extended(void)
 {
-	struct gfs2_inode *tmp_inode;
+	struct lgfs2_inode *tmp_inode;
 	struct gfs2_buffer_head *tmp_bh;
 
 	dsplines = termlines - line - 1;
gfs2/edit/hexedit.c +2 -2
index 3415b41f..f2c54b04 100644
@@ -700,7 +700,7 @@ static void rgcount(void)
 /* ------------------------------------------------------------------------ */
 /* find_rgrp_block - locate the block for a given rgrp number               */
 /* ------------------------------------------------------------------------ */
-static uint64_t find_rgrp_block(struct gfs2_inode *dif, int rg)
+static uint64_t find_rgrp_block(struct lgfs2_inode *dif, int rg)
 {
 	int amt;
 	struct gfs2_rindex ri;
@@ -727,7 +727,7 @@ static uint64_t find_rgrp_block(struct gfs2_inode *dif, int rg)
 static uint64_t get_rg_addr(int rgnum)
 {
 	uint64_t rgblk = 0, gblock;
-	struct gfs2_inode *riinode;
+	struct lgfs2_inode *riinode;
 
 	if (sbd.gfs1)
 		gblock = sbd.sd_rindex_di.in_addr;
gfs2/edit/journal.c +4 -4
index 2bc94514..b083e6dd 100644
@@ -54,7 +54,7 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
 		do_dinode_extended(jindex_bh->b_data); /* parse dir. */
 
 	if (sbd.gfs1) {
-		struct gfs2_inode *jiinode;
+		struct lgfs2_inode *jiinode;
 		struct gfs_jindex jidx;
 
 		jiinode = lgfs2_inode_get(&sbd, jindex_bh);
@@ -102,7 +102,7 @@ static void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
  * fsck_readi - same as libgfs2's lgfs2_readi, but sets absolute block #
  *              of the first bit of data read.
  */
-static int fsck_readi(struct gfs2_inode *ip, void *rbuf, uint64_t roffset,
+static int fsck_readi(struct lgfs2_inode *ip, void *rbuf, uint64_t roffset,
 	       unsigned int size, uint64_t *abs_block)
 {
 	struct gfs2_sbd *sdp;
@@ -317,7 +317,7 @@ static int is_wrap_pt(void *buf, uint64_t *highest_seq)
  * find_wrap_pt - figure out where a journal wraps
  * Returns: The wrap point, in bytes
  */
-static uint64_t find_wrap_pt(struct gfs2_inode *ji, char *jbuf, uint64_t jblock, uint64_t j_size)
+static uint64_t find_wrap_pt(struct lgfs2_inode *ji, char *jbuf, uint64_t jblock, uint64_t j_size)
 {
 	uint64_t jb = 0;
 	uint64_t highest_seq = 0;
@@ -505,7 +505,7 @@ void dump_journal(const char *journal, uint64_t tblk)
 	struct gfs2_buffer_head *j_bh = NULL;
 	uint64_t jblock, j_size, jb, abs_block, saveblk, wrappt = 0;
 	int start_line, journal_num;
-	struct gfs2_inode *j_inode = NULL;
+	struct lgfs2_inode *j_inode = NULL;
 	int ld_blocks = 0, offset_from_ld = 0;
 	uint64_t tblk_off = 0, bblk_off = 0, bitblk = 0;
 	uint64_t highest_seq = 0;
gfs2/edit/savemeta.c +2 -2
index ffb11342..aa4c1296 100644
@@ -266,7 +266,7 @@ static int insert_per_node_lookup(uint64_t blk)
 static int init_per_node_lookup(void)
 {
 	int i;
-	struct gfs2_inode *per_node_di;
+	struct lgfs2_inode *per_node_di;
 
 	if (sbd.gfs1)
 		return FALSE;
@@ -945,7 +945,7 @@ static void get_journal_inode_blocks(void)
 	for (journal = 0; ; journal++) { /* while journals exist */
 		uint64_t jblock;
 		int amt;
-		struct gfs2_inode *j_inode = NULL;
+		struct lgfs2_inode *j_inode = NULL;
 
 		if (sbd.gfs1) {
 			struct gfs_jindex *ji;
gfs2/fsck/afterpass1_common.c +12 -12
index 04249e10..6ce2dfd2 100644
@@ -22,7 +22,7 @@
  *
  * Returns: 1 if there are any remaining references to this block, else 0.
  */
-static int find_remove_dup(struct gfs2_inode *ip, uint64_t block,
+static int find_remove_dup(struct lgfs2_inode *ip, uint64_t block,
 			   const char *btype, int *removed_last_meta)
 {
 	struct duptree *dt;
@@ -73,7 +73,7 @@ more_refs:
  * If it has been identified as duplicate, remove the duplicate reference.
  * If all duplicate references have been removed, delete the block.
  */
-static int delete_block_if_notdup(struct gfs2_inode *ip, uint64_t block,
+static int delete_block_if_notdup(struct lgfs2_inode *ip, uint64_t block,
 				  struct gfs2_buffer_head **bh,
 				  const char *btype, int *was_duplicate,
 				  void *private)
@@ -109,7 +109,7 @@ static int delete_block_if_notdup(struct gfs2_inode *ip, uint64_t block,
 	return META_IS_GOOD;
 }
 
-static int remove_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
+static int remove_dentry(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			 struct gfs2_dirent *prev_de,
 			 struct gfs2_buffer_head *bh,
 			 char *filename, uint32_t *count, int *lindex,
@@ -135,7 +135,7 @@ int remove_dentry_from_dir(struct gfs2_sbd *sdp, uint64_t dir,
 			   uint64_t dentryblock)
 {
 	struct metawalk_fxns remove_dentry_fxns = {0};
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	int q;
 	int error;
 
@@ -169,7 +169,7 @@ int remove_dentry_from_dir(struct gfs2_sbd *sdp, uint64_t dir,
 int delete_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, int h, int *is_valid,
 		    int *was_duplicate, void *private)
 {
-	struct gfs2_inode *ip = iptr.ipt_ip;
+	struct lgfs2_inode *ip = iptr.ipt_ip;
 	uint64_t block = iptr_block(iptr);
 
 	*is_valid = 1;
@@ -178,13 +178,13 @@ int delete_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, int h, int *
 				      was_duplicate, private);
 }
 
-int delete_leaf(struct gfs2_inode *ip, uint64_t block, void *private)
+int delete_leaf(struct lgfs2_inode *ip, uint64_t block, void *private)
 {
 	return delete_block_if_notdup(ip, block, NULL, _("leaf"), NULL,
 				      private);
 }
 
-int delete_data(struct gfs2_inode *ip, uint64_t metablock,
+int delete_data(struct lgfs2_inode *ip, uint64_t metablock,
 		uint64_t block, void *private, struct gfs2_buffer_head *bh,
 		__be64 *ptr)
 {
@@ -192,7 +192,7 @@ int delete_data(struct gfs2_inode *ip, uint64_t metablock,
 				      private);
 }
 
-static int del_eattr_generic(struct gfs2_inode *ip, uint64_t block,
+static int del_eattr_generic(struct lgfs2_inode *ip, uint64_t block,
 			     uint64_t parent, struct gfs2_buffer_head **bh,
 			     void *private, const char *eatype)
 {
@@ -223,21 +223,21 @@ static int del_eattr_generic(struct gfs2_inode *ip, uint64_t block,
 	return ret;
 }
 
-int delete_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
+int delete_eattr_indir(struct lgfs2_inode *ip, uint64_t block, uint64_t parent,
 		       struct gfs2_buffer_head **bh, void *private)
 {
 	return del_eattr_generic(ip, block, parent, bh, private,
 				 _("extended attribute"));
 }
 
-int delete_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
+int delete_eattr_leaf(struct lgfs2_inode *ip, uint64_t block, uint64_t parent,
 		      struct gfs2_buffer_head **bh, void *private)
 {
 	return del_eattr_generic(ip, block, parent, bh, private,
 				 _("indirect extended attribute"));
 }
 
-int delete_eattr_entry(struct gfs2_inode *ip, struct gfs2_buffer_head *leaf_bh,
+int delete_eattr_entry(struct lgfs2_inode *ip, struct gfs2_buffer_head *leaf_bh,
 		       struct gfs2_ea_header *ea_hdr,
 		       struct gfs2_ea_header *ea_hdr_prev, void *private)
 {
@@ -277,7 +277,7 @@ int delete_eattr_entry(struct gfs2_inode *ip, struct gfs2_buffer_head *leaf_bh,
 	return 0;
 }
 
-int delete_eattr_extentry(struct gfs2_inode *ip, int i, __be64 *ea_data_ptr,
+int delete_eattr_extentry(struct lgfs2_inode *ip, int i, __be64 *ea_data_ptr,
 			  struct gfs2_buffer_head *leaf_bh, uint32_t tot_ealen,
 			  struct gfs2_ea_header *ea_hdr,
 			  struct gfs2_ea_header *ea_hdr_prev, void *private)
gfs2/fsck/afterpass1_common.h +6 -6
index 51cb2140..7b5fda25 100644
@@ -6,20 +6,20 @@
 
 extern int delete_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, int h, int *is_valid,
 			   int *was_duplicate, void *private);
-extern int delete_leaf(struct gfs2_inode *ip, uint64_t block, void *private);
-extern int delete_data(struct gfs2_inode *ip, uint64_t metablock,
+extern int delete_leaf(struct lgfs2_inode *ip, uint64_t block, void *private);
+extern int delete_data(struct lgfs2_inode *ip, uint64_t metablock,
 		       uint64_t block, void *private,
 		       struct gfs2_buffer_head *bh, __be64 *ptr);
-extern int delete_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
+extern int delete_eattr_indir(struct lgfs2_inode *ip, uint64_t block, uint64_t parent,
 		       struct gfs2_buffer_head **bh, void *private);
-extern int delete_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
+extern int delete_eattr_leaf(struct lgfs2_inode *ip, uint64_t block, uint64_t parent,
 		      struct gfs2_buffer_head **bh, void *private);
-extern int delete_eattr_entry(struct gfs2_inode *ip,
+extern int delete_eattr_entry(struct lgfs2_inode *ip,
 			      struct gfs2_buffer_head *leaf_bh,
 			      struct gfs2_ea_header *ea_hdr,
 			      struct gfs2_ea_header *ea_hdr_prev,
 			      void *private);
-extern int delete_eattr_extentry(struct gfs2_inode *ip, int i,
+extern int delete_eattr_extentry(struct lgfs2_inode *ip, int i,
 				 __be64 *ea_data_ptr,
 				 struct gfs2_buffer_head *leaf_bh,
 				 uint32_t tot_ealen,
gfs2/fsck/fs_recovery.c +14 -14
index 4a2d1259..c5f82e47 100644
@@ -121,7 +121,7 @@ static void refresh_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 	}
 }
 
-static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
+static int buf_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 				struct gfs2_log_descriptor *ld, __be64 *ptr,
 				int pass)
 {
@@ -182,7 +182,7 @@ static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 	return error;
 }
 
-static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
+static int revoke_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 				   struct gfs2_log_descriptor *ld, __be64 *ptr,
 				   int pass)
 {
@@ -232,7 +232,7 @@ static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
 	return 0;
 }
 
-static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
+static int databuf_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 				    struct gfs2_log_descriptor *ld,
 				    __be64 *ptr, int pass)
 {
@@ -298,7 +298,7 @@ static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
  * Returns: errno
  */
 
-static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
+static int foreach_descriptor(struct lgfs2_inode *ip, unsigned int start,
 		       unsigned int end, int pass)
 {
 	struct gfs2_buffer_head *bh;
@@ -385,7 +385,7 @@ static int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
  *
  * Returns: The number of sequencing errors (hopefully none).
  */
-static int check_journal_seq_no(struct gfs2_inode *ip, int fix)
+static int check_journal_seq_no(struct lgfs2_inode *ip, int fix)
 {
 	int error = 0, wrapped = 0;
 	uint32_t jd_blocks = ip->i_size / ip->i_sbd->sd_bsize;
@@ -476,7 +476,7 @@ int preen_is_safe(struct gfs2_sbd *sdp, int preen, int force_check)
  * Returns: errno
  */
 
-static int gfs2_recover_journal(struct gfs2_inode *ip, int j, int preen,
+static int gfs2_recover_journal(struct lgfs2_inode *ip, int j, int preen,
 				int force_check, int *was_clean)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -609,7 +609,7 @@ reinit:
 
 /* We can't use the rangecheck function from pass1 because we haven't gone
  * through initialization properly yet. */
-static int rangecheck_jblock(struct gfs2_inode *ip, uint64_t block)
+static int rangecheck_jblock(struct lgfs2_inode *ip, uint64_t block)
 {
 	if((block > ip->i_sbd->fssize) || (block <= LGFS2_SB_ADDR(ip->i_sbd))) {
 		log_info( _("Bad block pointer (out of range) found in "
@@ -623,7 +623,7 @@ static int rangecheck_jblock(struct gfs2_inode *ip, uint64_t block)
 static int rangecheck_jmeta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
                             int *is_valid, int *was_duplicate, void *private)
 {
-	struct gfs2_inode *ip = iptr.ipt_ip;
+	struct lgfs2_inode *ip = iptr.ipt_ip;
 	uint64_t block = iptr_block(iptr);
 	int rc;
 
@@ -648,7 +648,7 @@ static int rangecheck_jmeta(struct iptr iptr, struct gfs2_buffer_head **bh, int
 	return rc;
 }
 
-static int rangecheck_jdata(struct gfs2_inode *ip, uint64_t metablock,
+static int rangecheck_jdata(struct lgfs2_inode *ip, uint64_t metablock,
 			    uint64_t block, void *private,
 			    struct gfs2_buffer_head *bh, __be64 *ptr)
 {
@@ -737,7 +737,7 @@ int replay_journals(struct gfs2_sbd *sdp, int preen, int force_check,
  */
 int ji_update(struct gfs2_sbd *sdp)
 {
-	struct gfs2_inode *jip, *ip = sdp->md.jiinode;
+	struct lgfs2_inode *jip, *ip = sdp->md.jiinode;
 	char journal_name[JOURNAL_NAME_SIZE];
 	int i, error;
 	char buf[sizeof(struct gfs_jindex)];
@@ -759,7 +759,7 @@ int ji_update(struct gfs2_sbd *sdp)
 		sdp->md.journals = ip->i_entries - 2;
 
 	if (!(sdp->md.journal = calloc(sdp->md.journals,
-				       sizeof(struct gfs2_inode *)))) {
+				       sizeof(struct lgfs2_inode *)))) {
 		log_err(_("Unable to allocate journal index\n"));
 		return -1;
 	}
@@ -808,7 +808,7 @@ static void bad_journalname(const char *filename, int len)
  * This function makes sure the directory entries of the jindex are valid.
  * If they're not '.' or '..' they better have the form journalXXX.
  */
-static int check_jindex_dent(struct gfs2_inode *ip, struct gfs2_dirent *dent,
+static int check_jindex_dent(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			     struct gfs2_dirent *prev_de,
 			     struct gfs2_buffer_head *bh, char *filename,
 			     uint32_t *count, int *lindex, void *priv)
@@ -850,14 +850,14 @@ static struct metawalk_fxns jindex_check_fxns = {
 
 int build_jindex(struct gfs2_sbd *sdp)
 {
-	struct gfs2_inode *jindex;
+	struct lgfs2_inode *jindex;
 
 	jindex = lgfs2_createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
 			 GFS2_DIF_SYSTEM);
 	if (jindex == NULL) {
 		return errno;
 	}
-	sdp->md.journal = malloc(sdp->md.journals * sizeof(struct gfs2_inode *));
+	sdp->md.journal = malloc(sdp->md.journals * sizeof(struct lgfs2_inode *));
 	for (unsigned j = 0; j < sdp->md.journals; j++) {
 		int ret = lgfs2_build_journal(sdp, j, jindex);
 		if (ret)
gfs2/fsck/fsck.h +5 -5
index 055ae975..6bfb6321 100644
@@ -108,11 +108,11 @@ enum rgindex_trust_level { /* how far can we trust our RG index? */
 			   must have been converted from gfs2_convert. */
 };
 
-extern struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block);
-extern struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
+extern struct lgfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block);
+extern struct lgfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
 					 struct rgrp_tree *rgd,
 					 struct gfs2_buffer_head *bh);
-extern void fsck_inode_put(struct gfs2_inode **ip);
+extern void fsck_inode_put(struct lgfs2_inode **ip);
 
 extern int initialize(struct gfs2_sbd *sdp, int force_check, int preen,
 		      int *all_clean);
@@ -143,7 +143,7 @@ struct gfs2_options {
 };
 
 extern struct gfs2_options opts;
-extern struct gfs2_inode *lf_dip; /* Lost and found directory inode */
+extern struct lgfs2_inode *lf_dip; /* Lost and found directory inode */
 extern int lf_was_created;
 extern uint64_t last_fs_block, last_reported_block;
 extern int64_t last_reported_fblock;
@@ -173,7 +173,7 @@ static inline int rgrp_contains_block(struct rgrp_tree *rgd, uint64_t blk)
 	return 1;
 }
 
-static inline int valid_block_ip(struct gfs2_inode *ip, uint64_t blk)
+static inline int valid_block_ip(struct lgfs2_inode *ip, uint64_t blk)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	struct rgrp_tree *rgd = ip->i_rgd;
gfs2/fsck/initialize.c +10 -10
index 2740fa7d..16e7f065 100644
@@ -284,7 +284,7 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 				         diblock, diblock);
 				bh = lgfs2_bread(sdp, diblock);
 				if (!lgfs2_check_meta(bh->b_data, GFS2_METATYPE_DI)) {
-					struct gfs2_inode *ip =
+					struct lgfs2_inode *ip =
 						fsck_inode_get(sdp, rgd, bh);
 					if (ip->i_blocks > 1) {
 						blks_2free += ip->i_blocks - 1;
@@ -544,7 +544,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
 			exit(FSCK_ERROR);
 		}
 	} else {
-		struct gfs2_inode *rip = lgfs2_build_rindex(sdp);
+		struct lgfs2_inode *rip = lgfs2_build_rindex(sdp);
 		if (rip == NULL) {
 			log_crit(_("Error building rindex inode: %s\n"), strerror(errno));
 			exit(FSCK_ERROR);
@@ -562,7 +562,7 @@ static int rebuild_master(struct gfs2_sbd *sdp)
 			exit(FSCK_ERROR);
 		}
 	} else {
-		struct gfs2_inode *qip = lgfs2_build_quota(sdp);
+		struct lgfs2_inode *qip = lgfs2_build_quota(sdp);
 		if (qip == NULL) {
 			log_crit(_("Error building quota inode: %s\n"), strerror(errno));
 			exit(FSCK_ERROR);
@@ -951,7 +951,7 @@ static int init_system_inodes(struct gfs2_sbd *sdp)
  * A real dinode will be located at the block number in its no_addr.
  * A journal-copy will be at a different block (inside the journal).
  */
-static int is_journal_copy(struct gfs2_inode *ip)
+static int is_journal_copy(struct lgfs2_inode *ip)
 {
 	if (ip->i_num.in_addr == ip->i_bh->b_blocknr)
 		return 0;
@@ -968,9 +968,9 @@ static int is_journal_copy(struct gfs2_inode *ip)
  * the per_node directory will have a ".." entry that will lead us to
  * the master dinode if it's been destroyed.
  */
-static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
+static void peruse_system_dinode(struct gfs2_sbd *sdp, struct lgfs2_inode *ip)
 {
-	struct gfs2_inode *child_ip;
+	struct lgfs2_inode *child_ip;
 	struct lgfs2_inum inum;
 	int error;
 
@@ -1057,9 +1057,9 @@ out_discard_ip:
  * peruse_user_dinode - process a user dinode trying to find the root directory
  *
  */
-static void peruse_user_dinode(struct gfs2_sbd *sdp, struct gfs2_inode *ip)
+static void peruse_user_dinode(struct gfs2_sbd *sdp, struct lgfs2_inode *ip)
 {
-	struct gfs2_inode *parent_ip;
+	struct lgfs2_inode *parent_ip;
 	struct lgfs2_inum inum;
 	int error;
 
@@ -1194,7 +1194,7 @@ static int peruse_metadata(struct gfs2_sbd *sdp, uint64_t startblock)
 {
 	uint64_t blk, max_rg_size;
 	struct gfs2_buffer_head *bh;
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 
 	max_rg_size = 2147483648ull / sdp->sd_bsize;
 	/* Max RG size is 2GB. 2G / bsize. */
@@ -1516,7 +1516,7 @@ static int reconstruct_journals(struct gfs2_sbd *sdp)
  */
 static int init_rindex(struct gfs2_sbd *sdp)
 {
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 
 	if (sdp->gfs1)
 		sdp->md.riinode = lgfs2_inode_read(sdp, sdp->sd_rindex_di.in_addr);
gfs2/fsck/link.c +3 -3
index d5421a0d..32893da5 100644
@@ -35,7 +35,7 @@ int link1_set(struct gfs2_bmap *bmap, uint64_t bblock, int mark)
 	return 0;
 }
 
-int set_di_nlink(struct gfs2_inode *ip)
+int set_di_nlink(struct lgfs2_inode *ip)
 {
 	struct inode_info *ii;
 	struct dir_info *di;
@@ -77,12 +77,12 @@ int set_di_nlink(struct gfs2_inode *ip)
 		    "for (0x%"PRIx64") via %s\n"),                        \
 		  referenced_from, counted_links, no_addr, why);
 
-int incr_link_count(struct lgfs2_inum no, struct gfs2_inode *ip, const char *why)
+int incr_link_count(struct lgfs2_inum no, struct lgfs2_inode *ip, const char *why)
 {
 	struct inode_info *ii = NULL;
 	uint64_t referenced_from = ip ? ip->i_num.in_addr : 0;
 	struct dir_info *di;
-	struct gfs2_inode *link_ip;
+	struct lgfs2_inode *link_ip;
 
 	di = dirtree_find(no.in_addr);
 	if (di) {
gfs2/fsck/link.h +2 -2
index 98872d7b..cd73deba 100644
@@ -12,8 +12,8 @@ enum {
 };
 
 int link1_set(struct gfs2_bmap *bmap, uint64_t bblock, int mark);
-int set_di_nlink(struct gfs2_inode *ip);
-int incr_link_count(struct lgfs2_inum no, struct gfs2_inode *ip, const char *why);
+int set_di_nlink(struct lgfs2_inode *ip);
+int incr_link_count(struct lgfs2_inum no, struct lgfs2_inode *ip, const char *why);
 int decr_link_count(uint64_t inode_no, uint64_t referenced_from, int gfs1,
 		    const char *why);
 
gfs2/fsck/lost_n_found.c +4 -4
index 8c66bea8..9e5fae6f 100644
@@ -18,7 +18,7 @@
 #include "metawalk.h"
 #include "util.h"
 
-static void add_dotdot(struct gfs2_inode *ip)
+static void add_dotdot(struct lgfs2_inode *ip)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	struct dir_info *di;
@@ -32,7 +32,7 @@ static void add_dotdot(struct gfs2_inode *ip)
 	   back out the links. */
 	di = dirtree_find(ip->i_num.in_addr);
 	if (di && valid_block(sdp, di->dotdot_parent.in_addr)) {
-		struct gfs2_inode *dip;
+		struct lgfs2_inode *dip;
 
 		log_debug(_("Directory (0x%"PRIx64") already had a '..' link to (0x%"PRIx64").\n"),
 		          ip->i_num.in_addr, di->dotdot_parent.in_addr);
@@ -90,7 +90,7 @@ static void add_dotdot(struct gfs2_inode *ip)
 	}
 }
 
-void make_sure_lf_exists(struct gfs2_inode *ip)
+void make_sure_lf_exists(struct lgfs2_inode *ip)
 {
 	struct dir_info *di;
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -170,7 +170,7 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
  *
  * Returns: 0 on success, -1 on failure.
  */
-int add_inode_to_lf(struct gfs2_inode *ip){
+int add_inode_to_lf(struct lgfs2_inode *ip){
 	char tmp_name[256];
 	unsigned inode_type;
 	struct gfs2_sbd *sdp = ip->i_sbd;
gfs2/fsck/lost_n_found.h +2 -2
index 2b76cc2b..2e1c5d14 100644
@@ -3,7 +3,7 @@
 
 #include "libgfs2.h"
 
-int add_inode_to_lf(struct gfs2_inode *ip);
-void make_sure_lf_exists(struct gfs2_inode *ip);
+int add_inode_to_lf(struct lgfs2_inode *ip);
+void make_sure_lf_exists(struct lgfs2_inode *ip);
 
 #endif /* __LOST_N_FOUND_H__ */
gfs2/fsck/main.c +1 -1
index 3c432be8..2c78f2d7 100644
@@ -26,7 +26,7 @@
 #include "util.h"
 
 struct gfs2_options opts = {0};
-struct gfs2_inode *lf_dip = NULL; /* Lost and found directory inode */
+struct lgfs2_inode *lf_dip = NULL; /* Lost and found directory inode */
 int lf_was_created = 0;
 uint64_t last_fs_block, last_reported_block = -1;
 int64_t last_reported_fblock = -1000000;
gfs2/fsck/metawalk.c +29 -29

206 lines not on this page · raw message

gfs2/fsck/metawalk.h +24 -24

109 lines not on this page · raw message

gfs2/fsck/pass1.c +56 -56

403 lines not on this page · raw message

gfs2/fsck/pass1b.c +17 -17
index 1fb1cc4c..6add4562 100644
@@ -41,7 +41,7 @@ struct meta_blk_ref {
 	int off; /* offset to the reference within the buffer */
 };
 
-static int clone_data(struct gfs2_inode *ip, uint64_t metablock,
+static int clone_data(struct lgfs2_inode *ip, uint64_t metablock,
 		      uint64_t block, void *private,
 		      struct gfs2_buffer_head *bh, __be64 *ptr);
 
@@ -74,7 +74,7 @@ static int findref_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
 	return META_IS_GOOD;
 }
 
-static int findref_data(struct gfs2_inode *ip, uint64_t metablock,
+static int findref_data(struct lgfs2_inode *ip, uint64_t metablock,
 			uint64_t block, void *private,
 			struct gfs2_buffer_head *bh, __be64 *ptr)
 {
@@ -99,7 +99,7 @@ static void clone_data_block(struct gfs2_sbd *sdp, struct duptree *dt,
 		.check_data = findref_data,
 	};
 	struct clone_target clone = {.dup_block = dt->block,};
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	struct gfs2_buffer_head *bh;
 	__be64 *ptr;
 
@@ -180,7 +180,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
 				   struct dup_handler *dh,
 				   int inval, int acceptable_ref)
 {
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	struct inode_with_dups *id;
 	osi_list_t *tmp, *x;
 	struct metawalk_fxns pass1b_fxns_delete = {
@@ -373,7 +373,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
 static int clone_check_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
                             int *is_valid, int *was_duplicate, void *private)
 {
-	struct gfs2_inode *ip = iptr.ipt_ip;
+	struct lgfs2_inode *ip = iptr.ipt_ip;
 	uint64_t block = iptr_block(iptr);
 
 	*was_duplicate = 0;
@@ -387,7 +387,7 @@ static int clone_check_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int
  * This function remembers the first reference to the specified block, and
  * clones all subsequent references to it (with permission).
  */
-static int clone_data(struct gfs2_inode *ip, uint64_t metablock,
+static int clone_data(struct lgfs2_inode *ip, uint64_t metablock,
 		      uint64_t block, void *private,
 		      struct gfs2_buffer_head *bh, __be64 *ptr)
 {
@@ -452,7 +452,7 @@ static int clone_data(struct gfs2_inode *ip, uint64_t metablock,
  * This function traverses the metadata tree of an inode, cloning all
  * but the first reference to a duplicate block reference.
  */
-static void clone_dup_ref_in_inode(struct gfs2_inode *ip, struct duptree *dt)
+static void clone_dup_ref_in_inode(struct lgfs2_inode *ip, struct duptree *dt)
 {
 	int error;
 	struct clone_target clonet = {.dup_block = dt->block, .first = 1};
@@ -472,7 +472,7 @@ static void clone_dup_ref_in_inode(struct gfs2_inode *ip, struct duptree *dt)
 	}
 }
 
-static int set_ip_bitmap(struct gfs2_inode *ip)
+static int set_ip_bitmap(struct lgfs2_inode *ip)
 {
 	uint64_t block = ip->i_bh->b_blocknr;
 	uint32_t mode;
@@ -515,7 +515,7 @@ static int set_ip_bitmap(struct gfs2_inode *ip)
 static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
 				   enum dup_ref_type acceptable_ref)
 {
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	struct inode_with_dups *id;
 	osi_list_t *tmp;
 	int q;
@@ -730,7 +730,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
 	return 0;
 }
 
-static int check_leaf_refs(struct gfs2_inode *ip, uint64_t block,
+static int check_leaf_refs(struct lgfs2_inode *ip, uint64_t block,
 			   void *private)
 {
 	return add_duplicate_ref(ip, block, REF_AS_META, 1, INODE_VALID);
@@ -739,7 +739,7 @@ static int check_leaf_refs(struct gfs2_inode *ip, uint64_t block,
 static int check_metalist_refs(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
                                int *is_valid, int *was_duplicate, void *private)
 {
-	struct gfs2_inode *ip = iptr.ipt_ip;
+	struct lgfs2_inode *ip = iptr.ipt_ip;
 	uint64_t block = iptr_block(iptr);
 
 	*was_duplicate = 0;
@@ -747,14 +747,14 @@ static int check_metalist_refs(struct iptr iptr, struct gfs2_buffer_head **bh, i
 	return add_duplicate_ref(ip, block, REF_AS_META, 1, INODE_VALID);
 }
 
-static int check_data_refs(struct gfs2_inode *ip, uint64_t metablock,
+static int check_data_refs(struct lgfs2_inode *ip, uint64_t metablock,
 			   uint64_t block, void *private,
 			   struct gfs2_buffer_head *bh, __be64 *ptr)
 {
 	return add_duplicate_ref(ip, block, REF_AS_DATA, 1, INODE_VALID);
 }
 
-static int check_eattr_indir_refs(struct gfs2_inode *ip, uint64_t block,
+static int check_eattr_indir_refs(struct lgfs2_inode *ip, uint64_t block,
 				  uint64_t parent,
 				  struct gfs2_buffer_head **bh, void *private)
 {
@@ -768,7 +768,7 @@ static int check_eattr_indir_refs(struct gfs2_inode *ip, uint64_t block,
 	return error;
 }
 
-static int check_eattr_leaf_refs(struct gfs2_inode *ip, uint64_t block,
+static int check_eattr_leaf_refs(struct lgfs2_inode *ip, uint64_t block,
 				 uint64_t parent, struct gfs2_buffer_head **bh,
 				 void *private)
 {
@@ -781,7 +781,7 @@ static int check_eattr_leaf_refs(struct gfs2_inode *ip, uint64_t block,
 	return error;
 }
 
-static int check_eattr_entry_refs(struct gfs2_inode *ip,
+static int check_eattr_entry_refs(struct lgfs2_inode *ip,
 				  struct gfs2_buffer_head *leaf_bh,
 				  struct gfs2_ea_header *ea_hdr,
 				  struct gfs2_ea_header *ea_hdr_prev,
@@ -790,7 +790,7 @@ static int check_eattr_entry_refs(struct gfs2_inode *ip,
 	return 0;
 }
 
-static int check_eattr_extentry_refs(struct gfs2_inode *ip, int i,
+static int check_eattr_extentry_refs(struct lgfs2_inode *ip, int i,
 				     __be64 *ea_data_ptr,
 				     struct gfs2_buffer_head *leaf_bh,
 				     uint32_t tot_ealen,
@@ -813,7 +813,7 @@ static int check_eattr_extentry_refs(struct gfs2_inode *ip, int i,
 /* Finds all references to duplicate blocks in the metadata */
 static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode)
 {
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	int error = 0;
 	struct metawalk_fxns find_refs = {
 		.private = NULL,
gfs2/fsck/pass2.c +37 -37

271 lines not on this page · raw message

gfs2/fsck/pass3.c +2 -2
index e2e20483..a85c4975 100644
@@ -24,7 +24,7 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
 	const char *filename = "..";
 	int filename_len = 2;
 	int err;
-	struct gfs2_inode *ip, *pip;
+	struct lgfs2_inode *ip, *pip;
 	struct lgfs2_inum no;
 
 	ip = fsck_load_inode(sdp, block);
@@ -160,7 +160,7 @@ int pass3(struct gfs2_sbd *sdp)
 {
 	struct osi_node *tmp, *next = NULL;
 	struct dir_info *di, *tdi;
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	int q;
 
 	di = dirtree_find(sdp->md.rooti->i_num.in_addr);
gfs2/fsck/pass4.c +3 -3
index 25d756d9..6acd9a65 100644
@@ -26,7 +26,7 @@ static struct metawalk_fxns pass4_fxns_delete = {
 
 /* Updates the link count of an inode to what the fsck has seen for
  * link count */
-static int fix_link_count(uint32_t counted_links, struct gfs2_inode *ip)
+static int fix_link_count(uint32_t counted_links, struct lgfs2_inode *ip)
 {
 	log_info(_("Fixing inode link count (%d->%d) for %"PRIu64" (0x%"PRIx64") \n"),
 	         ip->i_nlink, counted_links, ip->i_num.in_addr, ip->i_num.in_addr);
@@ -52,7 +52,7 @@ static int fix_link_count(uint32_t counted_links, struct gfs2_inode *ip)
 static int handle_unlinked(struct gfs2_sbd *sdp, uint64_t no_addr,
 			   uint32_t *counted_links, int *lf_addition)
 {
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	int q;
 
 	log_err(_("Found unlinked inode at %"PRIu64" (0x%"PRIx64")\n"),
@@ -126,7 +126,7 @@ static void handle_inconsist(struct gfs2_sbd *sdp, uint64_t no_addr,
 	/* Read in the inode, adjust the link count, and write it back out */
 	if (query(_("Update link count for inode %"PRIu64" (0x%"PRIx64")? (y/n) "),
 	          no_addr, no_addr)) {
-		struct gfs2_inode *ip;
+		struct lgfs2_inode *ip;
 
 		ip = fsck_load_inode(sdp, no_addr); /* lgfs2_bread, inode_get */
 		fix_link_count(counted_links, ip);
gfs2/fsck/rgrepair.c +1 -1
index 37d20aed..14b1d56a 100644
@@ -52,7 +52,7 @@ static void find_journaled_rgs(struct gfs2_sbd *sdp)
 	int j, new = 0;
 	unsigned int jblocks;
 	uint64_t b, dblock;
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	struct gfs2_buffer_head *bh;
 	int false_count;
 
gfs2/fsck/util.c +5 -5
index 549c087b..b4e25c8b 100644
@@ -21,7 +21,7 @@ const char *reftypes[REF_TYPES + 1] = {"data", "metadata",
 				       "an extended attribute", "an inode",
 				       "unimportant"};
 
-void big_file_comfort(struct gfs2_inode *ip, uint64_t blks_checked)
+void big_file_comfort(struct lgfs2_inode *ip, uint64_t blks_checked)
 {
 	static struct timeval tv;
 	static uint32_t seconds = 0;
@@ -267,7 +267,7 @@ static struct duptree *gfs2_dup_set(uint64_t dblock, int create)
  * find_dup_ref_inode - find a duplicate reference inode entry for an inode
  */
 struct inode_with_dups *find_dup_ref_inode(struct duptree *dt,
-					   struct gfs2_inode *ip)
+					   struct lgfs2_inode *ip)
 {
 	osi_list_t *ref;
 	struct inode_with_dups *id;
@@ -323,7 +323,7 @@ int count_dup_meta_refs(struct duptree *dt)
  *         called from pass1, which is the second reference, which determined
  *         it was a duplicate..
  */
-int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
+int add_duplicate_ref(struct lgfs2_inode *ip, uint64_t block,
 		      enum dup_ref_type reftype, int first, int inode_valid)
 {
 	struct inode_with_dups *id;
@@ -569,7 +569,7 @@ uint64_t find_free_blk(struct gfs2_sbd *sdp)
 	return 0;
 }
 
-__be64 *get_dir_hash(struct gfs2_inode *ip)
+__be64 *get_dir_hash(struct lgfs2_inode *ip)
 {
 	unsigned hsize = (1 << ip->i_depth) * sizeof(uint64_t);
 	int ret;
@@ -587,7 +587,7 @@ __be64 *get_dir_hash(struct gfs2_inode *ip)
 	return tbl;
 }
 
-void delete_all_dups(struct gfs2_inode *ip)
+void delete_all_dups(struct lgfs2_inode *ip)
 {
 	struct osi_node *n, *next;
 	struct duptree *dt;
gfs2/fsck/util.h +7 -7
index 278ac139..4f3ce5a7 100644
@@ -10,12 +10,12 @@
 #define INODE_INVALID 0
 
 struct di_info *search_list(osi_list_t *list, uint64_t addr);
-void big_file_comfort(struct gfs2_inode *ip, uint64_t blks_checked);
+void big_file_comfort(struct lgfs2_inode *ip, uint64_t blks_checked);
 void display_progress(uint64_t block);
-int add_duplicate_ref(struct gfs2_inode *ip, uint64_t block,
+int add_duplicate_ref(struct lgfs2_inode *ip, uint64_t block,
 		      enum dup_ref_type reftype, int first, int inode_valid);
 extern struct inode_with_dups *find_dup_ref_inode(struct duptree *dt,
-						  struct gfs2_inode *ip);
+						  struct lgfs2_inode *ip);
 extern void dup_listent_delete(struct duptree *dt, struct inode_with_dups *id);
 extern int count_dup_meta_refs(struct duptree *dt);
 extern const char *reftypes[REF_TYPES + 1];
@@ -80,7 +80,7 @@ static const inline char *block_type_string(int q)
 	return blktyp[4];
 }
 
-static inline int is_dir(struct gfs2_inode *ip, int gfs1)
+static inline int is_dir(struct lgfs2_inode *ip, int gfs1)
 {
 	if (gfs1 && lgfs2_is_gfs_dir(ip))
 		return 1;
@@ -90,7 +90,7 @@ static inline int is_dir(struct gfs2_inode *ip, int gfs1)
 	return 0;
 }
 
-static inline uint32_t gfs_to_gfs2_mode(struct gfs2_inode *ip)
+static inline uint32_t gfs_to_gfs2_mode(struct lgfs2_inode *ip)
 {
 	uint16_t gfs1mode = ip->i_di_type;
 
@@ -125,8 +125,8 @@ extern char generic_interrupt(const char *caller, const char *where,
                        const char *answers);
 extern char gfs2_getch(void);
 extern uint64_t find_free_blk(struct gfs2_sbd *sdp);
-extern __be64 *get_dir_hash(struct gfs2_inode *ip);
-extern void delete_all_dups(struct gfs2_inode *ip);
+extern __be64 *get_dir_hash(struct lgfs2_inode *ip);
+extern void delete_all_dups(struct lgfs2_inode *ip);
 extern void print_pass_duration(const char *name, struct timeval *start);
 
 #define stack log_debug("<backtrace> - %s()\n", __func__)
gfs2/glocktop/glocktop.c +2 -2
index 130cc8a9..369638a2 100644
@@ -615,13 +615,13 @@ static void display_filename(int fd, uint64_t block, uint64_t *dirarray, int sub
 
 static const char *show_inode(const char *id, int fd, uint64_t block)
 {
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	const char *inode_type = NULL;
 	struct gfs2_sbd sbd = { .device_fd = fd, .sd_bsize = bsize };
 
 	ip = lgfs2_inode_read(&sbd, block);
 	if (S_ISDIR(ip->i_mode)) {
-		struct gfs2_inode *parent;
+		struct lgfs2_inode *parent;
 		uint64_t dirarray[256];
 		int subdepth = 0, error;
 
gfs2/libgfs2/fs_ops.c +49 -49

363 lines not on this page · raw message

gfs2/libgfs2/gfs1.c +11 -11
index 2b864137..1fe366e1 100644
@@ -17,7 +17,7 @@
 /* GFS1 compatibility functions - so that programs like gfs2_convert
    and gfs2_edit can examine/manipulate GFS1 file systems. */
 
-static __inline__ int fs_is_jdata(struct gfs2_inode *ip)
+static __inline__ int fs_is_jdata(struct lgfs2_inode *ip)
 {
         return ip->i_flags & GFS2_DIF_JDATA;
 }
@@ -31,14 +31,14 @@ gfs1_metapointer(char *buf, unsigned int height, struct metapath *mp)
 	return ((__be64 *)(buf + head_size)) + mp->mp_list[height];
 }
 
-int lgfs2_is_gfs_dir(struct gfs2_inode *ip)
+int lgfs2_is_gfs_dir(struct lgfs2_inode *ip)
 {
 	if (ip->i_di_type == GFS_FILE_DIR)
 		return 1;
 	return 0;
 }
 
-void lgfs2_gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
+void lgfs2_gfs1_lookup_block(struct lgfs2_inode *ip, struct gfs2_buffer_head *bh,
 		  unsigned int height, struct metapath *mp,
 		  int create, int *new, uint64_t *block)
 {
@@ -67,7 +67,7 @@ void lgfs2_gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 	*new = 1;
 }
 
-void lgfs2_gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
+void lgfs2_gfs1_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
 		    uint64_t *dblock, uint32_t *extlen, int prealloc)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -163,7 +163,7 @@ void lgfs2_gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
 		lgfs2_brelse(bh);
 }
 
-int lgfs2_gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
+int lgfs2_gfs1_writei(struct lgfs2_inode *ip, void *buf, uint64_t offset,
 		unsigned int size)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -245,12 +245,12 @@ int lgfs2_gfs1_writei(struct gfs2_inode *ip, void *buf, uint64_t offset,
 	return copied;
 }
 
-static struct gfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
+static struct lgfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
 {
 	struct gfs_dinode *di;
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 
-	ip = calloc(1, sizeof(struct gfs2_inode));
+	ip = calloc(1, sizeof(struct lgfs2_inode));
 	if (ip == NULL) {
 		return NULL;
 	}
@@ -284,15 +284,15 @@ static struct gfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
 	return ip;
 }
 
-struct gfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
+struct lgfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
 {
 	return __gfs_inode_get(sdp, buf);
 }
 
-struct gfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr)
+struct lgfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr)
 {
 	struct gfs2_buffer_head *bh;
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 
 	bh = lgfs2_bget(sdp, di_addr);
 	if (bh == NULL)
gfs2/libgfs2/lang.c +1 -1
index e1c5aba0..0c869d07 100644
@@ -153,7 +153,7 @@ static uint64_t ast_lookup_path(char *path, struct gfs2_sbd *sbd)
 {
 	int err = 0;
 	char *c = NULL;
-	struct gfs2_inode *ip, *iptmp;
+	struct lgfs2_inode *ip, *iptmp;
 	char *segment;
 	uint64_t bn = 0;
 
gfs2/libgfs2/libgfs2.h +65 -65

233 lines not on this page · raw message

gfs2/libgfs2/ondisk.c +2 -2
index 8cddfec9..9d06443c 100644
@@ -124,7 +124,7 @@ void lgfs2_rgrp_out(const lgfs2_rgrp_t rg, void *buf)
 	lgfs2_rgrp_crc_set(buf);
 }
 
-void lgfs2_dinode_in(struct gfs2_inode *ip, char *buf)
+void lgfs2_dinode_in(struct lgfs2_inode *ip, char *buf)
 {
 	struct gfs2_dinode *di = (struct gfs2_dinode *)buf;
 
@@ -157,7 +157,7 @@ void lgfs2_dinode_in(struct gfs2_inode *ip, char *buf)
 	ip->i_ctime_nsec = be32_to_cpu(di->di_ctime_nsec);
 }
 
-void lgfs2_dinode_out(struct gfs2_inode *ip, char *buf)
+void lgfs2_dinode_out(struct lgfs2_inode *ip, char *buf)
 {
 	struct gfs2_dinode *di = (struct gfs2_dinode *)buf;
 
gfs2/libgfs2/recovery.c +7 -7
index 483661e4..b88d913d 100644
@@ -14,7 +14,7 @@
 #include <string.h>
 #include "libgfs2.h"
 
-void lgfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
+void lgfs2_replay_incr_blk(struct lgfs2_inode *ip, unsigned int *blk)
 {
 	uint32_t jd_blocks = ip->i_size / ip->i_sbd->sd_bsize;
 
@@ -22,7 +22,7 @@ void lgfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
                 *blk = 0;
 }
 
-int lgfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
+int lgfs2_replay_read_block(struct lgfs2_inode *ip, unsigned int blk,
 			   struct gfs2_buffer_head **bh)
 {
 	int new = 0;
@@ -65,7 +65,7 @@ static void log_header_in(struct lgfs2_log_header *lh, char *buf)
  *          errno on error
  */
 
-int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
+int lgfs2_get_log_header(struct lgfs2_inode *ip, unsigned int blk,
                          struct lgfs2_log_header *head)
 {
 	struct gfs2_buffer_head *bh;
@@ -113,7 +113,7 @@ int lgfs2_get_log_header(struct gfs2_inode *ip, unsigned int blk,
  *
  * Returns: errno
  */
-static int find_good_lh(struct gfs2_inode *ip, unsigned int *blk, struct lgfs2_log_header *head)
+static int find_good_lh(struct lgfs2_inode *ip, unsigned int *blk, struct lgfs2_log_header *head)
 {
 	unsigned int orig_blk = *blk;
 	int error;
@@ -143,7 +143,7 @@ static int find_good_lh(struct gfs2_inode *ip, unsigned int *blk, struct lgfs2_l
  * Returns: errno
  */
 
-static int jhead_scan(struct gfs2_inode *ip, struct lgfs2_log_header *head)
+static int jhead_scan(struct lgfs2_inode *ip, struct lgfs2_log_header *head)
 {
 	unsigned int blk = head->lh_blkno;
 	uint32_t jd_blocks = ip->i_size / ip->i_sbd->sd_bsize;
@@ -182,7 +182,7 @@ static int jhead_scan(struct gfs2_inode *ip, struct lgfs2_log_header *head)
  * Returns: errno
  */
 
-int lgfs2_find_jhead(struct gfs2_inode *ip, struct lgfs2_log_header *head)
+int lgfs2_find_jhead(struct lgfs2_inode *ip, struct lgfs2_log_header *head)
 {
 	struct lgfs2_log_header lh_1, lh_m;
 	uint32_t blk_1, blk_2, blk_m;
@@ -230,7 +230,7 @@ int lgfs2_find_jhead(struct gfs2_inode *ip, struct lgfs2_log_header *head)
  * Returns: errno
  */
 
-int lgfs2_clean_journal(struct gfs2_inode *ip, struct lgfs2_log_header *head)
+int lgfs2_clean_journal(struct lgfs2_inode *ip, struct lgfs2_log_header *head)
 {
 	unsigned int lblock;
 	struct gfs2_log_header *lh;
gfs2/libgfs2/rgrp.c +1 -1
index 78b6812a..e3f2e268 100644
@@ -472,7 +472,7 @@ unsigned lgfs2_rindex_read_fd(int fd, lgfs2_rgrps_t rgs)
  * Returns the new rindex entry added to the set or NULL on error with errno
  * set.
  */
-lgfs2_rgrp_t lgfs2_rindex_read_one(struct gfs2_inode *rip, lgfs2_rgrps_t rgs, unsigned i)
+lgfs2_rgrp_t lgfs2_rindex_read_one(struct lgfs2_inode *rip, lgfs2_rgrps_t rgs, unsigned i)
 {
 	uint64_t off = i * sizeof(struct gfs2_rindex);
 	struct gfs2_rindex ri;
gfs2/libgfs2/structures.c +22 -22

142 lines not on this page · raw message

gfs2/mkfs/main_mkfs.c +5 -5
index 5a8ede04..7c4700dc 100644
@@ -683,7 +683,7 @@ static int warn_of_destruction(const char *path)
 
 static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 {
-	struct gfs2_inode *per_node;
+	struct lgfs2_inode *per_node;
 	unsigned int j;
 
 	per_node = lgfs2_createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
@@ -693,7 +693,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 		return -1;
 	}
 	for (j = 0; j < sdp->md.journals; j++) {
-		struct gfs2_inode *ip;
+		struct lgfs2_inode *ip;
 
 		ip = lgfs2_build_inum_range(per_node, j);
 		if (ip == NULL) {
@@ -910,7 +910,7 @@ static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_o
 	for (j = 0; j < opts->journals; j++) {
 		int result;
 		lgfs2_rgrp_t rg;
-		struct gfs2_inode in = {0};
+		struct lgfs2_inode in = {0};
 		struct gfs2_rindex ri;
 
 		gfs2_progress_update(&progress, (j + 1));
@@ -1001,7 +1001,7 @@ static int place_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, uint64_t *rgaddr
 
 static int create_jindex(struct gfs2_sbd *sdp, struct mkfs_opts *opts, struct lgfs2_inum *jnls)
 {
-	struct gfs2_inode *jindex;
+	struct lgfs2_inode *jindex;
 
 	jindex = lgfs2_build_jindex(sdp->master_dir, jnls, opts->journals);
 	if (jindex == NULL) {
@@ -1199,7 +1199,7 @@ int main(int argc, char *argv[])
 	struct gfs2_statfs_change sc;
 	struct gfs2_sbd sbd;
 	struct mkfs_opts opts;
-	struct gfs2_inode *ip;
+	struct lgfs2_inode *ip;
 	lgfs2_rgrps_t rgs;
 	uint64_t rgaddr;
 	int error;
Signature · 1 line
2.34.1
#14 lore raw

PATCH 14/21 libgfs2: Namespace improvements - struct gfs2_buffer_head

In reply to Andrew Price

Rename to struct lgfs2_buffer_head.

---
 gfs2/convert/gfs2_convert.c   | 30 +++++++-------
 gfs2/edit/extended.c          |  2 +-
 gfs2/edit/gfs2hex.c           |  2 +-
 gfs2/edit/hexedit.c           | 20 +++++-----
 gfs2/edit/journal.c           | 14 +++----
 gfs2/fsck/afterpass1_common.c | 18 ++++-----
 gfs2/fsck/afterpass1_common.h | 12 +++---
 gfs2/fsck/fs_recovery.c       | 18 ++++-----
 gfs2/fsck/fsck.h              |  2 +-
 gfs2/fsck/initialize.c        | 14 +++----
 gfs2/fsck/metawalk.c          | 50 +++++++++++------------
 gfs2/fsck/metawalk.h          | 22 +++++------
 gfs2/fsck/pass1.c             | 68 ++++++++++++++++----------------
 gfs2/fsck/pass1b.c            | 28 ++++++-------
 gfs2/fsck/pass2.c             | 40 +++++++++----------
 gfs2/fsck/pass5.c             |  2 +-
 gfs2/fsck/rgrepair.c          | 12 +++---
 gfs2/libgfs2/buf.c            | 18 ++++-----
 gfs2/libgfs2/fs_ops.c         | 74 +++++++++++++++++------------------
 gfs2/libgfs2/gfs1.c           |  8 ++--
 gfs2/libgfs2/libgfs2.h        | 34 ++++++++--------
 gfs2/libgfs2/recovery.c       |  6 +--
 gfs2/libgfs2/structures.c     | 12 +++---
 gfs2/libgfs2/super.c          |  4 +-
 24 files changed, 255 insertions(+), 255 deletions(-)
gfs2/convert/gfs2_convert.c +15 -15
index 21611b1a..06815380 100644
@@ -263,7 +263,7 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
 		  unsigned int size)
 {
 	uint64_t block;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	unsigned int amount, ptramt;
 	int hdrsize, h, copied = 0, new;
 	struct gfs2_meta_header mh = {0};
@@ -421,7 +421,7 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
 			      unsigned int size)
 {
 	uint64_t block;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	unsigned int amount, ptramt;
 	int h, copied = 0, new = 0;
 	struct gfs2_meta_header mh = {0};
@@ -488,7 +488,7 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
 static int get_inode_metablocks(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, struct blocklist *blocks)
 {
 	struct blocklist *blk, *newblk;
-	struct gfs2_buffer_head *bh, *dibh = ip->i_bh;
+	struct lgfs2_buffer_head *bh, *dibh = ip->i_bh;
 	osi_list_t *tmp;
 	uint64_t block;
 	__be64 *ptr1;
@@ -622,7 +622,7 @@ static int fix_ind_jdata(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t
 	__be64 *ptr1;
 	int ptrnum, h;
 	struct metapath gfs2mp;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 
 	bufsize = sbp->sd_bsize - sizeof(struct gfs2_meta_header);
 	/*
@@ -774,7 +774,7 @@ static int has_cdpn(const char *str)
 	return 0;
 }
 
-static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct lgfs2_inode *ip)
+static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct lgfs2_buffer_head *bh, struct lgfs2_inode *ip)
 {
 	char *linkptr = NULL;
 
@@ -809,10 +809,10 @@ static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, s
  * to fix the header. gfs1 uses gfs_indirect as the header which is 64 bytes
  * bigger than gfs2_meta_header that gfs2 uses.
  */
-static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct lgfs2_inode *ip)
+static int fix_xattr(struct gfs2_sbd *sbp, struct lgfs2_buffer_head *bh, struct lgfs2_inode *ip)
 {
 	int len, old_hdr_sz, new_hdr_sz;
-	struct gfs2_buffer_head *eabh;
+	struct lgfs2_buffer_head *eabh;
 	char *buf;
 
 	/* Read in the i_eattr block */
@@ -843,7 +843,7 @@ static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct l
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
+static int adjust_inode(struct gfs2_sbd *sbp, struct lgfs2_buffer_head *bh)
 {
 	struct lgfs2_inode *inode;
 	struct inode_block *fixdir;
@@ -984,7 +984,7 @@ static int next_rg_meta(struct rgrp_tree *rgd, uint64_t *block, int first)
 static int next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
                             uint64_t *block, uint32_t type, int first)
 {
-	struct gfs2_buffer_head *bh = NULL;
+	struct lgfs2_buffer_head *bh = NULL;
 
 	do{
 		if (bh)
@@ -1011,7 +1011,7 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 	struct rgrp_tree *rgd;
 	struct osi_node *n, *next = NULL;
 	uint64_t block = 0;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	int first;
 	int error = 0;
 	int rgs_processed = 0;
@@ -1125,7 +1125,7 @@ static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
 /* Returns: 0 on success, -1 on failure, -EISDIR when dentmod marked DT_DIR  */
 /* ------------------------------------------------------------------------- */
 static int process_dirent_info(struct lgfs2_inode *dip, struct gfs2_sbd *sbp,
-			       struct gfs2_buffer_head *bh, int dir_entries, uint64_t dentmod)
+			       struct lgfs2_buffer_head *bh, int dir_entries, uint64_t dentmod)
 {
 	int error = 0;
 	struct gfs2_dirent *dent;
@@ -1246,7 +1246,7 @@ static int process_dirent_info(struct lgfs2_inode *dip, struct gfs2_sbd *sbp,
 /* ------------------------------------------------------------------------- */
 static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct lgfs2_inode *dip, uint64_t dentmod)
 {
-	struct gfs2_buffer_head *bh_leaf;
+	struct lgfs2_buffer_head *bh_leaf;
 	int error;
 	uint64_t leaf_block, prev_leaf_block;
 	uint32_t leaf_num;
@@ -1382,7 +1382,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
 	osi_list_foreach_safe(tmp, cdpn_to_fix, x) {
 		struct lgfs2_inum fix, dir;
 		struct inode_dir_block *l_fix;
-		struct gfs2_buffer_head *bh = NULL;
+		struct lgfs2_buffer_head *bh = NULL;
 		struct lgfs2_inode *fix_inode;
 		uint64_t eablk;
 
@@ -1562,7 +1562,7 @@ static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
 /* ------------------------------------------------------------------------- */
 static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	int rgcount;
 	struct lgfs2_inum inum;
 
@@ -2203,7 +2203,7 @@ static int gfs2_query(struct gfs2_options *opts, const char *dev)
 int main(int argc, char **argv)
 {
 	int error;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	struct gfs2_options opts;
 
 	/* Set i18n support to gfs2_convert */
gfs2/edit/extended.c +1 -1
index 8aed9fa9..98c0dfce 100644
@@ -623,7 +623,7 @@ static int print_quota(struct lgfs2_inode *diq)
 int display_extended(void)
 {
 	struct lgfs2_inode *tmp_inode;
-	struct gfs2_buffer_head *tmp_bh;
+	struct lgfs2_buffer_head *tmp_bh;
 
 	dsplines = termlines - line - 1;
 	/* Display any indirect pointers that we have. */
gfs2/edit/gfs2hex.c +1 -1
index cdf22042..d167bdb4 100644
@@ -186,7 +186,7 @@ void do_dinode_extended(char *buf)
 			p = be64_to_cpu(*(__be64 *)(buf + x));
 
 			if (p != last || ((y + 1) * sizeof(uint64_t) == be64_to_cpu(dip->di_size))) {
-				struct gfs2_buffer_head *tmp_bh;
+				struct lgfs2_buffer_head *tmp_bh;
 				int skip = 0, direntcount = 0;
 				unsigned int bufoffset;
 
gfs2/edit/hexedit.c +10 -10
index f2c54b04..3b8f1b48 100644
@@ -33,7 +33,7 @@ const char *allocdesc[2][5] = {
 	{"Free ", "Data ", "Unlnk", "Meta ", "Resrv"},
 	{"Free ", "Data ", "FreeM", "Meta ", "Resrv"},};
 
-static struct gfs2_buffer_head *bh;
+static struct lgfs2_buffer_head *bh;
 static int pgnum;
 static long int gziplevel = 9;
 static int termcols;
@@ -754,7 +754,7 @@ static uint64_t get_rg_addr(int rgnum)
 /* ------------------------------------------------------------------------ */
 static void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full)
 {
-	struct gfs2_buffer_head *rbh;
+	struct lgfs2_buffer_head *rbh;
 	struct gfs2_rgrp *rg;
 	uint64_t rgblk;
 
@@ -1130,7 +1130,7 @@ static uint64_t find_metablockoftype_slow(uint64_t startblk, int metatype, int p
 {
 	uint64_t blk, last_fs_block;
 	int found = 0;
-	struct gfs2_buffer_head *lbh;
+	struct lgfs2_buffer_head *lbh;
 
 	last_fs_block = lseek(sbd.device_fd, 0, SEEK_END) / sbd.sd_bsize;
 	for (blk = startblk + 1; blk < last_fs_block; blk++) {
@@ -1164,7 +1164,7 @@ static int find_rg_metatype(struct rgrp_tree *rgd, uint64_t *blk, uint64_t start
 {
 	int found;
 	unsigned i, j, m;
-	struct gfs2_buffer_head *bhp = NULL;
+	struct lgfs2_buffer_head *bhp = NULL;
 	uint64_t *ibuf = malloc(sbd.sd_bsize * GFS2_NBBY * sizeof(uint64_t));
 
 	for (i = 0; i < rgd->rt_length; i++) {
@@ -1581,7 +1581,7 @@ static void print_block_type(uint64_t tblock, const struct lgfs2_metadata *type)
 static void find_print_block_type(void)
 {
 	uint64_t tblock;
-	struct gfs2_buffer_head *lbh;
+	struct lgfs2_buffer_head *lbh;
 	const struct lgfs2_metadata *type;
 
 	tblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
@@ -1696,7 +1696,7 @@ static void find_change_block_alloc(int *newval)
 static void process_field(const char *field, const char *nstr)
 {
 	uint64_t fblock;
-	struct gfs2_buffer_head *rbh;
+	struct lgfs2_buffer_head *rbh;
 	const struct lgfs2_metadata *mtype;
 	const struct lgfs2_metafield *mfield;
 
@@ -2117,9 +2117,9 @@ static void getgziplevel(char *argv[], int *i)
 }
 
 static int count_dinode_blks(struct rgrp_tree *rgd, int bitmap,
-			     struct gfs2_buffer_head *rbh)
+			     struct lgfs2_buffer_head *rbh)
 {
-	struct gfs2_buffer_head *tbh;
+	struct lgfs2_buffer_head *tbh;
 	uint64_t b;
 	int dinodes = 0;
 	char *byte, cur_state, new_state;
@@ -2150,7 +2150,7 @@ static int count_dinode_blks(struct rgrp_tree *rgd, int bitmap,
 	return dinodes;
 }
 
-static int count_dinode_bits(struct gfs2_buffer_head *rbh)
+static int count_dinode_bits(struct lgfs2_buffer_head *rbh)
 {
 	uint64_t blk;
 	struct gfs2_meta_header *mh = (struct gfs2_meta_header *)rbh->b_data;
@@ -2174,7 +2174,7 @@ static int count_dinode_bits(struct gfs2_buffer_head *rbh)
 
 static void rg_repair(void)
 {
-	struct gfs2_buffer_head *rbh;
+	struct lgfs2_buffer_head *rbh;
 	struct rgrp_tree *rgd;
 	struct osi_node *n;
 	int b;
gfs2/edit/journal.c +7 -7
index b083e6dd..492f539c 100644
@@ -35,7 +35,7 @@ uint64_t find_journal_block(const char *journal, uint64_t *j_size)
 	int journal_num;
 	uint64_t jindex_block, jblock = 0;
 	int amtread;
-	struct gfs2_buffer_head *jindex_bh, *j_bh;
+	struct lgfs2_buffer_head *jindex_bh, *j_bh;
 
 	journal_num = atoi(journal + 7);
 	if (journal_num < 0)
@@ -106,7 +106,7 @@ static int fsck_readi(struct lgfs2_inode *ip, void *rbuf, uint64_t roffset,
 	       unsigned int size, uint64_t *abs_block)
 {
 	struct gfs2_sbd *sdp;
-	struct gfs2_buffer_head *lbh;
+	struct lgfs2_buffer_head *lbh;
 	uint64_t lblock, dblock;
 	unsigned int o;
 	uint32_t extlen = 0;
@@ -202,7 +202,7 @@ static int print_ld_blks(const __be64 *b, const char *end, int start_line,
 {
 	int bcount = 0, found_tblk = 0, found_bblk = 0;
 	static char str[256];
-	struct gfs2_buffer_head *j_bmap_bh;
+	struct lgfs2_buffer_head *j_bmap_bh;
 
 	if (tblk_off)
 		*tblk_off = 0;
@@ -326,7 +326,7 @@ static uint64_t find_wrap_pt(struct lgfs2_inode *ji, char *jbuf, uint64_t jblock
 		int found = 0;
 
 		if (sbd.gfs1) {
-			struct gfs2_buffer_head *j_bh;
+			struct lgfs2_buffer_head *j_bh;
 
 			j_bh = lgfs2_bread(&sbd, jblock + jb);
 			found = is_wrap_pt(j_bh->b_data, &highest_seq);
@@ -410,7 +410,7 @@ static int process_ld(uint64_t abs_block, uint64_t wrappt, uint64_t j_size,
 static int meta_has_ref(uint64_t abs_block, int tblk)
 {
 	const struct lgfs2_metadata *mtype;
-	struct gfs2_buffer_head *mbh;
+	struct lgfs2_buffer_head *mbh;
 	int structlen = 0, has_ref = 0;
 	__be64 *b;
 	struct gfs2_dinode *dinode;
@@ -445,7 +445,7 @@ static int meta_has_ref(uint64_t abs_block, int tblk)
  */
 static uint64_t get_ldref(uint64_t abs_ld, int offset_from_ld)
 {
-	struct gfs2_buffer_head *jbh;
+	struct lgfs2_buffer_head *jbh;
 	uint64_t refblk;
 	__be64 *b;
 
@@ -502,7 +502,7 @@ static void display_log_header(void *buf, uint64_t *highest_seq, uint64_t abs_bl
 void dump_journal(const char *journal, uint64_t tblk)
 {
 	const struct lgfs2_metadata *mtype;
-	struct gfs2_buffer_head *j_bh = NULL;
+	struct lgfs2_buffer_head *j_bh = NULL;
 	uint64_t jblock, j_size, jb, abs_block, saveblk, wrappt = 0;
 	int start_line, journal_num;
 	struct lgfs2_inode *j_inode = NULL;
gfs2/fsck/afterpass1_common.c +9 -9
index 6ce2dfd2..9b0788b9 100644
@@ -74,7 +74,7 @@ more_refs:
  * If all duplicate references have been removed, delete the block.
  */
 static int delete_block_if_notdup(struct lgfs2_inode *ip, uint64_t block,
-				  struct gfs2_buffer_head **bh,
+				  struct lgfs2_buffer_head **bh,
 				  const char *btype, int *was_duplicate,
 				  void *private)
 {
@@ -111,7 +111,7 @@ static int delete_block_if_notdup(struct lgfs2_inode *ip, uint64_t block,
 
 static int remove_dentry(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			 struct gfs2_dirent *prev_de,
-			 struct gfs2_buffer_head *bh,
+			 struct lgfs2_buffer_head *bh,
 			 char *filename, uint32_t *count, int *lindex,
 			 void *private)
 {
@@ -166,7 +166,7 @@ int remove_dentry_from_dir(struct gfs2_sbd *sdp, uint64_t dir,
 	return error;
 }
 
-int delete_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, int h, int *is_valid,
+int delete_metadata(struct iptr iptr, struct lgfs2_buffer_head **bh, int h, int *is_valid,
 		    int *was_duplicate, void *private)
 {
 	struct lgfs2_inode *ip = iptr.ipt_ip;
@@ -185,7 +185,7 @@ int delete_leaf(struct lgfs2_inode *ip, uint64_t block, void *private)
 }
 
 int delete_data(struct lgfs2_inode *ip, uint64_t metablock,
-		uint64_t block, void *private, struct gfs2_buffer_head *bh,
+		uint64_t block, void *private, struct lgfs2_buffer_head *bh,
 		__be64 *ptr)
 {
 	return delete_block_if_notdup(ip, block, NULL, _("data"), NULL,
@@ -193,7 +193,7 @@ int delete_data(struct lgfs2_inode *ip, uint64_t metablock,
 }
 
 static int del_eattr_generic(struct lgfs2_inode *ip, uint64_t block,
-			     uint64_t parent, struct gfs2_buffer_head **bh,
+			     uint64_t parent, struct lgfs2_buffer_head **bh,
 			     void *private, const char *eatype)
 {
 	int ret = 0;
@@ -224,20 +224,20 @@ static int del_eattr_generic(struct lgfs2_inode *ip, uint64_t block,
 }
 
 int delete_eattr_indir(struct lgfs2_inode *ip, uint64_t block, uint64_t parent,
-		       struct gfs2_buffer_head **bh, void *private)
+		       struct lgfs2_buffer_head **bh, void *private)
 {
 	return del_eattr_generic(ip, block, parent, bh, private,
 				 _("extended attribute"));
 }
 
 int delete_eattr_leaf(struct lgfs2_inode *ip, uint64_t block, uint64_t parent,
-		      struct gfs2_buffer_head **bh, void *private)
+		      struct lgfs2_buffer_head **bh, void *private)
 {
 	return del_eattr_generic(ip, block, parent, bh, private,
 				 _("indirect extended attribute"));
 }
 
-int delete_eattr_entry(struct lgfs2_inode *ip, struct gfs2_buffer_head *leaf_bh,
+int delete_eattr_entry(struct lgfs2_inode *ip, struct lgfs2_buffer_head *leaf_bh,
 		       struct gfs2_ea_header *ea_hdr,
 		       struct gfs2_ea_header *ea_hdr_prev, void *private)
 {
@@ -278,7 +278,7 @@ int delete_eattr_entry(struct lgfs2_inode *ip, struct gfs2_buffer_head *leaf_bh,
 }
 
 int delete_eattr_extentry(struct lgfs2_inode *ip, int i, __be64 *ea_data_ptr,
-			  struct gfs2_buffer_head *leaf_bh, uint32_t tot_ealen,
+			  struct lgfs2_buffer_head *leaf_bh, uint32_t tot_ealen,
 			  struct gfs2_ea_header *ea_hdr,
 			  struct gfs2_ea_header *ea_hdr_prev, void *private)
 {
gfs2/fsck/afterpass1_common.h +6 -6
index 7b5fda25..b0057be4 100644
@@ -4,24 +4,24 @@
 #include "util.h"
 #include "metawalk.h"
 
-extern int delete_metadata(struct iptr iptr, struct gfs2_buffer_head **bh, int h, int *is_valid,
+extern int delete_metadata(struct iptr iptr, struct lgfs2_buffer_head **bh, int h, int *is_valid,
 			   int *was_duplicate, void *private);
 extern int delete_leaf(struct lgfs2_inode *ip, uint64_t block, void *private);
 extern int delete_data(struct lgfs2_inode *ip, uint64_t metablock,
 		       uint64_t block, void *private,
-		       struct gfs2_buffer_head *bh, __be64 *ptr);
+		       struct lgfs2_buffer_head *bh, __be64 *ptr);
 extern int delete_eattr_indir(struct lgfs2_inode *ip, uint64_t block, uint64_t parent,
-		       struct gfs2_buffer_head **bh, void *private);
+		       struct lgfs2_buffer_head **bh, void *private);
 extern int delete_eattr_leaf(struct lgfs2_inode *ip, uint64_t block, uint64_t parent,
-		      struct gfs2_buffer_head **bh, void *private);
+		      struct lgfs2_buffer_head **bh, void *private);
 extern int delete_eattr_entry(struct lgfs2_inode *ip,
-			      struct gfs2_buffer_head *leaf_bh,
+			      struct lgfs2_buffer_head *leaf_bh,
 			      struct gfs2_ea_header *ea_hdr,
 			      struct gfs2_ea_header *ea_hdr_prev,
 			      void *private);
 extern int delete_eattr_extentry(struct lgfs2_inode *ip, int i,
 				 __be64 *ea_data_ptr,
-				 struct gfs2_buffer_head *leaf_bh,
+				 struct lgfs2_buffer_head *leaf_bh,
 				 uint32_t tot_ealen,
 				 struct gfs2_ea_header *ea_hdr,
 				 struct gfs2_ea_header *ea_hdr_prev,
gfs2/fsck/fs_recovery.c +9 -9
index c5f82e47..11dc4792 100644
@@ -99,7 +99,7 @@ static void revoke_clean(struct gfs2_sbd *sdp)
 }
 
 static void refresh_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
-			 struct gfs2_buffer_head *bh, uint64_t blkno)
+			 struct lgfs2_buffer_head *bh, uint64_t blkno)
 {
 	int i;
 
@@ -127,7 +127,7 @@ static int buf_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	unsigned int blks = be32_to_cpu(ld->ld_data1);
-	struct gfs2_buffer_head *bh_log, *bh_ip;
+	struct lgfs2_buffer_head *bh_log, *bh_ip;
 	uint64_t blkno;
 	int error = 0;
 	struct rgrp_tree *rgd;
@@ -189,7 +189,7 @@ static int revoke_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	unsigned int blks = be32_to_cpu(ld->ld_length);
 	unsigned int revokes = be32_to_cpu(ld->ld_data1);
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	unsigned int offset;
 	uint64_t blkno;
 	int first = 1;
@@ -238,7 +238,7 @@ static int databuf_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	unsigned int blks = be32_to_cpu(ld->ld_data1);
-	struct gfs2_buffer_head *bh_log, *bh_ip;
+	struct lgfs2_buffer_head *bh_log, *bh_ip;
 	uint64_t blkno;
 	uint64_t esc;
 	int error = 0;
@@ -301,7 +301,7 @@ static int databuf_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 static int foreach_descriptor(struct lgfs2_inode *ip, unsigned int start,
 		       unsigned int end, int pass)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	struct gfs2_log_descriptor *ld;
 	int error = 0;
 	uint32_t length;
@@ -394,7 +394,7 @@ static int check_journal_seq_no(struct lgfs2_inode *ip, int fix)
 	uint64_t highest_seq = 0, lowest_seq = 0, prev_seq = 0;
 	int new = 0;
 	uint64_t dblock;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	int seq_errors = 0;
 
 	memset(&lh, 0, sizeof(lh));
@@ -620,7 +620,7 @@ static int rangecheck_jblock(struct lgfs2_inode *ip, uint64_t block)
 	return META_IS_GOOD;
 }
 
-static int rangecheck_jmeta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
+static int rangecheck_jmeta(struct iptr iptr, struct lgfs2_buffer_head **bh, int h,
                             int *is_valid, int *was_duplicate, void *private)
 {
 	struct lgfs2_inode *ip = iptr.ipt_ip;
@@ -650,7 +650,7 @@ static int rangecheck_jmeta(struct iptr iptr, struct gfs2_buffer_head **bh, int
 
 static int rangecheck_jdata(struct lgfs2_inode *ip, uint64_t metablock,
 			    uint64_t block, void *private,
-			    struct gfs2_buffer_head *bh, __be64 *ptr)
+			    struct lgfs2_buffer_head *bh, __be64 *ptr)
 {
 	return rangecheck_jblock(ip, block);
 }
@@ -810,7 +810,7 @@ static void bad_journalname(const char *filename, int len)
  */
 static int check_jindex_dent(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			     struct gfs2_dirent *prev_de,
-			     struct gfs2_buffer_head *bh, char *filename,
+			     struct lgfs2_buffer_head *bh, char *filename,
 			     uint32_t *count, int *lindex, void *priv)
 {
 	struct lgfs2_dirent d;
gfs2/fsck/fsck.h +1 -1
index 6bfb6321..1645b853 100644
@@ -111,7 +111,7 @@ enum rgindex_trust_level { /* how far can we trust our RG index? */
 extern struct lgfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block);
 extern struct lgfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
 					 struct rgrp_tree *rgd,
-					 struct gfs2_buffer_head *bh);
+					 struct lgfs2_buffer_head *bh);
 extern void fsck_inode_put(struct lgfs2_inode **ip);
 
 extern int initialize(struct gfs2_sbd *sdp, int force_check, int preen,
gfs2/fsck/initialize.c +7 -7
index 16e7f065..8ccfda3e 100644
@@ -193,7 +193,7 @@ static void check_rgrp_integrity(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 	int rgb, x, y, off, bytes_to_check, total_bytes_to_check, asked = 0;
 	unsigned int state;
 	uint64_t diblock;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 
 	rg_free = rg_reclaimed = rg_unlinked = rg_usedmeta = rg_useddi = 0;
 	total_bytes_to_check = rgd->rt_bitbytes;
@@ -435,7 +435,7 @@ static void check_rgrps_integrity(struct gfs2_sbd *sdp)
 static int rebuild_master(struct gfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
-	struct gfs2_buffer_head *bh = NULL;
+	struct lgfs2_buffer_head *bh = NULL;
 	int err = 0;
 
 	log_err(_("The system master directory seems to be destroyed.\n"));
@@ -1069,7 +1069,7 @@ static void peruse_user_dinode(struct gfs2_sbd *sdp, struct lgfs2_inode *ip)
 		return;             /* it can't lead us to the root anyway */
 
 	if (ip->i_num.in_formal_ino == 1) {
-		struct gfs2_buffer_head *root_bh;
+		struct lgfs2_buffer_head *root_bh;
 
 		if (ip->i_num.in_addr == ip->i_bh->b_blocknr) {
 			log_warn(_("Found the root directory at: 0x%"PRIx64".\n"),
@@ -1126,7 +1126,7 @@ static int find_rgs_for_bsize(struct gfs2_sbd *sdp, uint64_t startblock,
 			      uint32_t *known_bsize)
 {
 	uint64_t blk, max_rg_size, rb_addr;
-	struct gfs2_buffer_head *bh, *rb_bh;
+	struct lgfs2_buffer_head *bh, *rb_bh;
 	uint32_t bsize, bsize2;
 	int found_rg;
 
@@ -1193,7 +1193,7 @@ static int find_rgs_for_bsize(struct gfs2_sbd *sdp, uint64_t startblock,
 static int peruse_metadata(struct gfs2_sbd *sdp, uint64_t startblock)
 {
 	uint64_t blk, max_rg_size;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	struct lgfs2_inode *ip;
 
 	max_rg_size = 2147483648ull / sdp->sd_bsize;
@@ -1273,7 +1273,7 @@ static int sb_repair(struct gfs2_sbd *sdp)
 		sdp->sd_root_dir.in_addr = possible_root;
 		sdp->md.rooti = lgfs2_inode_read(sdp, possible_root);
 		if (!sdp->md.rooti || sdp->md.rooti->i_magic != GFS2_MAGIC) {
-			struct gfs2_buffer_head *bh = NULL;
+			struct lgfs2_buffer_head *bh = NULL;
 			struct lgfs2_inum inum;
 
 			log_err(_("The root dinode block is destroyed.\n"));
@@ -1377,7 +1377,7 @@ static int reconstruct_single_journal(struct gfs2_sbd *sdp, int jnum,
 				      uint32_t ji_nsegment)
 {
 	uint64_t first = sdp->md.journal[jnum]->i_num.in_addr;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	uint64_t sequence;
 
 	srandom(time(NULL));
gfs2/fsck/metawalk.c +25 -25

200 lines not on this page · raw message

gfs2/fsck/metawalk.h +11 -11
index ce2e8efd..76190685 100644
@@ -14,7 +14,7 @@ extern int check_metatree(struct lgfs2_inode *ip, struct metawalk_fxns *pass);
 extern int check_leaf_blks(struct lgfs2_inode *ip, struct metawalk_fxns *pass);
 extern int check_dir(struct gfs2_sbd *sdp, struct lgfs2_inode *ip,
 		     struct metawalk_fxns *pass);
-extern int check_linear_dir(struct lgfs2_inode *ip, struct gfs2_buffer_head *bh,
+extern int check_linear_dir(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
 			    struct metawalk_fxns *pass);
 extern int check_leaf(struct lgfs2_inode *ip, int lindex,
 		      struct metawalk_fxns *pass, uint64_t *leaf_no,
@@ -44,7 +44,7 @@ enum meta_check_rc {
 
 struct iptr {
 	struct lgfs2_inode *ipt_ip;
-	struct gfs2_buffer_head *ipt_bh;
+	struct lgfs2_buffer_head *ipt_bh;
 	unsigned ipt_off;
 };
 
@@ -73,7 +73,7 @@ struct metawalk_fxns {
 	int invalid_meta_is_fatal;
 	int readahead;
 	int (*check_leaf_depth) (struct lgfs2_inode *ip, uint64_t leaf_no,
-				 int ref_count, struct gfs2_buffer_head *lbh);
+				 int ref_count, struct lgfs2_buffer_head *lbh);
 	int (*check_leaf) (struct lgfs2_inode *ip, uint64_t block,
 			   void *private);
 	/* parameters to the check_metalist sub-functions:
@@ -91,31 +91,31 @@ struct metawalk_fxns {
 	            1 - skip further processing
 	*/
 	int (*check_metalist) (struct iptr iptr,
-			       struct gfs2_buffer_head **bh, int h,
+			       struct lgfs2_buffer_head **bh, int h,
 			       int *is_valid, int *was_duplicate,
 			       void *private);
 	int (*check_data) (struct lgfs2_inode *ip, uint64_t metablock,
 			   uint64_t block, void *private,
-			   struct gfs2_buffer_head *bh, __be64 *ptr);
+			   struct lgfs2_buffer_head *bh, __be64 *ptr);
 	int (*check_eattr_indir) (struct lgfs2_inode *ip, uint64_t block,
 				  uint64_t parent,
-				  struct gfs2_buffer_head **bh, void *private);
+				  struct lgfs2_buffer_head **bh, void *private);
 	int (*check_eattr_leaf) (struct lgfs2_inode *ip, uint64_t block,
-				 uint64_t parent, struct gfs2_buffer_head **bh,
+				 uint64_t parent, struct lgfs2_buffer_head **bh,
 				 void *private);
 	int (*check_dentry) (struct lgfs2_inode *ip, struct gfs2_dirent *de,
 			     struct gfs2_dirent *prev,
-			     struct gfs2_buffer_head *bh,
+			     struct lgfs2_buffer_head *bh,
 			     char *filename, uint32_t *count,
 			     int *lindex, void *private);
 	int (*check_eattr_entry) (struct lgfs2_inode *ip,
-				  struct gfs2_buffer_head *leaf_bh,
+				  struct lgfs2_buffer_head *leaf_bh,
 				  struct gfs2_ea_header *ea_hdr,
 				  struct gfs2_ea_header *ea_hdr_prev,
 				  void *private);
 	int (*check_eattr_extentry) (struct lgfs2_inode *ip, int i,
 				     __be64 *ea_data_ptr,
-				     struct gfs2_buffer_head *leaf_bh,
+				     struct lgfs2_buffer_head *leaf_bh,
 				     uint32_t tot_ealen,
 				     struct gfs2_ea_header *ea_hdr,
 				     struct gfs2_ea_header *ea_hdr_prev,
@@ -132,7 +132,7 @@ struct metawalk_fxns {
 	int (*undo_check_data) (struct lgfs2_inode *ip, uint64_t block,
 				void *private);
 	int (*delete_block) (struct lgfs2_inode *ip, uint64_t block,
-			     struct gfs2_buffer_head **bh, const char *btype,
+			     struct lgfs2_buffer_head **bh, const char *btype,
 			     void *private);
 };
 
gfs2/fsck/pass1.c +34 -34

249 lines not on this page · raw message

gfs2/fsck/pass1b.c +14 -14
index 6add4562..11c722d2 100644
@@ -43,7 +43,7 @@ struct meta_blk_ref {
 
 static int clone_data(struct lgfs2_inode *ip, uint64_t metablock,
 		      uint64_t block, void *private,
-		      struct gfs2_buffer_head *bh, __be64 *ptr);
+		      struct lgfs2_buffer_head *bh, __be64 *ptr);
 
 static void log_inode_reference(struct duptree *dt, osi_list_t *tmp, int inval)
 {
@@ -66,7 +66,7 @@ static void log_inode_reference(struct duptree *dt, osi_list_t *tmp, int inval)
 	         reftypestring);
 }
 
-static int findref_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
+static int findref_meta(struct iptr iptr, struct lgfs2_buffer_head **bh, int h,
                         int *is_valid, int *was_duplicate, void *private)
 {
 	*is_valid = 1;
@@ -76,7 +76,7 @@ static int findref_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
 
 static int findref_data(struct lgfs2_inode *ip, uint64_t metablock,
 			uint64_t block, void *private,
-			struct gfs2_buffer_head *bh, __be64 *ptr)
+			struct lgfs2_buffer_head *bh, __be64 *ptr)
 {
 	struct meta_blk_ref *mbr = (struct meta_blk_ref *)private;
 
@@ -100,7 +100,7 @@ static void clone_data_block(struct gfs2_sbd *sdp, struct duptree *dt,
 	};
 	struct clone_target clone = {.dup_block = dt->block,};
 	struct lgfs2_inode *ip;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	__be64 *ptr;
 
 	if (!(query(_("Okay to clone data block %"PRIu64" (0x%"PRIx64") for inode %"PRIu64" (0x%"PRIx64")? (y/n) "),
@@ -370,7 +370,7 @@ static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
 	return;
 }
 
-static int clone_check_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
+static int clone_check_meta(struct iptr iptr, struct lgfs2_buffer_head **bh, int h,
                             int *is_valid, int *was_duplicate, void *private)
 {
 	struct lgfs2_inode *ip = iptr.ipt_ip;
@@ -389,10 +389,10 @@ static int clone_check_meta(struct iptr iptr, struct gfs2_buffer_head **bh, int
  */
 static int clone_data(struct lgfs2_inode *ip, uint64_t metablock,
 		      uint64_t block, void *private,
-		      struct gfs2_buffer_head *bh, __be64 *ptr)
+		      struct lgfs2_buffer_head *bh, __be64 *ptr)
 {
 	struct clone_target *clonet = (struct clone_target *)private;
-	struct gfs2_buffer_head *clone_bh;
+	struct lgfs2_buffer_head *clone_bh;
 	uint64_t cloneblock;
 	int error;
 
@@ -605,7 +605,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
 {
 	osi_list_t *tmp;
 	struct dup_handler dh = {0};
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	__be32 cmagic, ctype;
 	enum dup_ref_type acceptable_ref;
 	uint64_t dup_blk;
@@ -736,7 +736,7 @@ static int check_leaf_refs(struct lgfs2_inode *ip, uint64_t block,
 	return add_duplicate_ref(ip, block, REF_AS_META, 1, INODE_VALID);
 }
 
-static int check_metalist_refs(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
+static int check_metalist_refs(struct iptr iptr, struct lgfs2_buffer_head **bh, int h,
                                int *is_valid, int *was_duplicate, void *private)
 {
 	struct lgfs2_inode *ip = iptr.ipt_ip;
@@ -749,14 +749,14 @@ static int check_metalist_refs(struct iptr iptr, struct gfs2_buffer_head **bh, i
 
 static int check_data_refs(struct lgfs2_inode *ip, uint64_t metablock,
 			   uint64_t block, void *private,
-			   struct gfs2_buffer_head *bh, __be64 *ptr)
+			   struct lgfs2_buffer_head *bh, __be64 *ptr)
 {
 	return add_duplicate_ref(ip, block, REF_AS_DATA, 1, INODE_VALID);
 }
 
 static int check_eattr_indir_refs(struct lgfs2_inode *ip, uint64_t block,
 				  uint64_t parent,
-				  struct gfs2_buffer_head **bh, void *private)
+				  struct lgfs2_buffer_head **bh, void *private)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	int error;
@@ -769,7 +769,7 @@ static int check_eattr_indir_refs(struct lgfs2_inode *ip, uint64_t block,
 }
 
 static int check_eattr_leaf_refs(struct lgfs2_inode *ip, uint64_t block,
-				 uint64_t parent, struct gfs2_buffer_head **bh,
+				 uint64_t parent, struct lgfs2_buffer_head **bh,
 				 void *private)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -782,7 +782,7 @@ static int check_eattr_leaf_refs(struct lgfs2_inode *ip, uint64_t block,
 }
 
 static int check_eattr_entry_refs(struct lgfs2_inode *ip,
-				  struct gfs2_buffer_head *leaf_bh,
+				  struct lgfs2_buffer_head *leaf_bh,
 				  struct gfs2_ea_header *ea_hdr,
 				  struct gfs2_ea_header *ea_hdr_prev,
 				  void *private)
@@ -792,7 +792,7 @@ static int check_eattr_entry_refs(struct lgfs2_inode *ip,
 
 static int check_eattr_extentry_refs(struct lgfs2_inode *ip, int i,
 				     __be64 *ea_data_ptr,
-				     struct gfs2_buffer_head *leaf_bh,
+				     struct lgfs2_buffer_head *leaf_bh,
 				     uint32_t tot_ealen,
 				     struct gfs2_ea_header *ea_hdr,
 				     struct gfs2_ea_header *ea_hdr_prev,
gfs2/fsck/pass2.c +20 -20
index 7e0957ae..6c13cce9 100644
@@ -96,14 +96,14 @@ static int set_dotdot_dir(struct gfs2_sbd *sdp, uint64_t childblock, struct lgfs
 }
 
 static int check_eattr_indir(struct lgfs2_inode *ip, uint64_t block,
-			     uint64_t parent, struct gfs2_buffer_head **bh,
+			     uint64_t parent, struct lgfs2_buffer_head **bh,
 			     void *private)
 {
 	*bh = lgfs2_bread(ip->i_sbd, block);
 	return 0;
 }
 static int check_eattr_leaf(struct lgfs2_inode *ip, uint64_t block,
-			    uint64_t parent, struct gfs2_buffer_head **bh,
+			    uint64_t parent, struct lgfs2_buffer_head **bh,
 			    void *private)
 {
 	*bh = lgfs2_bread(ip->i_sbd, block);
@@ -163,7 +163,7 @@ static struct metawalk_fxns pass2_fxns_delete = {
 static int bad_formal_ino(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			  struct lgfs2_inum entry, const char *tmp_name,
 			  int q, struct lgfs2_dirent *d,
-			  struct gfs2_buffer_head *bh)
+			  struct lgfs2_buffer_head *bh)
 {
 	struct inode_info *ii;
 	struct dir_info *di = NULL;
@@ -238,7 +238,7 @@ static int hash_table_index(uint32_t hash, struct lgfs2_inode *ip)
 }
 
 static int hash_table_max(int lindex, struct lgfs2_inode *ip,
-		   struct gfs2_buffer_head *bh)
+		   struct lgfs2_buffer_head *bh)
 {
 	struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
 	return (1 << (ip->i_depth - be16_to_cpu(leaf->lf_depth))) +
@@ -246,7 +246,7 @@ static int hash_table_max(int lindex, struct lgfs2_inode *ip,
 }
 
 static int check_leaf_depth(struct lgfs2_inode *ip, uint64_t leaf_no,
-			    int ref_count, struct gfs2_buffer_head *lbh)
+			    int ref_count, struct lgfs2_buffer_head *lbh)
 {
 	struct gfs2_leaf *leaf = (struct gfs2_leaf *)lbh->b_data;
 	int cur_depth = be16_to_cpu(leaf->lf_depth);
@@ -292,13 +292,13 @@ static int check_leaf_depth(struct lgfs2_inode *ip, uint64_t leaf_no,
  */
 static int wrong_leaf(struct lgfs2_inode *ip, struct lgfs2_inum *entry,
 		      const char *tmp_name, int *lindex, int lindex_max,
-		      int hash_index, struct gfs2_buffer_head *bh,
+		      int hash_index, struct lgfs2_buffer_head *bh,
 		      struct dir_status *ds, struct gfs2_dirent *dent,
 		      struct lgfs2_dirent *d, struct gfs2_dirent *prev_de,
 		      uint32_t *count, int q)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *dest_lbh;
+	struct lgfs2_buffer_head *dest_lbh;
 	uint64_t planned_leaf, real_leaf;
 	int li, dest_ref, error;
 	__be64 *tbl;
@@ -424,7 +424,7 @@ static int basic_dentry_checks(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			       struct lgfs2_inum *entry, const char *tmp_name,
 			       uint32_t *count, struct lgfs2_dirent *d,
 			       struct dir_status *ds, int *q,
-			       struct gfs2_buffer_head *bh, int *isdir)
+			       struct lgfs2_buffer_head *bh, int *isdir)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	uint32_t calculated_hash;
@@ -598,7 +598,7 @@ static int basic_dentry_checks(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 	 * eattr or indirect block, but marked "dinode" in the bitmap because
 	 * gfs1 marked all gfs1 metadata that way. */
 	if (ii == NULL && di == NULL && sdp->gfs1) {
-		struct gfs2_buffer_head *tbh;
+		struct lgfs2_buffer_head *tbh;
 
 		tbh = lgfs2_bread(sdp, entry->in_addr);
 		if (lgfs2_check_meta(tbh->b_data, GFS2_METATYPE_DI)) { /* not dinode */
@@ -615,7 +615,7 @@ static int basic_dentry_checks(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 }
 
 static int dirref_find(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
-		       struct gfs2_dirent *prev, struct gfs2_buffer_head *bh,
+		       struct gfs2_dirent *prev, struct lgfs2_buffer_head *bh,
 		       char *filename, uint32_t *count, int *lindex,
 		       void *private)
 {
@@ -720,7 +720,7 @@ static int check_suspicious_dirref(struct gfs2_sbd *sdp,
  * FIXMEs internally first */
 static int check_dentry(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			struct gfs2_dirent *prev_de,
-			struct gfs2_buffer_head *bh, char *filename,
+			struct lgfs2_buffer_head *bh, char *filename,
 			uint32_t *count, int *lindex, void *priv)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -931,7 +931,7 @@ static int write_new_leaf(struct lgfs2_inode *dip, int start_lindex,
 			  int num_copies, const char *before_or_after,
 			  uint64_t *bn)
 {
-	struct gfs2_buffer_head *nbh;
+	struct lgfs2_buffer_head *nbh;
 	struct gfs2_leaf *leaf;
 	struct gfs2_dirent *dent;
 	int count, i;
@@ -1071,7 +1071,7 @@ static void pad_with_leafblks(struct lgfs2_inode *ip, __be64 *tbl,
  * we need to pad the gap we leave.
  */
 static int lost_leaf(struct lgfs2_inode *ip, __be64 *tbl, uint64_t leafno,
-		     int ref_count, int lindex, struct gfs2_buffer_head *bh)
+		     int ref_count, int lindex, struct lgfs2_buffer_head *bh)
 {
 	char *filename;
 	char *bh_end = bh->b_data + ip->i_sbd->sd_bsize;
@@ -1166,7 +1166,7 @@ static int lost_leaf(struct lgfs2_inode *ip, __be64 *tbl, uint64_t leafno,
 
 static int basic_check_dentry(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			      struct gfs2_dirent *prev_de,
-			      struct gfs2_buffer_head *bh, char *filename,
+			      struct lgfs2_buffer_head *bh, char *filename,
 			      uint32_t *count, int *lindex, void *priv)
 {
 	int q = 0;
@@ -1291,7 +1291,7 @@ static int fix_hashtable(struct lgfs2_inode *ip, __be64 *tbl, unsigned hsize,
 			 uint64_t leafblk, int lindex, uint32_t proper_start,
 			 int len, int *proper_len, int factor)
 {
-	struct gfs2_buffer_head *lbh;
+	struct lgfs2_buffer_head *lbh;
 	struct lgfs2_dirent dentry;
 	struct lgfs2_leaf leaf;
 	struct gfs2_dirent *de;
@@ -1467,7 +1467,7 @@ static int check_hash_tbl_dups(struct lgfs2_inode *ip, __be64 *tbl,
 {
 	int l, len2;
 	uint64_t leafblk, leaf_no;
-	struct gfs2_buffer_head *lbh;
+	struct lgfs2_buffer_head *lbh;
 	struct gfs2_leaf leaf;
 	struct lgfs2_dirent dentry;
 	struct gfs2_dirent *de;
@@ -1586,7 +1586,7 @@ static int check_hash_tbl(struct lgfs2_inode *ip, __be64 *tbl,
 	int lindex, len, proper_len, i, changes = 0;
 	uint64_t leafblk;
 	struct lgfs2_leaf leaf;
-	struct gfs2_buffer_head *lbh;
+	struct lgfs2_buffer_head *lbh;
 	int factor;
 	uint32_t proper_start;
 	int anomaly;
@@ -1763,7 +1763,7 @@ static struct metawalk_fxns pass2_fxns = {
 	.repair_leaf = pass2_repair_leaf,
 };
 
-static int check_metalist_qc(struct iptr iptr, struct gfs2_buffer_head **bh, int h,
+static int check_metalist_qc(struct iptr iptr, struct lgfs2_buffer_head **bh, int h,
                              int *is_valid, int *was_duplicate, void *private)
 {
 	struct lgfs2_inode *ip = iptr.ipt_ip;
@@ -1777,9 +1777,9 @@ static int check_metalist_qc(struct iptr iptr, struct gfs2_buffer_head **bh, int
 
 static int check_data_qc(struct lgfs2_inode *ip, uint64_t metablock,
 			 uint64_t block, void *private,
-			 struct gfs2_buffer_head *bbh, __be64 *ptr)
+			 struct lgfs2_buffer_head *bbh, __be64 *ptr)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 
 	/* At this point, basic data block checks have already been done,
 	   so we only need to make sure they're QC blocks. */
gfs2/fsck/pass5.c +1 -1
index 9aba38e6..df8233a4 100644
@@ -46,7 +46,7 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
 		 * we must determine whether it's really a dinode or other
 		 * metadata by reading it in. */
 		if (sdp->gfs1 && q == GFS2_BLKST_DINODE) {
-			struct gfs2_buffer_head *bh;
+			struct lgfs2_buffer_head *bh;
 
 			bh = lgfs2_bread(sdp, block);
 			if (lgfs2_check_meta(bh->b_data, GFS2_METATYPE_DI) == 0)
gfs2/fsck/rgrepair.c +6 -6
index 14b1d56a..5c9c5d78 100644
@@ -53,7 +53,7 @@ static void find_journaled_rgs(struct gfs2_sbd *sdp)
 	unsigned int jblocks;
 	uint64_t b, dblock;
 	struct lgfs2_inode *ip;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	int false_count;
 
 	osi_list_init(&false_rgrps.list);
@@ -101,7 +101,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
 				int *dist_cnt)
 {
 	uint64_t blk, block_last_rg, shortest_dist_btwn_rgs;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	int rgs_sampled = 0;
 	uint64_t initial_first_rg_dist;
 	int gsegment = 0;
@@ -257,7 +257,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
  * count_usedspace - count the used bits in a rgrp bitmap buffer
  */
 static uint64_t count_usedspace(struct gfs2_sbd *sdp, int first,
-				struct gfs2_buffer_head *bh)
+				struct lgfs2_buffer_head *bh)
 {
 	int off, x, y, bytes_to_check;
 	uint32_t rg_used = 0;
@@ -313,7 +313,7 @@ static uint64_t find_next_rgrp_dist(struct gfs2_sbd *sdp, uint64_t blk,
 	struct osi_node *n, *next = NULL;
 	uint64_t rgrp_dist = 0, used_blocks, block, next_block, twogigs;
 	struct rgrp_tree *rgd = NULL, *next_rgd;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	int first, length, b, found;
 	uint64_t mega_in_blocks;
 	uint32_t free_blocks;
@@ -423,7 +423,7 @@ static uint64_t hunt_and_peck(struct gfs2_sbd *sdp, uint64_t blk,
 			      struct rgrp_tree *prevrgd, uint64_t last_bump)
 {
 	uint64_t rgrp_dist = 0, block, twogigs, last_block, last_meg;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	struct gfs2_meta_header *mh;
 	int b, mega_in_blocks;
 
@@ -513,7 +513,7 @@ static uint64_t hunt_and_peck(struct gfs2_sbd *sdp, uint64_t blk,
 static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
 {
 	struct osi_node *n, *next = NULL;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	uint64_t rg_dist[MAX_RGSEGMENTS] = {0, };
 	int rg_dcnt[MAX_RGSEGMENTS] = {0, };
 	uint64_t blk;
gfs2/libgfs2/buf.c +9 -9
index c2cb7461..bd1ba6c1 100644
@@ -22,23 +22,23 @@
   #endif
 #endif
 
-struct gfs2_buffer_head *lgfs2_bget(struct gfs2_sbd *sdp, uint64_t num)
+struct lgfs2_buffer_head *lgfs2_bget(struct gfs2_sbd *sdp, uint64_t num)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 
-	bh = calloc(1, sizeof(struct gfs2_buffer_head) + sdp->sd_bsize);
+	bh = calloc(1, sizeof(struct lgfs2_buffer_head) + sdp->sd_bsize);
 	if (bh == NULL)
 		return NULL;
 
 	bh->b_blocknr = num;
 	bh->sdp = sdp;
-	bh->iov.iov_base = (char *)bh + sizeof(struct gfs2_buffer_head);
+	bh->iov.iov_base = (char *)bh + sizeof(struct lgfs2_buffer_head);
 	bh->iov.iov_len = sdp->sd_bsize;
 
 	return bh;
 }
 
-int __lgfs2_breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n,
+int __lgfs2_breadm(struct gfs2_sbd *sdp, struct lgfs2_buffer_head **bhs, size_t n,
                    uint64_t block, int line, const char *caller)
 {
 	size_t v = (n < IOV_MAX) ? n : IOV_MAX;
@@ -71,10 +71,10 @@ int __lgfs2_breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n
 	return 0;
 }
 
-struct gfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num, int line,
+struct lgfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num, int line,
 				 const char *caller)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	ssize_t ret;
 
 	bh = lgfs2_bget(sdp, num);
@@ -91,7 +91,7 @@ struct gfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num, int l
 	return bh;
 }
 
-int lgfs2_bwrite(struct gfs2_buffer_head *bh)
+int lgfs2_bwrite(struct lgfs2_buffer_head *bh)
 {
 	struct gfs2_sbd *sdp = bh->sdp;
 
@@ -101,7 +101,7 @@ int lgfs2_bwrite(struct gfs2_buffer_head *bh)
 	return 0;
 }
 
-int lgfs2_brelse(struct gfs2_buffer_head *bh)
+int lgfs2_brelse(struct lgfs2_buffer_head *bh)
 {
 	int error = 0;
 
gfs2/libgfs2/fs_ops.c +37 -37

270 lines not on this page · raw message

gfs2/libgfs2/gfs1.c +4 -4
index 1fe366e1..440b8918 100644
@@ -38,7 +38,7 @@ int lgfs2_is_gfs_dir(struct lgfs2_inode *ip)
 	return 0;
 }
 
-void lgfs2_gfs1_lookup_block(struct lgfs2_inode *ip, struct gfs2_buffer_head *bh,
+void lgfs2_gfs1_lookup_block(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
 		  unsigned int height, struct metapath *mp,
 		  int create, int *new, uint64_t *block)
 {
@@ -71,7 +71,7 @@ void lgfs2_gfs1_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
 		    uint64_t *dblock, uint32_t *extlen, int prealloc)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	struct metapath mp;
 	int create = *new;
 	unsigned int bsize;
@@ -167,7 +167,7 @@ int lgfs2_gfs1_writei(struct lgfs2_inode *ip, void *buf, uint64_t offset,
 		unsigned int size)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	uint64_t lblock, dblock;
 	uint32_t extlen = 0;
 	unsigned int amount;
@@ -291,7 +291,7 @@ struct lgfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
 
 struct lgfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	struct lgfs2_inode *ip;
 
 	bh = lgfs2_bget(sdp, di_addr);
gfs2/libgfs2/libgfs2.h +17 -17
index ec14f75e..273f07fd 100644
@@ -234,7 +234,7 @@ extern lgfs2_rgrp_t lgfs2_rgrp_prev(lgfs2_rgrp_t rg);
 // Temporary function to aid API migration
 extern void lgfs2_attach_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs);
 
-struct gfs2_buffer_head {
+struct lgfs2_buffer_head {
 	osi_list_t b_altlist; /* alternate list */
 	uint64_t b_blocknr;
 	union {
@@ -251,7 +251,7 @@ struct lgfs2_inum {
 };
 
 struct lgfs2_inode {
-	struct gfs2_buffer_head *i_bh;
+	struct lgfs2_buffer_head *i_bh;
 	struct gfs2_sbd *i_sbd;
 	struct rgrp_tree *i_rgd; /* performance hint */
 	int bh_owned; /* Is this bh owned, iow, should we release it later? */
@@ -458,12 +458,12 @@ extern int lgfs2_field_str(char *str, const size_t size, const char *blk, const
 extern int lgfs2_field_assign(char *blk, const struct lgfs2_metafield *field, const void *val);
 
 /* buf.c */
-extern struct gfs2_buffer_head *lgfs2_bget(struct gfs2_sbd *sdp, uint64_t num);
-extern struct gfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num,
+extern struct lgfs2_buffer_head *lgfs2_bget(struct gfs2_sbd *sdp, uint64_t num);
+extern struct lgfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num,
 					int line, const char *caller);
-extern int __lgfs2_breadm(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhs, size_t n, uint64_t block, int line, const char *caller);
-extern int lgfs2_bwrite(struct gfs2_buffer_head *bh);
-extern int lgfs2_brelse(struct gfs2_buffer_head *bh);
+extern int __lgfs2_breadm(struct gfs2_sbd *sdp, struct lgfs2_buffer_head **bhs, size_t n, uint64_t block, int line, const char *caller);
+extern int lgfs2_bwrite(struct lgfs2_buffer_head *bh);
+extern int lgfs2_brelse(struct lgfs2_buffer_head *bh);
 extern uint32_t lgfs2_get_block_type(const char *buf);
 
 #define lgfs2_bmodified(bh) do { bh->b_modified = 1; } while(0)
@@ -495,11 +495,11 @@ extern int lgfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
 #define IS_DINODE   (2)
 
 extern void lgfs2_find_metapath(struct lgfs2_inode *ip, uint64_t block, struct metapath *mp);
-extern void lgfs2_lookup_block(struct lgfs2_inode *ip, struct gfs2_buffer_head *bh,
+extern void lgfs2_lookup_block(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
 			 unsigned int height, struct metapath *mp,
 			 int create, int *new, uint64_t *block);
 extern struct lgfs2_inode *lgfs2_inode_get(struct gfs2_sbd *sdp,
-				    struct gfs2_buffer_head *bh);
+				    struct lgfs2_buffer_head *bh);
 extern struct lgfs2_inode *lgfs2_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr);
 extern struct lgfs2_inode *lgfs2_is_system_inode(struct gfs2_sbd *sdp,
 					  uint64_t block);
@@ -516,14 +516,14 @@ extern int lgfs2_readi(struct lgfs2_inode *ip, void *buf, uint64_t offset,
 	__lgfs2_writei(ip, buf, offset, size, 1)
 extern int __lgfs2_writei(struct lgfs2_inode *ip, void *buf, uint64_t offset,
 			 unsigned int size, int resize);
-extern int lgfs2_init_dinode(struct gfs2_sbd *sdp, struct gfs2_buffer_head **bhp, struct lgfs2_inum *inum,
+extern int lgfs2_init_dinode(struct gfs2_sbd *sdp, struct lgfs2_buffer_head **bhp, struct lgfs2_inum *inum,
                        unsigned int mode, uint32_t flags, struct lgfs2_inum *parent);
 extern struct lgfs2_inode *lgfs2_createi(struct lgfs2_inode *dip, const char *filename,
 				  unsigned int mode, uint32_t flags);
 extern struct lgfs2_inode *lgfs2_gfs_createi(struct lgfs2_inode *dip,
 				      const char *filename, unsigned int mode,
 				      uint32_t flags);
-extern void lgfs2_dirent2_del(struct lgfs2_inode *dip, struct gfs2_buffer_head *bh,
+extern void lgfs2_dirent2_del(struct lgfs2_inode *dip, struct lgfs2_buffer_head *bh,
 			struct gfs2_dirent *prev, struct gfs2_dirent *cur);
 extern int lgfs2_dir_search(struct lgfs2_inode *dip, const char *filename, int len,
 		      unsigned int *type, struct lgfs2_inum *inum);
@@ -536,15 +536,15 @@ extern void lgfs2_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
 		      uint64_t *dblock, uint32_t *extlen, int prealloc);
 extern int lgfs2_get_leaf_ptr(struct lgfs2_inode *dip, uint32_t index, uint64_t *ptr) __attribute__((warn_unused_result));
 extern void lgfs2_dir_split_leaf(struct lgfs2_inode *dip, uint32_t start,
-			   uint64_t leaf_no, struct gfs2_buffer_head *obh);
+			   uint64_t leaf_no, struct lgfs2_buffer_head *obh);
 extern void lgfs2_free_block(struct gfs2_sbd *sdp, uint64_t block);
 extern int lgfs2_freedi(struct gfs2_sbd *sdp, uint64_t block);
 extern int lgfs2_get_leaf(struct lgfs2_inode *dip, uint64_t leaf_no,
-			 struct gfs2_buffer_head **bhp);
+			 struct lgfs2_buffer_head **bhp);
 extern int lgfs2_dirent_first(struct lgfs2_inode *dip,
-			     struct gfs2_buffer_head *bh,
+			     struct lgfs2_buffer_head *bh,
 			     struct gfs2_dirent **dent);
-extern int lgfs2_dirent_next(struct lgfs2_inode *dip, struct gfs2_buffer_head *bh,
+extern int lgfs2_dirent_next(struct lgfs2_inode *dip, struct lgfs2_buffer_head *bh,
 			    struct gfs2_dirent **dent);
 extern void lgfs2_build_height(struct lgfs2_inode *ip, int height);
 extern void lgfs2_unstuff_dinode(struct lgfs2_inode *ip);
@@ -709,7 +709,7 @@ struct gfs_log_descriptor {
 
 extern int lgfs2_is_gfs_dir(struct lgfs2_inode *ip);
 extern void lgfs2_gfs1_lookup_block(struct lgfs2_inode *ip,
-			      struct gfs2_buffer_head *bh,
+			      struct lgfs2_buffer_head *bh,
 			      unsigned int height, struct metapath *mp,
 			      int create, int *new, uint64_t *block);
 extern void lgfs2_gfs1_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
@@ -732,7 +732,7 @@ extern int lgfs2_open_mnt_dir(const char *path, int flags, struct mntent **mnt);
 /* recovery.c */
 extern void lgfs2_replay_incr_blk(struct lgfs2_inode *ip, unsigned int *blk);
 extern int lgfs2_replay_read_block(struct lgfs2_inode *ip, unsigned int blk,
-				  struct gfs2_buffer_head **bh);
+				  struct lgfs2_buffer_head **bh);
 extern int lgfs2_get_log_header(struct lgfs2_inode *ip, unsigned int blk,
                                 struct lgfs2_log_header *head);
 extern int lgfs2_find_jhead(struct lgfs2_inode *ip, struct lgfs2_log_header *head);
gfs2/libgfs2/recovery.c +3 -3
index b88d913d..56aa2478 100644
@@ -23,7 +23,7 @@ void lgfs2_replay_incr_blk(struct lgfs2_inode *ip, unsigned int *blk)
 }
 
 int lgfs2_replay_read_block(struct lgfs2_inode *ip, unsigned int blk,
-			   struct gfs2_buffer_head **bh)
+			   struct lgfs2_buffer_head **bh)
 {
 	int new = 0;
 	uint64_t dblock;
@@ -68,7 +68,7 @@ static void log_header_in(struct lgfs2_log_header *lh, char *buf)
 int lgfs2_get_log_header(struct lgfs2_inode *ip, unsigned int blk,
                          struct lgfs2_log_header *head)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	struct lgfs2_log_header lh;
 	struct gfs2_log_header *tmp;
 	__be32 saved_hash;
@@ -235,7 +235,7 @@ int lgfs2_clean_journal(struct lgfs2_inode *ip, struct lgfs2_log_header *head)
 	unsigned int lblock;
 	struct gfs2_log_header *lh;
 	uint32_t hash;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	int new = 0;
 	uint64_t dblock;
 
gfs2/libgfs2/structures.c +6 -6
index b48c9bcc..f738259a 100644
@@ -20,7 +20,7 @@ int lgfs2_build_master(struct gfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
 	uint64_t bn;
-	struct gfs2_buffer_head *bh = NULL;
+	struct lgfs2_buffer_head *bh = NULL;
 	int err = lgfs2_dinode_alloc(sdp, 1, &bn);
 
 	if (err != 0)
@@ -151,7 +151,7 @@ int lgfs2_write_journal_data(struct lgfs2_inode *ip)
 	return 0;
 }
 
-static struct gfs2_buffer_head *lgfs2_get_file_buf(struct lgfs2_inode *ip, uint64_t lbn, int prealloc)
+static struct lgfs2_buffer_head *lgfs2_get_file_buf(struct lgfs2_inode *ip, uint64_t lbn, int prealloc)
 {
 	struct gfs2_sbd *sdp = ip->i_sbd;
 	uint64_t dbn;
@@ -189,7 +189,7 @@ int lgfs2_write_journal(struct lgfs2_inode *jnl, unsigned bsize, unsigned int bl
 	lgfs2_build_height(jnl, height);
 
 	for (x = 0; x < blocks; x++) {
-		struct gfs2_buffer_head *bh = lgfs2_get_file_buf(jnl, x, 1);
+		struct lgfs2_buffer_head *bh = lgfs2_get_file_buf(jnl, x, 1);
 		if (!bh)
 			return -1;
 		lgfs2_bmodified(bh);
@@ -197,7 +197,7 @@ int lgfs2_write_journal(struct lgfs2_inode *jnl, unsigned bsize, unsigned int bl
 	}
 	crc32c_optimization_init();
 	for (x = 0; x < blocks; x++) {
-		struct gfs2_buffer_head *bh = lgfs2_get_file_buf(jnl, x, 0);
+		struct lgfs2_buffer_head *bh = lgfs2_get_file_buf(jnl, x, 0);
 		if (!bh)
 			return -1;
 
@@ -321,7 +321,7 @@ struct lgfs2_inode *lgfs2_build_quota_change(struct lgfs2_inode *per_node, unsig
 	unsigned int blocks = sdp->qcsize << (20 - sdp->sd_bsize_shift);
 	unsigned int x;
 	unsigned int hgt;
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 
 	memset(&mh, 0, sizeof(struct gfs2_meta_header));
 	mh.mh_magic = cpu_to_be32(GFS2_MAGIC);
@@ -432,7 +432,7 @@ int lgfs2_build_root(struct gfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
 	uint64_t bn;
-	struct gfs2_buffer_head *bh = NULL;
+	struct lgfs2_buffer_head *bh = NULL;
 	int err = lgfs2_dinode_alloc(sdp, 1, &bn);
 
 	if (err != 0)
gfs2/libgfs2/super.c +2 -2
index c8186b20..3535a0c7 100644
@@ -60,7 +60,7 @@ int lgfs2_check_sb(void *sbp)
  */
 int lgfs2_read_sb(struct gfs2_sbd *sdp)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	uint64_t space = 0;
 	unsigned int x;
 	int ret;
@@ -181,7 +181,7 @@ static int rgd_seems_ok(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
  */
 static int good_on_disk(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 {
-	struct gfs2_buffer_head *bh;
+	struct lgfs2_buffer_head *bh;
 	int is_rgrp;
 
 	bh = lgfs2_bread(sdp, rgd->rt_addr);
Signature · 1 line
2.34.1
#15 lore raw

PATCH 15/21 libgfs2: Namespace improvements - struct gfs2_sbd

In reply to Andrew Price

Rename to struct lgfs2_sbd.

---
 gfs2/convert/gfs2_convert.c    | 76 +++++++++++++++---------------
 gfs2/edit/gfs2hex.c            |  2 +-
 gfs2/edit/hexedit.c            |  2 +-
 gfs2/edit/hexedit.h            |  2 +-
 gfs2/edit/journal.c            |  2 +-
 gfs2/edit/savemeta.c           |  6 +--
 gfs2/fsck/afterpass1_common.c  |  4 +-
 gfs2/fsck/afterpass1_common.h  |  2 +-
 gfs2/fsck/fs_recovery.c        | 26 +++++------
 gfs2/fsck/fs_recovery.h        | 10 ++--
 gfs2/fsck/fsck.h               | 30 ++++++------
 gfs2/fsck/initialize.c         | 50 ++++++++++----------
 gfs2/fsck/lost_n_found.c       |  6 +--
 gfs2/fsck/main.c               |  8 ++--
 gfs2/fsck/metawalk.c           | 22 ++++-----
 gfs2/fsck/metawalk.h           |  6 +--
 gfs2/fsck/pass1.c              | 50 ++++++++++----------
 gfs2/fsck/pass1b.c             | 16 +++----
 gfs2/fsck/pass2.c              | 22 ++++-----
 gfs2/fsck/pass3.c              |  6 +--
 gfs2/fsck/pass4.c              | 12 ++---
 gfs2/fsck/pass5.c              |  6 +--
 gfs2/fsck/rgrepair.c           | 26 +++++------
 gfs2/fsck/util.c               |  2 +-
 gfs2/fsck/util.h               |  6 +--
 gfs2/glocktop/glocktop.c       |  6 +--
 gfs2/libgfs2/buf.c             |  8 ++--
 gfs2/libgfs2/check_ondisk.c    |  6 +--
 gfs2/libgfs2/check_rgrp.c      |  4 +-
 gfs2/libgfs2/device_geometry.c |  2 +-
 gfs2/libgfs2/fs_bits.c         |  4 +-
 gfs2/libgfs2/fs_ops.c          | 52 ++++++++++-----------
 gfs2/libgfs2/gfs1.c            | 10 ++--
 gfs2/libgfs2/gfs2l.c           |  4 +-
 gfs2/libgfs2/lang.c            | 22 ++++-----
 gfs2/libgfs2/lang.h            |  2 +-
 gfs2/libgfs2/libgfs2.h         | 84 +++++++++++++++++-----------------
 gfs2/libgfs2/misc.c            |  2 +-
 gfs2/libgfs2/ondisk.c          |  4 +-
 gfs2/libgfs2/rgrp.c            | 20 ++++----
 gfs2/libgfs2/rgrp.h            |  2 +-
 gfs2/libgfs2/structures.c      | 26 +++++------
 gfs2/libgfs2/super.c           |  8 ++--
 gfs2/mkfs/main_grow.c          | 16 +++----
 gfs2/mkfs/main_jadd.c          | 18 ++++----
 gfs2/mkfs/main_mkfs.c          | 22 ++++-----
 tests/nukerg.c                 | 10 ++--
 47 files changed, 366 insertions(+), 366 deletions(-)
gfs2/convert/gfs2_convert.c +38 -38
index 06815380..e1c6a3c6 100644
@@ -95,7 +95,7 @@ struct gfs2_options {
 };
 
 static struct gfs_sb gfs1_sb;
-static struct gfs2_sbd sb2;
+static struct lgfs2_sbd sb2;
 static struct inode_block dirs_to_fix;  /* linked list of directories to fix */
 static struct inode_dir_block cdpns_to_fix; /* linked list of cdpn symlinks */
 static int seconds;
@@ -119,7 +119,7 @@ int print_level = MSG_NOTICE;
 /*                   Fixes all unallocated metadata bitmap states (which are */
 /*                   valid in gfs1 but invalid in gfs2).                     */
 /* ------------------------------------------------------------------------- */
-static void convert_bitmaps(struct gfs2_sbd *sdp, struct rgrp_tree *rg)
+static void convert_bitmaps(struct lgfs2_sbd *sdp, struct rgrp_tree *rg)
 {
 	uint32_t blk;
 	int x, y;
@@ -146,7 +146,7 @@ static void convert_bitmaps(struct gfs2_sbd *sdp, struct rgrp_tree *rg)
 /* convert_rgs - Convert gfs1 resource groups to gfs2.                       */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int convert_rgs(struct gfs2_sbd *sbp)
+static int convert_rgs(struct lgfs2_sbd *sbp)
 {
 	struct rgrp_tree *rgd;
 	struct osi_node *n, *next = NULL;
@@ -218,7 +218,7 @@ static unsigned int calc_gfs2_tree_height(struct lgfs2_inode *ip, uint64_t size)
 /* ------------------------------------------------------------------------- */
 /* mp_gfs1_to_gfs2 - convert a gfs1 metapath to a gfs2 metapath.             */
 /* ------------------------------------------------------------------------- */
-static void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
+static void mp_gfs1_to_gfs2(struct lgfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 		     struct metapath *gfs1mp, struct metapath *gfs2mp)
 {
 	uint64_t lblock;
@@ -258,7 +258,7 @@ static void mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 /*                interested in rearranging the metadata while leaving the   */
 /*                actual data blocks intact.                                 */
 /* ------------------------------------------------------------------------- */
-static void fix_metatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
+static void fix_metatree(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip,
 		  struct blocklist *blk, __be64 *first_nonzero_ptr,
 		  unsigned int size)
 {
@@ -377,7 +377,7 @@ static void fix_metatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
 /* Adapted from fsck.gfs2 metawalk.c's build_and_check_metalist              */
 /* ------------------------------------------------------------------------- */
 
-static void jdata_mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
+static void jdata_mp_gfs1_to_gfs2(struct lgfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 			   struct metapath *gfs1mp, struct metapath *gfs2mp,
 			   unsigned int *len, uint64_t dinode_size)
 {
@@ -416,7 +416,7 @@ static void jdata_mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 	}
 }
 
-static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
+static uint64_t fix_jdatatree(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip,
 			      struct blocklist *blk, char *srcptr,
 			      unsigned int size)
 {
@@ -485,7 +485,7 @@ static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct lgfs2_inode *ip,
 	return block;
 }
 
-static int get_inode_metablocks(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, struct blocklist *blocks)
+static int get_inode_metablocks(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip, struct blocklist *blocks)
 {
 	struct blocklist *blk, *newblk;
 	struct lgfs2_buffer_head *bh, *dibh = ip->i_bh;
@@ -569,7 +569,7 @@ static int get_inode_metablocks(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, st
 	return 0;
 }
 
-static int fix_ind_reg_or_dir(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t di_height,
+static int fix_ind_reg_or_dir(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t di_height,
 		       uint32_t gfs2_hgt, struct blocklist *blk, struct blocklist *blocks)
 {
 	unsigned int len, bufsize;
@@ -611,8 +611,8 @@ static int fix_ind_reg_or_dir(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, uint
 	return 0;
 }
 
-static int fix_ind_jdata(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t di_height, 
-		  uint32_t gfs2_hgt, uint64_t dinode_size, struct blocklist *blk, 
+static int fix_ind_jdata(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t di_height,
+		  uint32_t gfs2_hgt, uint64_t dinode_size, struct blocklist *blk,
 		  struct blocklist *blocks)
 {
 	/*FIXME: Messages here should be different, to not conflit with messages in get_inode_metablocks */
@@ -681,7 +681,7 @@ static int fix_ind_jdata(struct gfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t
 	return 0;
 }
 
-static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct lgfs2_inode *ip)
+static int adjust_indirect_blocks(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip)
 {
 	uint64_t dinode_size;
 	uint32_t gfs2_hgt, di_height;
@@ -774,7 +774,7 @@ static int has_cdpn(const char *str)
 	return 0;
 }
 
-static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct lgfs2_buffer_head *bh, struct lgfs2_inode *ip)
+static int fix_cdpn_symlink(struct lgfs2_sbd *sbp, struct lgfs2_buffer_head *bh, struct lgfs2_inode *ip)
 {
 	char *linkptr = NULL;
 
@@ -809,7 +809,7 @@ static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct lgfs2_buffer_head *bh,
  * to fix the header. gfs1 uses gfs_indirect as the header which is 64 bytes
  * bigger than gfs2_meta_header that gfs2 uses.
  */
-static int fix_xattr(struct gfs2_sbd *sbp, struct lgfs2_buffer_head *bh, struct lgfs2_inode *ip)
+static int fix_xattr(struct lgfs2_sbd *sbp, struct lgfs2_buffer_head *bh, struct lgfs2_inode *ip)
 {
 	int len, old_hdr_sz, new_hdr_sz;
 	struct lgfs2_buffer_head *eabh;
@@ -843,7 +843,7 @@ static int fix_xattr(struct gfs2_sbd *sbp, struct lgfs2_buffer_head *bh, struct
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int adjust_inode(struct gfs2_sbd *sbp, struct lgfs2_buffer_head *bh)
+static int adjust_inode(struct lgfs2_sbd *sbp, struct lgfs2_buffer_head *bh)
 {
 	struct lgfs2_inode *inode;
 	struct inode_block *fixdir;
@@ -981,7 +981,7 @@ static int next_rg_meta(struct rgrp_tree *rgd, uint64_t *block, int first)
 	return 0;
 }
 
-static int next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
+static int next_rg_metatype(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
                             uint64_t *block, uint32_t type, int first)
 {
 	struct lgfs2_buffer_head *bh = NULL;
@@ -1006,7 +1006,7 @@ static int next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_list_t *cdpn_to_fix)
+static int inode_renumber(struct lgfs2_sbd *sbp, uint64_t root_inode_addr, osi_list_t *cdpn_to_fix)
 {
 	struct rgrp_tree *rgd;
 	struct osi_node *n, *next = NULL;
@@ -1099,7 +1099,7 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 /**
  * fetch_inum - fetch an inum entry from disk, given its block
  */
-static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
+static int fetch_inum(struct lgfs2_sbd *sbp, uint64_t iblock,
 		      struct lgfs2_inum *inum, uint64_t *eablk)
 {
 	struct lgfs2_inode *fix_inode;
@@ -1124,7 +1124,7 @@ static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure, -EISDIR when dentmod marked DT_DIR  */
 /* ------------------------------------------------------------------------- */
-static int process_dirent_info(struct lgfs2_inode *dip, struct gfs2_sbd *sbp,
+static int process_dirent_info(struct lgfs2_inode *dip, struct lgfs2_sbd *sbp,
 			       struct lgfs2_buffer_head *bh, int dir_entries, uint64_t dentmod)
 {
 	int error = 0;
@@ -1244,7 +1244,7 @@ static int process_dirent_info(struct lgfs2_inode *dip, struct gfs2_sbd *sbp,
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct lgfs2_inode *dip, uint64_t dentmod)
+static int fix_one_directory_exhash(struct lgfs2_sbd *sbp, struct lgfs2_inode *dip, uint64_t dentmod)
 {
 	struct lgfs2_buffer_head *bh_leaf;
 	int error;
@@ -1296,7 +1296,7 @@ static int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct lgfs2_inode *di
 	return 0;
 }/* fix_one_directory_exhash */
 
-static int process_directory(struct gfs2_sbd *sbp, uint64_t dirblock, uint64_t dentmod)
+static int process_directory(struct lgfs2_sbd *sbp, uint64_t dirblock, uint64_t dentmod)
 {
 	struct lgfs2_inode *dip;
 	int error = 0;
@@ -1327,7 +1327,7 @@ static int process_directory(struct gfs2_sbd *sbp, uint64_t dirblock, uint64_t d
 /* fix_directory_info - sync new inode numbers with directory info           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dir_to_fix)
+static int fix_directory_info(struct lgfs2_sbd *sbp, osi_list_t *dir_to_fix)
 {
 	osi_list_t *tmp, *fix;
 	struct inode_block *dir_iblk;
@@ -1373,7 +1373,7 @@ static int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dir_to_fix)
 /* fix_cdpn_symlinks - convert cdpn symlinks to empty directories            */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
+static int fix_cdpn_symlinks(struct lgfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
 {
 	osi_list_t *tmp, *x;
 	int error = 0;
@@ -1432,7 +1432,7 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)
 /* read_gfs1_jiindex - read the gfs1 jindex file.                            */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int read_gfs1_jiindex(struct gfs2_sbd *sdp)
+static int read_gfs1_jiindex(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip = sdp->md.jiinode;
 	char buf[sizeof(struct gfs_jindex)];
@@ -1491,7 +1491,7 @@ static int read_gfs1_jiindex(struct gfs2_sbd *sdp)
 	return -1;
 }
 
-static int sanity_check(struct gfs2_sbd *sdp)
+static int sanity_check(struct lgfs2_sbd *sdp)
 {
 	int error = 0;
 	if (!gfs1_sb.sb_quota_di.no_addr) {
@@ -1517,7 +1517,7 @@ static int sanity_check(struct gfs2_sbd *sdp)
  *
  * Returns: 0 on success, -1 on failure.
  */
-static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
+static int gfs1_ri_update(struct lgfs2_sbd *sdp, int *rgcount, int quiet)
 {
 	struct rgrp_tree *rgd;
 	uint64_t count1 = 0, count2 = 0;
@@ -1560,13 +1560,13 @@ static int gfs1_ri_update(struct gfs2_sbd *sdp, int *rgcount, int quiet)
 /* init - initialization code                                                */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int init(struct gfs2_sbd *sbp, struct gfs2_options *opts)
+static int init(struct lgfs2_sbd *sbp, struct gfs2_options *opts)
 {
 	struct lgfs2_buffer_head *bh;
 	int rgcount;
 	struct lgfs2_inum inum;
 
-	memset(sbp, 0, sizeof(struct gfs2_sbd));
+	memset(sbp, 0, sizeof(struct lgfs2_sbd));
 	if ((sbp->device_fd = open(opts->device, O_RDWR)) < 0) {
 		perror(opts->device);
 		exit(-1);
@@ -1775,7 +1775,7 @@ static void process_parameters(int argc, char **argv, struct gfs2_options *opts)
 /* rgrp_length - Calculate the length of a resource group                    */
 /* @size: The total size of the resource group                               */
 /* ------------------------------------------------------------------------- */
-static uint64_t rgrp_length(uint64_t size, struct gfs2_sbd *sdp)
+static uint64_t rgrp_length(uint64_t size, struct lgfs2_sbd *sdp)
 {
 	uint64_t bitbytes = RGRP_BITMAP_BLKS(sdp->sd_bsize) + 1;
 	uint64_t stuff = RGRP_STUFFED_BLKS(sdp->sd_bsize) + 1;
@@ -1804,7 +1804,7 @@ static uint64_t rgrp_length(uint64_t size, struct gfs2_sbd *sdp)
 /*                                                                           */
 /* Returns: 0 on success, -1 on failure                                      */
 /* ------------------------------------------------------------------------- */
-static int journ_space_to_rg(struct gfs2_sbd *sdp)
+static int journ_space_to_rg(struct lgfs2_sbd *sdp)
 {
 	int error = 0;
 	int j;
@@ -1894,7 +1894,7 @@ static int journ_space_to_rg(struct gfs2_sbd *sdp)
 /* ------------------------------------------------------------------------- */
 /* update_inode_file - update the inode file with the new next_inum          */
 /* ------------------------------------------------------------------------- */
-static void update_inode_file(struct gfs2_sbd *sdp)
+static void update_inode_file(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip = sdp->md.inum;
 	__be64 buf;
@@ -1913,7 +1913,7 @@ static void update_inode_file(struct gfs2_sbd *sdp)
 /**
  * write_statfs_file - write the statfs file
  */
-static void write_statfs_file(struct gfs2_sbd *sdp)
+static void write_statfs_file(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip = sdp->md.statfs;
 	struct gfs2_statfs_change sc;
@@ -1933,7 +1933,7 @@ static void write_statfs_file(struct gfs2_sbd *sdp)
 /* ------------------------------------------------------------------------- */
 /* remove_obsolete_gfs1 - remove obsolete gfs1 inodes.                       */
 /* ------------------------------------------------------------------------- */
-static void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
+static void remove_obsolete_gfs1(struct lgfs2_sbd *sbp)
 {
 	struct lgfs2_inum inum;
 
@@ -1959,7 +1959,7 @@ static void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
 /* ------------------------------------------------------------------------- */
 /* lifted from libgfs2/structures.c                                          */
 /* ------------------------------------------------------------------------- */
-static int conv_build_jindex(struct gfs2_sbd *sdp)
+static int conv_build_jindex(struct lgfs2_sbd *sdp)
 {
 	unsigned int j;
 
@@ -1994,7 +1994,7 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
 	return 0;
 }
 
-static unsigned int total_file_blocks(struct gfs2_sbd *sdp, 
+static unsigned int total_file_blocks(struct lgfs2_sbd *sdp, 
 				      uint64_t filesize, int journaled)
 {
 	unsigned int data_blks = 0, meta_blks = 0;
@@ -2032,7 +2032,7 @@ out:
 /* We check if the GFS2 filesystem files/structures created after the call to 
  * check_fit() in main() will fit in the currently available free blocks
  */
-static int check_fit(struct gfs2_sbd *sdp)
+static int check_fit(struct lgfs2_sbd *sdp)
 {
 	unsigned int blks_need = 0, blks_avail = sdp->blks_total - sdp->blks_alloced;
 
@@ -2086,7 +2086,7 @@ static int check_fit(struct gfs2_sbd *sdp)
 	return blks_avail > blks_need;
 }
 
-static int build_per_node(struct gfs2_sbd *sdp)
+static int build_per_node(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *per_node;
 	unsigned int j;
@@ -2133,7 +2133,7 @@ static int build_per_node(struct gfs2_sbd *sdp)
  * inode height/size of the new quota file to that of the old one and set the 
  * old quota inode height/size to zero, so only the inode block gets freed.
  */
-static void copy_quotas(struct gfs2_sbd *sdp)
+static void copy_quotas(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
 	struct lgfs2_inode *oq_ip, *nq_ip;
gfs2/edit/gfs2hex.c +1 -1
index d167bdb4..73b45f2e 100644
@@ -31,7 +31,7 @@ uint64_t block = 0;
 int blockhist = 0;
 struct iinfo *indirect;
 int indirect_blocks;
-struct gfs2_sbd sbd;
+struct lgfs2_sbd sbd;
 uint64_t starting_blk;
 struct blkstack_info blockstack[BLOCK_STACK_SIZE];
 int identify = FALSE;
gfs2/edit/hexedit.c +1 -1
index 3b8f1b48..4eb1a839 100644
@@ -873,7 +873,7 @@ static void read_superblock(int fd)
 	struct gfs2_meta_header *mh;
 
 	ioctl(fd, BLKFLSBUF, 0);
-	memset(&sbd, 0, sizeof(struct gfs2_sbd));
+	memset(&sbd, 0, sizeof(struct lgfs2_sbd));
 	sbd.sd_bsize = GFS2_DEFAULT_BSIZE;
 	sbd.device_fd = fd;
 	bh = lgfs2_bread(&sbd, 0x10);
gfs2/edit/hexedit.h +1 -1
index 543cc3ab..d45fae2b 100644
@@ -43,7 +43,7 @@ extern int edit_row[DMODES], edit_col[DMODES], print_entry_ndx;
 extern int start_row[DMODES], end_row[DMODES], lines_per_row[DMODES];
 extern int edit_size[DMODES], last_entry_onscreen[DMODES];
 extern char edit_fmt[80];
-extern struct gfs2_sbd sbd;
+extern struct lgfs2_sbd sbd;
 extern struct gfs2_dinode *di;
 extern int screen_chunk_size; /* how much of the 4K can fit on screen */
 extern int gfs2_struct_type;
gfs2/edit/journal.c +1 -1
index 492f539c..c977ef7f 100644
@@ -105,7 +105,7 @@ static void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
 static int fsck_readi(struct lgfs2_inode *ip, void *rbuf, uint64_t roffset,
 	       unsigned int size, uint64_t *abs_block)
 {
-	struct gfs2_sbd *sdp;
+	struct lgfs2_sbd *sdp;
 	struct lgfs2_buffer_head *lbh;
 	uint64_t lblock, dblock;
 	unsigned int o;
gfs2/edit/savemeta.c +3 -3
index aa4c1296..4ab4f4a1 100644
@@ -796,7 +796,7 @@ new_range:
 	free(br);
 }
 
-static int save_leaf_chain(struct metafd *mfd, struct gfs2_sbd *sdp, char *buf)
+static int save_leaf_chain(struct metafd *mfd, struct lgfs2_sbd *sdp, char *buf)
 {
 	struct gfs2_leaf *leaf = (struct gfs2_leaf *)buf;
 
@@ -1035,7 +1035,7 @@ static void save_allocated(struct rgrp_tree *rgd, struct metafd *mfd)
 	free(ibuf);
 }
 
-static char *rgrp_read(struct gfs2_sbd *sdp, uint64_t addr, unsigned blocks)
+static char *rgrp_read(struct lgfs2_sbd *sdp, uint64_t addr, unsigned blocks)
 {
 	size_t len = blocks * sdp->sd_bsize;
 	off_t off = addr * sdp->sd_bsize;
@@ -1055,7 +1055,7 @@ static char *rgrp_read(struct gfs2_sbd *sdp, uint64_t addr, unsigned blocks)
 	return buf;
 }
 
-static void save_rgrp(struct gfs2_sbd *sdp, struct metafd *mfd, struct rgrp_tree *rgd, int withcontents)
+static void save_rgrp(struct lgfs2_sbd *sdp, struct metafd *mfd, struct rgrp_tree *rgd, int withcontents)
 {
 	uint64_t addr = rgd->rt_addr;
 	char *buf;
gfs2/fsck/afterpass1_common.c +2 -2
index 9b0788b9..b41f216e 100644
@@ -131,7 +131,7 @@ static int remove_dentry(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 
 }
 
-int remove_dentry_from_dir(struct gfs2_sbd *sdp, uint64_t dir,
+int remove_dentry_from_dir(struct lgfs2_sbd *sdp, uint64_t dir,
 			   uint64_t dentryblock)
 {
 	struct metawalk_fxns remove_dentry_fxns = {0};
@@ -241,7 +241,7 @@ int delete_eattr_entry(struct lgfs2_inode *ip, struct lgfs2_buffer_head *leaf_bh
 		       struct gfs2_ea_header *ea_hdr,
 		       struct gfs2_ea_header *ea_hdr_prev, void *private)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	char ea_name[256];
 	uint32_t avail_size;
 	int max_ptrs;
gfs2/fsck/afterpass1_common.h +1 -1
index b0057be4..055816b4 100644
@@ -26,6 +26,6 @@ extern int delete_eattr_extentry(struct lgfs2_inode *ip, int i,
 				 struct gfs2_ea_header *ea_hdr,
 				 struct gfs2_ea_header *ea_hdr_prev,
 				 void *private);
-extern int remove_dentry_from_dir(struct gfs2_sbd *sdp, uint64_t dir,
+extern int remove_dentry_from_dir(struct lgfs2_sbd *sdp, uint64_t dir,
 						   uint64_t dentryblock);
 #endif
gfs2/fsck/fs_recovery.c +13 -13
index 11dc4792..45bd213a 100644
@@ -33,7 +33,7 @@ struct gfs2_revoke_replay {
 	unsigned int rr_where;
 };
 
-static int revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
+static int revoke_add(struct lgfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 {
 	osi_list_t *tmp, *head = &sd_revoke_list;
 	struct gfs2_revoke_replay *rr;
@@ -62,7 +62,7 @@ static int revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 	return 1;
 }
 
-static int revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
+static int revoke_check(struct lgfs2_sbd *sdp, uint64_t blkno, unsigned int where)
 {
 	osi_list_t *tmp;
 	struct gfs2_revoke_replay *rr;
@@ -86,7 +86,7 @@ static int revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where
 	return (wrap) ? (a || b) : (a && b);
 }
 
-static void revoke_clean(struct gfs2_sbd *sdp)
+static void revoke_clean(struct lgfs2_sbd *sdp)
 {
 	osi_list_t *head = &sd_revoke_list;
 	struct gfs2_revoke_replay *rr;
@@ -98,7 +98,7 @@ static void revoke_clean(struct gfs2_sbd *sdp)
 	}
 }
 
-static void refresh_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
+static void refresh_rgrp(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
 			 struct lgfs2_buffer_head *bh, uint64_t blkno)
 {
 	int i;
@@ -125,7 +125,7 @@ static int buf_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 				struct gfs2_log_descriptor *ld, __be64 *ptr,
 				int pass)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	unsigned int blks = be32_to_cpu(ld->ld_data1);
 	struct lgfs2_buffer_head *bh_log, *bh_ip;
 	uint64_t blkno;
@@ -186,7 +186,7 @@ static int revoke_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 				   struct gfs2_log_descriptor *ld, __be64 *ptr,
 				   int pass)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	unsigned int blks = be32_to_cpu(ld->ld_length);
 	unsigned int revokes = be32_to_cpu(ld->ld_data1);
 	struct lgfs2_buffer_head *bh;
@@ -236,7 +236,7 @@ static int databuf_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 				    struct gfs2_log_descriptor *ld,
 				    __be64 *ptr, int pass)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	unsigned int blks = be32_to_cpu(ld->ld_data1);
 	struct lgfs2_buffer_head *bh_log, *bh_ip;
 	uint64_t blkno;
@@ -450,7 +450,7 @@ static int check_journal_seq_no(struct lgfs2_inode *ip, int fix)
  * mounted by other nodes in the cluster, which is dangerous and therefore,
  * we should warn the user to run fsck.gfs2 manually when it's safe.
  */
-int preen_is_safe(struct gfs2_sbd *sdp, int preen, int force_check)
+int preen_is_safe(struct lgfs2_sbd *sdp, int preen, int force_check)
 {
 	if (!preen)       /* If preen was not specified */
 		return 1; /* not called by rc.sysinit--we're okay to preen */
@@ -479,7 +479,7 @@ int preen_is_safe(struct gfs2_sbd *sdp, int preen, int force_check)
 static int gfs2_recover_journal(struct lgfs2_inode *ip, int j, int preen,
 				int force_check, int *was_clean)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct lgfs2_log_header head;
 	unsigned int pass;
 	int error;
@@ -675,7 +675,7 @@ static struct metawalk_fxns rangecheck_journal = {
  *
  * Returns: 0 on success, -1 on failure
  */
-int replay_journals(struct gfs2_sbd *sdp, int preen, int force_check,
+int replay_journals(struct lgfs2_sbd *sdp, int preen, int force_check,
 		    int *clean_journals)
 {
 	int i;
@@ -735,7 +735,7 @@ int replay_journals(struct gfs2_sbd *sdp, int preen, int force_check,
  *
  * Returns: 0 on success, -1 on failure
  */
-int ji_update(struct gfs2_sbd *sdp)
+int ji_update(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *jip, *ip = sdp->md.jiinode;
 	char journal_name[JOURNAL_NAME_SIZE];
@@ -848,7 +848,7 @@ static struct metawalk_fxns jindex_check_fxns = {
 	.check_dentry = check_jindex_dent,
 };
 
-int build_jindex(struct gfs2_sbd *sdp)
+int build_jindex(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *jindex;
 
@@ -872,7 +872,7 @@ int build_jindex(struct gfs2_sbd *sdp)
 /**
  * init_jindex - read in the rindex file
  */
-int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild)
+int init_jindex(struct lgfs2_sbd *sdp, int allow_ji_rebuild)
 {
 	/*******************************************************************
 	 ******************  Fill in journal information  ******************
gfs2/fsck/fs_recovery.h +5 -5
index 884d3c43..0d5a785d 100644
@@ -3,12 +3,12 @@
 
 #include "libgfs2.h"
 
-extern int replay_journals(struct gfs2_sbd *sdp, int preen, int force_check,
+extern int replay_journals(struct lgfs2_sbd *sdp, int preen, int force_check,
 			   int *clean_journals);
-extern int preen_is_safe(struct gfs2_sbd *sdp, int preen, int force_check);
+extern int preen_is_safe(struct lgfs2_sbd *sdp, int preen, int force_check);
 
-extern int ji_update(struct gfs2_sbd *sdp);
-extern int build_jindex(struct gfs2_sbd *sdp);
-extern int init_jindex(struct gfs2_sbd *sdp, int allow_ji_rebuild);
+extern int ji_update(struct lgfs2_sbd *sdp);
+extern int build_jindex(struct lgfs2_sbd *sdp);
+extern int init_jindex(struct lgfs2_sbd *sdp, int allow_ji_rebuild);
 #endif /* __FS_RECOVERY_H__ */
 
gfs2/fsck/fsck.h +15 -15
index 1645b853..baf7c926 100644
@@ -108,23 +108,23 @@ enum rgindex_trust_level { /* how far can we trust our RG index? */
 			   must have been converted from gfs2_convert. */
 };
 
-extern struct lgfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block);
-extern struct lgfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
+extern struct lgfs2_inode *fsck_load_inode(struct lgfs2_sbd *sdp, uint64_t block);
+extern struct lgfs2_inode *fsck_inode_get(struct lgfs2_sbd *sdp,
 					 struct rgrp_tree *rgd,
 					 struct lgfs2_buffer_head *bh);
 extern void fsck_inode_put(struct lgfs2_inode **ip);
 
-extern int initialize(struct gfs2_sbd *sdp, int force_check, int preen,
+extern int initialize(struct lgfs2_sbd *sdp, int force_check, int preen,
 		      int *all_clean);
-extern void destroy(struct gfs2_sbd *sdp);
-extern int pass1(struct gfs2_sbd *sdp);
-extern int pass1b(struct gfs2_sbd *sdp);
-extern int pass1c(struct gfs2_sbd *sdp);
-extern int pass2(struct gfs2_sbd *sdp);
-extern int pass3(struct gfs2_sbd *sdp);
-extern int pass4(struct gfs2_sbd *sdp);
-extern int pass5(struct gfs2_sbd *sdp, struct gfs2_bmap *bl);
-extern int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok);
+extern void destroy(struct lgfs2_sbd *sdp);
+extern int pass1(struct lgfs2_sbd *sdp);
+extern int pass1b(struct lgfs2_sbd *sdp);
+extern int pass1c(struct lgfs2_sbd *sdp);
+extern int pass2(struct lgfs2_sbd *sdp);
+extern int pass3(struct lgfs2_sbd *sdp);
+extern int pass4(struct lgfs2_sbd *sdp);
+extern int pass5(struct lgfs2_sbd *sdp, struct gfs2_bmap *bl);
+extern int rindex_repair(struct lgfs2_sbd *sdp, int trust_lvl, int *ok);
 extern int fsck_query(const char *format, ...)
 	__attribute__((format(printf,1,2)));
 extern struct dir_info *dirtree_find(uint64_t block);
@@ -158,7 +158,7 @@ extern int dups_found; /* How many duplicate references have we found? */
 extern int dups_found_first; /* How many duplicates have we found the original
 				reference for? */
 
-static inline int valid_block(struct gfs2_sbd *sdp, uint64_t blkno)
+static inline int valid_block(struct lgfs2_sbd *sdp, uint64_t blkno)
 {
 	return !((blkno > sdp->fssize) || (blkno <= LGFS2_SB_ADDR(sdp)) ||
 	         (lgfs2_get_bitmap(sdp, blkno, NULL) < 0));
@@ -175,7 +175,7 @@ static inline int rgrp_contains_block(struct rgrp_tree *rgd, uint64_t blk)
 
 static inline int valid_block_ip(struct lgfs2_inode *ip, uint64_t blk)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct rgrp_tree *rgd = ip->i_rgd;
 
 	if (blk > sdp->fssize)
@@ -200,6 +200,6 @@ extern struct special_blocks *blockfind(struct special_blocks *blist, uint64_t n
 extern void gfs2_special_set(struct special_blocks *blocklist, uint64_t block);
 extern void gfs2_special_free(struct special_blocks *blist);
 extern int sb_fixed;
-extern int build_per_node(struct gfs2_sbd *sdp);
+extern int build_per_node(struct lgfs2_sbd *sdp);
 
 #endif /* _FSCK_H */
gfs2/fsck/initialize.c +25 -25

200 lines not on this page · raw message

gfs2/fsck/lost_n_found.c +3 -3
index 9e5fae6f..d2064268 100644
@@ -20,7 +20,7 @@
 
 static void add_dotdot(struct lgfs2_inode *ip)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct dir_info *di;
 	struct lgfs2_inum no;
 	int err;
@@ -93,7 +93,7 @@ static void add_dotdot(struct lgfs2_inode *ip)
 void make_sure_lf_exists(struct lgfs2_inode *ip)
 {
 	struct dir_info *di;
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	uint32_t mode;
 	int root_entries;
 
@@ -173,7 +173,7 @@ void make_sure_lf_exists(struct lgfs2_inode *ip)
 int add_inode_to_lf(struct lgfs2_inode *ip){
 	char tmp_name[256];
 	unsigned inode_type;
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct lgfs2_inum no;
 	int err = 0;
 	uint32_t mode;
gfs2/fsck/main.c +4 -4
index 2c78f2d7..e86ef792 100644
@@ -152,7 +152,7 @@ static void interrupt(int sig)
 	}
 }
 
-static int check_statfs(struct gfs2_sbd *sdp)
+static int check_statfs(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *n, *next = NULL;
 	struct rgrp_tree *rgd;
@@ -233,7 +233,7 @@ static const struct fsck_pass passes[] = {
 	{ .name = NULL, }
 };
 
-static int fsck_pass(const struct fsck_pass *p, struct gfs2_sbd *sdp)
+static int fsck_pass(const struct fsck_pass *p, struct lgfs2_sbd *sdp)
 {
 	int ret;
 	struct timeval timer;
@@ -291,8 +291,8 @@ static void startlog(int argc, char **argv)
 #ifndef UNITTESTS
 int main(int argc, char **argv)
 {
-	struct gfs2_sbd sb;
-	struct gfs2_sbd *sdp = &sb;
+	struct lgfs2_sbd sb;
+	struct lgfs2_sbd *sdp = &sb;
 	int j;
 	int i;
 	int error = 0;
gfs2/fsck/metawalk.c +11 -11
index 575bb01b..035f0765 100644
@@ -29,7 +29,7 @@
    is used to set the latter.  The two must be kept in sync, otherwise
    you'll get bitmap mismatches.  This function checks the status of the
    bitmap whenever the blockmap changes, and fixes it accordingly. */
-int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
+int check_n_fix_bitmap(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
 		       uint64_t blk, int error_on_dinode, int new_state)
 {
 	int old_state;
@@ -224,7 +224,7 @@ struct duptree *dupfind(uint64_t block)
 	return NULL;
 }
 
-struct lgfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp, uint64_t block)
+struct lgfs2_inode *fsck_system_inode(struct lgfs2_sbd *sdp, uint64_t block)
 {
 	int j;
 
@@ -252,7 +252,7 @@ struct lgfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp, uint64_t block)
 
 /* fsck_load_inode - same as gfs2_load_inode() in libgfs2 but system inodes
    get special treatment. */
-struct lgfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block)
+struct lgfs2_inode *fsck_load_inode(struct lgfs2_sbd *sdp, uint64_t block)
 {
 	struct lgfs2_inode *ip = NULL;
 
@@ -266,7 +266,7 @@ struct lgfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block)
 
 /* fsck_inode_get - same as inode_get() in libgfs2 but system inodes
    get special treatment. */
-struct lgfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
+struct lgfs2_inode *fsck_inode_get(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
 				  struct lgfs2_buffer_head *bh)
 {
 	struct lgfs2_inode *sysip;
@@ -518,7 +518,7 @@ int check_leaf(struct lgfs2_inode *ip, int lindex, struct metawalk_fxns *pass,
 	struct lgfs2_buffer_head *lbh = NULL;
 	struct gfs2_leaf *lfp;
 	uint32_t count = 0;
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	const char *msg;
 	int di_depth = ip->i_depth;
 
@@ -663,7 +663,7 @@ static void dir_leaf_reada(struct lgfs2_inode *ip, __be64 *tbl, unsigned hsize)
 {
 	uint64_t *t = alloca(hsize * sizeof(uint64_t));
 	uint64_t leaf_no;
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	unsigned n = 0;
 	unsigned i;
 
@@ -686,7 +686,7 @@ int check_leaf_blks(struct lgfs2_inode *ip, struct metawalk_fxns *pass)
 	uint64_t first_ok_leaf, orig_di_blocks;
 	struct lgfs2_buffer_head *lbh;
 	int lindex;
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	int ref_count, orig_ref_count, orig_di_depth, orig_di_height;
 	__be64 *tbl;
 	int chained_leaf, tbl_valid;
@@ -866,7 +866,7 @@ static int check_eattr_entries(struct lgfs2_inode *ip,
 		if (error == 0 && pass->check_eattr_extentry &&
 		   ea_hdr->ea_num_ptrs) {
 			uint32_t tot_ealen = 0;
-			struct gfs2_sbd *sdp = ip->i_sbd;
+			struct lgfs2_sbd *sdp = ip->i_sbd;
 
 			ea_data_ptr = ((__be64 *)((char *)ea_hdr +
 						    sizeof(struct gfs2_ea_header) +
@@ -959,7 +959,7 @@ static int check_indirect_eattr(struct lgfs2_inode *ip, uint64_t indirect,
 	int error = 0, err;
 	__be64 *ea_leaf_ptr, *end;
 	uint64_t block;
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	int first_ea_is_bad = 0;
 	uint64_t di_eattr_save = ip->i_eattr;
 	uint64_t offset = ip->i_sbd->gfs1 ? sizeof(struct gfs_indirect) : sizeof(struct gfs2_meta_header);
@@ -1098,7 +1098,7 @@ static void free_metalist(struct lgfs2_inode *ip, osi_list_t *mlp)
 static void file_ra(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
 		    int head_size, int maxptrs, int h)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	uint64_t sblock = 0, block;
 	int extlen = 0;
 	__be64 *p;
@@ -1639,7 +1639,7 @@ int check_linear_dir(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
 	return error;
 }
 
-int check_dir(struct gfs2_sbd *sdp, struct lgfs2_inode *ip, struct metawalk_fxns *pass)
+int check_dir(struct lgfs2_sbd *sdp, struct lgfs2_inode *ip, struct metawalk_fxns *pass)
 {
 	int error = 0;
 
gfs2/fsck/metawalk.h +3 -3
index 76190685..f82f24bb 100644
@@ -12,7 +12,7 @@ extern int check_inode_eattr(struct lgfs2_inode *ip,
 			     struct metawalk_fxns *pass);
 extern int check_metatree(struct lgfs2_inode *ip, struct metawalk_fxns *pass);
 extern int check_leaf_blks(struct lgfs2_inode *ip, struct metawalk_fxns *pass);
-extern int check_dir(struct gfs2_sbd *sdp, struct lgfs2_inode *ip,
+extern int check_dir(struct lgfs2_sbd *sdp, struct lgfs2_inode *ip,
 		     struct metawalk_fxns *pass);
 extern int check_linear_dir(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
 			    struct metawalk_fxns *pass);
@@ -22,11 +22,11 @@ extern int check_leaf(struct lgfs2_inode *ip, int lindex,
 extern int _fsck_bitmap_set(struct lgfs2_inode *ip, uint64_t bblock,
 			    const char *btype, int mark, int error_on_dinode,
 			    const char *caller, int line);
-extern int check_n_fix_bitmap(struct gfs2_sbd *sdp, struct rgrp_tree *rgd,
+extern int check_n_fix_bitmap(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
 			      uint64_t blk, int error_on_dinode,
 			      int new_state);
 extern struct duptree *dupfind(uint64_t block);
-extern struct lgfs2_inode *fsck_system_inode(struct gfs2_sbd *sdp,
+extern struct lgfs2_inode *fsck_system_inode(struct lgfs2_sbd *sdp,
 					    uint64_t block);
 
 #define is_duplicate(dblock) ((dupfind(dblock)) ? 1 : 0)
gfs2/fsck/pass1.c +25 -25

196 lines not on this page · raw message

gfs2/fsck/pass1b.c +8 -8
index 11c722d2..d1e1050a 100644
@@ -89,7 +89,7 @@ static int findref_data(struct lgfs2_inode *ip, uint64_t metablock,
 	return META_IS_GOOD;
 }
 
-static void clone_data_block(struct gfs2_sbd *sdp, struct duptree *dt,
+static void clone_data_block(struct lgfs2_sbd *sdp, struct duptree *dt,
 			     struct inode_with_dups *id)
 {
 	struct meta_blk_ref metaref = { .block = dt->block, };
@@ -175,7 +175,7 @@ static void revise_dup_handler(uint64_t dup_blk, struct dup_handler *dh)
  * acceptable_ref - Delete dinodes that reference the given block as anything
  *                  _but_ this type.  Try to save references as this type.
  */
-static void resolve_dup_references(struct gfs2_sbd *sdp, struct duptree *dt,
+static void resolve_dup_references(struct lgfs2_sbd *sdp, struct duptree *dt,
 				   osi_list_t *ref_list,
 				   struct dup_handler *dh,
 				   int inval, int acceptable_ref)
@@ -512,7 +512,7 @@ static int set_ip_bitmap(struct lgfs2_inode *ip)
 	return 0;
 }
 
-static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
+static void resolve_last_reference(struct lgfs2_sbd *sdp, struct duptree *dt,
 				   enum dup_ref_type acceptable_ref)
 {
 	struct lgfs2_inode *ip;
@@ -601,7 +601,7 @@ static void resolve_last_reference(struct gfs2_sbd *sdp, struct duptree *dt,
  * This function should resolve and delete the duplicate block reference given,
  * iow dt.
  */
-static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *dt)
+static int handle_dup_blk(struct lgfs2_sbd *sdp, struct duptree *dt)
 {
 	osi_list_t *tmp;
 	struct dup_handler dh = {0};
@@ -758,7 +758,7 @@ static int check_eattr_indir_refs(struct lgfs2_inode *ip, uint64_t block,
 				  uint64_t parent,
 				  struct lgfs2_buffer_head **bh, void *private)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	int error;
 
 	error = add_duplicate_ref(ip, block, REF_AS_EA, 1, INODE_VALID);
@@ -772,7 +772,7 @@ static int check_eattr_leaf_refs(struct lgfs2_inode *ip, uint64_t block,
 				 uint64_t parent, struct lgfs2_buffer_head **bh,
 				 void *private)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	int error;
 
 	error = add_duplicate_ref(ip, block, REF_AS_EA, 1, INODE_VALID);
@@ -811,7 +811,7 @@ static int check_eattr_extentry_refs(struct lgfs2_inode *ip, int i,
 
 /* Finds all references to duplicate blocks in the metadata */
 /* Finds all references to duplicate blocks in the metadata */
-static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode)
+static int find_block_ref(struct lgfs2_sbd *sdp, uint64_t inode)
 {
 	struct lgfs2_inode *ip;
 	int error = 0;
@@ -857,7 +857,7 @@ out:
 /* Pass 1b handles finding the previous inode for a duplicate block
  * When found, store the inodes pointing to the duplicate block for
  * use in pass2 */
-int pass1b(struct gfs2_sbd *sdp)
+int pass1b(struct lgfs2_sbd *sdp)
 {
 	struct duptree *dt;
 	uint64_t i;
gfs2/fsck/pass2.c +11 -11
index 6c13cce9..25da1091 100644
@@ -33,7 +33,7 @@ static struct metawalk_fxns delete_eattrs = {
 
 /* Set children's parent inode in dir_info structure - ext2 does not set
  * dotdot inode here, but instead in pass3 - should we? */
-static int set_parent_dir(struct gfs2_sbd *sdp, struct lgfs2_inum child, struct lgfs2_inum parent)
+static int set_parent_dir(struct lgfs2_sbd *sdp, struct lgfs2_inum child, struct lgfs2_inum parent)
 {
 	struct dir_info *di;
 
@@ -63,7 +63,7 @@ static int set_parent_dir(struct gfs2_sbd *sdp, struct lgfs2_inum child, struct
 }
 
 /* Set's the child's '..' directory inode number in dir_info structure */
-static int set_dotdot_dir(struct gfs2_sbd *sdp, uint64_t childblock, struct lgfs2_inum parent)
+static int set_dotdot_dir(struct lgfs2_sbd *sdp, uint64_t childblock, struct lgfs2_inum parent)
 {
 	struct dir_info *di;
 
@@ -169,7 +169,7 @@ static int bad_formal_ino(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 	struct dir_info *di = NULL;
 	struct lgfs2_inode *child_ip;
 	struct lgfs2_inum childs_dotdot;
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	int error;
 	struct lgfs2_inum inum = {0};
 
@@ -297,7 +297,7 @@ static int wrong_leaf(struct lgfs2_inode *ip, struct lgfs2_inum *entry,
 		      struct lgfs2_dirent *d, struct gfs2_dirent *prev_de,
 		      uint32_t *count, int q)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct lgfs2_buffer_head *dest_lbh;
 	uint64_t planned_leaf, real_leaf;
 	int li, dest_ref, error;
@@ -426,7 +426,7 @@ static int basic_dentry_checks(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			       struct dir_status *ds, int *q,
 			       struct lgfs2_buffer_head *bh, int *isdir)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	uint32_t calculated_hash;
 	struct lgfs2_inode *entry_ip = NULL;
 	int error;
@@ -678,7 +678,7 @@ out:
  * the same, that's an error, and we need to delete the damaged original
  * dentry, since we failed to detect the problem earlier.
  */
-static int check_suspicious_dirref(struct gfs2_sbd *sdp,
+static int check_suspicious_dirref(struct lgfs2_sbd *sdp,
 				   struct lgfs2_inum *entry)
 {
 	struct osi_node *tmp, *next = NULL;
@@ -723,7 +723,7 @@ static int check_dentry(struct lgfs2_inode *ip, struct gfs2_dirent *dent,
 			struct lgfs2_buffer_head *bh, char *filename,
 			uint32_t *count, int *lindex, void *priv)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	int q = 0;
 	char tmp_name[MAX_FILENAME];
 	struct lgfs2_inum entry;
@@ -1908,7 +1908,7 @@ static int build_quota_change(struct lgfs2_inode *per_node, unsigned int n)
 /* Check system directory inode                                           */
 /* Should work for all system directories: root, master, jindex, per_node */
 static int check_system_dir(struct lgfs2_inode *sysinode, const char *dirname,
-		     int builder(struct gfs2_sbd *sdp))
+		     int builder(struct lgfs2_sbd *sdp))
 {
 	uint64_t iblock = 0;
 	struct dir_status ds = {0};
@@ -2005,7 +2005,7 @@ static int check_system_dir(struct lgfs2_inode *sysinode, const char *dirname,
 /**
  * is_system_dir - determine if a given block is for a system directory.
  */
-static inline int is_system_dir(struct gfs2_sbd *sdp, uint64_t block)
+static inline int is_system_dir(struct lgfs2_sbd *sdp, uint64_t block)
 {
 	if (block == sdp->md.rooti->i_num.in_addr)
 		return 1;
@@ -2018,7 +2018,7 @@ static inline int is_system_dir(struct gfs2_sbd *sdp, uint64_t block)
 	return 0;
 }
 
-static int pass2_check_dir(struct gfs2_sbd *sdp, struct lgfs2_inode *ip)
+static int pass2_check_dir(struct lgfs2_sbd *sdp, struct lgfs2_inode *ip)
 {
 	uint64_t dirblk = ip->i_num.in_addr;
 	struct dir_status ds = {0};
@@ -2106,7 +2106,7 @@ static int pass2_check_dir(struct gfs2_sbd *sdp, struct lgfs2_inode *ip)
  * directory name length
  * entries in range
  */
-int pass2(struct gfs2_sbd *sdp)
+int pass2(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *tmp, *next = NULL;
 	struct lgfs2_inode *ip;
gfs2/fsck/pass3.c +3 -3
index a85c4975..4fa826e7 100644
@@ -18,7 +18,7 @@
 #include "util.h"
 #include "afterpass1_common.h"
 
-static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
+static int attach_dotdot_to(struct lgfs2_sbd *sdp, uint64_t newdotdot,
 			    uint64_t olddotdot, uint64_t block)
 {
 	const char *filename = "..";
@@ -54,7 +54,7 @@ static int attach_dotdot_to(struct gfs2_sbd *sdp, uint64_t newdotdot,
 	return 0;
 }
 
-static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sdp,
+static struct dir_info *mark_and_return_parent(struct lgfs2_sbd *sdp,
 					       struct dir_info *di)
 {
 	struct dir_info *pdi;
@@ -156,7 +156,7 @@ out:
  * handle disconnected directories
  * handle lost+found directory errors (missing, not a directory, no space)
  */
-int pass3(struct gfs2_sbd *sdp)
+int pass3(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *tmp, *next = NULL;
 	struct dir_info *di, *tdi;
gfs2/fsck/pass4.c +6 -6
index 6acd9a65..651c7752 100644
@@ -49,7 +49,7 @@ static int fix_link_count(uint32_t counted_links, struct lgfs2_inode *ip)
  *
  * Returns: 1 if caller should do "continue", 0 if not.
  */
-static int handle_unlinked(struct gfs2_sbd *sdp, uint64_t no_addr,
+static int handle_unlinked(struct lgfs2_sbd *sdp, uint64_t no_addr,
 			   uint32_t *counted_links, int *lf_addition)
 {
 	struct lgfs2_inode *ip;
@@ -118,7 +118,7 @@ static int handle_unlinked(struct gfs2_sbd *sdp, uint64_t no_addr,
 	return 0;
 }
 
-static void handle_inconsist(struct gfs2_sbd *sdp, uint64_t no_addr,
+static void handle_inconsist(struct lgfs2_sbd *sdp, uint64_t no_addr,
 			     uint32_t *di_nlink, uint32_t counted_links)
 {
 	log_err(_("Link count inconsistent for inode %"PRIu64" (0x%"PRIx64") has %u but fsck found %u.\n"),
@@ -160,7 +160,7 @@ static int adjust_lf_links(int lf_addition)
 	return 0;
 }
 
-static int scan_inode_list(struct gfs2_sbd *sdp)
+static int scan_inode_list(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *tmp, *next = NULL;
 	struct inode_info *ii;
@@ -195,7 +195,7 @@ static int scan_inode_list(struct gfs2_sbd *sdp)
 	return adjust_lf_links(lf_addition);
 }
 
-static int scan_dir_list(struct gfs2_sbd *sdp)
+static int scan_dir_list(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *tmp, *next = NULL;
 	struct dir_info *di;
@@ -227,7 +227,7 @@ static int scan_dir_list(struct gfs2_sbd *sdp)
 	return adjust_lf_links(lf_addition);
 }
 
-static int scan_nlink1_list(struct gfs2_sbd *sdp)
+static int scan_nlink1_list(struct lgfs2_sbd *sdp)
 {
 	uint64_t blk;
 	uint32_t counted_links;
@@ -262,7 +262,7 @@ static int scan_nlink1_list(struct gfs2_sbd *sdp)
  * handle unreferenced inodes of other types
  * handle bad blocks
  */
-int pass4(struct gfs2_sbd *sdp)
+int pass4(struct lgfs2_sbd *sdp)
 {
 	if (lf_dip)
 		log_debug( _("At beginning of pass4, lost+found entries is %u\n"),
gfs2/fsck/pass5.c +3 -3
index df8233a4..55ede8db 100644
@@ -14,7 +14,7 @@
 
 #define GFS1_BLKST_USEDMETA 4
 
-static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
+static int check_block_status(struct lgfs2_sbd *sdp,  struct gfs2_bmap *bl,
 			      char *buffer, unsigned int buflen,
 			      uint64_t *rg_block, uint64_t rg_data,
 			      uint32_t *count)
@@ -113,7 +113,7 @@ static int check_block_status(struct gfs2_sbd *sdp,  struct gfs2_bmap *bl,
 	return 0;
 }
 
-static void update_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgp,
+static void update_rgrp(struct lgfs2_sbd *sdp, struct rgrp_tree *rgp,
 			struct gfs2_bmap *bl, uint32_t *count)
 {
 	uint32_t i;
@@ -194,7 +194,7 @@ static void update_rgrp(struct gfs2_sbd *sdp, struct rgrp_tree *rgp,
  * fix free block maps
  * fix used inode maps
  */
-int pass5(struct gfs2_sbd *sdp, struct gfs2_bmap *bl)
+int pass5(struct lgfs2_sbd *sdp, struct gfs2_bmap *bl)
 {
 	struct osi_node *n, *next = NULL;
 	struct rgrp_tree *rgp = NULL;
gfs2/fsck/rgrepair.c +13 -13
index 5c9c5d78..5bfbb7da 100644
@@ -47,7 +47,7 @@ static struct osi_root rgcalc;
  *       which isn't often the case. Normally the rindex needs to be read in
  *       first. If the rindex is damaged, that's not an option.
  */
-static void find_journaled_rgs(struct gfs2_sbd *sdp)
+static void find_journaled_rgs(struct lgfs2_sbd *sdp)
 {
 	int j, new = 0;
 	unsigned int jblocks;
@@ -97,7 +97,7 @@ static int is_false_rg(uint64_t block)
  * This function was revised to return the number of segments, usually 2.
  * The shortest distance is now returned in the highest entry in rg_dist
  */
-static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
+static int find_shortest_rgdist(struct lgfs2_sbd *sdp, uint64_t *dist_array,
 				int *dist_cnt)
 {
 	uint64_t blk, block_last_rg, shortest_dist_btwn_rgs;
@@ -256,7 +256,7 @@ static int find_shortest_rgdist(struct gfs2_sbd *sdp, uint64_t *dist_array,
 /*
  * count_usedspace - count the used bits in a rgrp bitmap buffer
  */
-static uint64_t count_usedspace(struct gfs2_sbd *sdp, int first,
+static uint64_t count_usedspace(struct lgfs2_sbd *sdp, int first,
 				struct lgfs2_buffer_head *bh)
 {
 	int off, x, y, bytes_to_check;
@@ -307,7 +307,7 @@ static uint64_t count_usedspace(struct gfs2_sbd *sdp, int first,
  *
  * This function finds the distance to the next rgrp for these cases.
  */
-static uint64_t find_next_rgrp_dist(struct gfs2_sbd *sdp, uint64_t blk,
+static uint64_t find_next_rgrp_dist(struct lgfs2_sbd *sdp, uint64_t blk,
 				    struct rgrp_tree *prevrgd)
 {
 	struct osi_node *n, *next = NULL;
@@ -419,7 +419,7 @@ static uint64_t find_next_rgrp_dist(struct gfs2_sbd *sdp, uint64_t blk,
  * This function is only called if the rgrps are determined to be on uneven
  * boundaries, and also corrupt.  So we have to go out searching for one.
  */
-static uint64_t hunt_and_peck(struct gfs2_sbd *sdp, uint64_t blk,
+static uint64_t hunt_and_peck(struct lgfs2_sbd *sdp, uint64_t blk,
 			      struct rgrp_tree *prevrgd, uint64_t last_bump)
 {
 	uint64_t rgrp_dist = 0, block, twogigs, last_block, last_meg;
@@ -510,7 +510,7 @@ static uint64_t hunt_and_peck(struct gfs2_sbd *sdp, uint64_t blk,
  * from gfs1 to gfs2 after a gfs_grow operation.  In that case, the rgrps
  * will not be on predictable boundaries.
  */
-static int rindex_rebuild(struct gfs2_sbd *sdp, int *num_rgs, int gfs_grow)
+static int rindex_rebuild(struct lgfs2_sbd *sdp, int *num_rgs, int gfs_grow)
 {
 	struct osi_node *n, *next = NULL;
 	struct lgfs2_buffer_head *bh;
@@ -696,7 +696,7 @@ out:
  *
  * Returns: the number of RGs
  */
-static uint64_t how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev)
+static uint64_t how_many_rgrps(struct lgfs2_sbd *sdp, struct device *dev)
 {
 	uint64_t nrgrp;
 	uint32_t rgblocks1, rgblocksn, bitblocks1, bitblocksn;
@@ -730,7 +730,7 @@ static uint64_t how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev)
 /**
  * compute_rgrp_layout - figure out where the RG in a FS are
  */
-static struct osi_root compute_rgrp_layout(struct gfs2_sbd *sdp)
+static struct osi_root compute_rgrp_layout(struct lgfs2_sbd *sdp)
 {
 	struct device *dev;
 	struct rgrp_tree *rl, *rlast = NULL;
@@ -764,7 +764,7 @@ static struct osi_root compute_rgrp_layout(struct gfs2_sbd *sdp)
 	return rgtree;
 }
 
-static int calc_rgrps(struct gfs2_sbd *sdp)
+static int calc_rgrps(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *n, *next = NULL;
 	struct rgrp_tree *rl;
@@ -804,7 +804,7 @@ static int calc_rgrps(struct gfs2_sbd *sdp)
  * Sets:    sdp->rglist to a linked list of fsck_rgrp structs representing
  *          what we think the rindex should really look like.
  */
-static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, int *num_rgs)
+static int gfs2_rindex_calculate(struct lgfs2_sbd *sdp, int *num_rgs)
 {
 	uint64_t num_rgrps = 0;
 
@@ -845,7 +845,7 @@ static int gfs2_rindex_calculate(struct gfs2_sbd *sdp, int *num_rgs)
  * rewrite_rg_block - rewrite ("fix") a buffer with rg or bitmap data
  * returns: 0 if the rg was repaired, otherwise 1
  */
-static int rewrite_rg_block(struct gfs2_sbd *sdp, struct rgrp_tree *rg,
+static int rewrite_rg_block(struct lgfs2_sbd *sdp, struct rgrp_tree *rg,
 			    uint64_t errblock)
 {
 	int x = errblock - rg->rt_addr;
@@ -902,7 +902,7 @@ static int rewrite_rg_block(struct gfs2_sbd *sdp, struct rgrp_tree *rg,
  *                        values as our expected values and assume the
  *                        damage is only to the rgrps themselves.
  */
-static int expect_rindex_sanity(struct gfs2_sbd *sdp, int *num_rgs)
+static int expect_rindex_sanity(struct lgfs2_sbd *sdp, int *num_rgs)
 {
 	struct osi_node *n, *next = NULL;
 	struct rgrp_tree *rgd, *exp;
@@ -943,7 +943,7 @@ static int expect_rindex_sanity(struct gfs2_sbd *sdp, int *num_rgs)
  *             was converted from GFS via gfs2_convert, and its rgrps are
  *             not on nice boundaries thanks to previous gfs_grow ops. Lovely.
  */
-int rindex_repair(struct gfs2_sbd *sdp, int trust_lvl, int *ok)
+int rindex_repair(struct lgfs2_sbd *sdp, int trust_lvl, int *ok)
 {
 	struct osi_node *n, *next = NULL, *e, *enext;
 	int error, discrepancies, percent;
gfs2/fsck/util.c +1 -1
index b4e25c8b..ba5f1f22 100644
@@ -535,7 +535,7 @@ void dirtree_delete(struct dir_info *b)
 	free(b);
 }
 
-uint64_t find_free_blk(struct gfs2_sbd *sdp)
+uint64_t find_free_blk(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *n, *next = NULL;
 	struct rgrp_tree *rl = NULL;
gfs2/fsck/util.h +3 -3
index 4f3ce5a7..84e15e40 100644
@@ -29,7 +29,7 @@ extern const char *reftypes[REF_TYPES + 1];
 
 struct fsck_pass {
 	const char *name;
-	int (*f)(struct gfs2_sbd *sdp);
+	int (*f)(struct lgfs2_sbd *sdp);
 };
 
 static inline int block_type(struct gfs2_bmap *bl, uint64_t bblock)
@@ -64,7 +64,7 @@ static inline void link1_destroy(struct gfs2_bmap *bmap)
 	bmap->mapsize = 0;
 }
 
-static inline int bitmap_type(struct gfs2_sbd *sdp, uint64_t bblock)
+static inline int bitmap_type(struct lgfs2_sbd *sdp, uint64_t bblock)
 {
 	struct rgrp_tree *rgd;
 
@@ -124,7 +124,7 @@ extern char generic_interrupt(const char *caller, const char *where,
                        const char *progress, const char *question,
                        const char *answers);
 extern char gfs2_getch(void);
-extern uint64_t find_free_blk(struct gfs2_sbd *sdp);
+extern uint64_t find_free_blk(struct lgfs2_sbd *sdp);
 extern __be64 *get_dir_hash(struct lgfs2_inode *ip);
 extern void delete_all_dups(struct lgfs2_inode *ip);
 extern void print_pass_duration(const char *name, struct timeval *start);
gfs2/glocktop/glocktop.c +3 -3
index 369638a2..f0053853 100644
@@ -156,7 +156,7 @@ struct mount_point {
 	char *device;
 	char *dir;
 	int fd;
-	struct gfs2_sbd sb;
+	struct lgfs2_sbd sb;
 };
 static struct mount_point *mounts;
 static char dlmwlines[MAX_LINES][96]; /* waiters lines */
@@ -222,7 +222,7 @@ static void UpdateSize(int sig)
 	signal(SIGWINCH, UpdateSize);
 }
 
-static int read_superblock(int fd, struct gfs2_sbd *sdp)
+static int read_superblock(int fd, struct lgfs2_sbd *sdp)
 {
 	ssize_t r;
 	char *buf;
@@ -617,7 +617,7 @@ static const char *show_inode(const char *id, int fd, uint64_t block)
 {
 	struct lgfs2_inode *ip;
 	const char *inode_type = NULL;
-	struct gfs2_sbd sbd = { .device_fd = fd, .sd_bsize = bsize };
+	struct lgfs2_sbd sbd = { .device_fd = fd, .sd_bsize = bsize };
 
 	ip = lgfs2_inode_read(&sbd, block);
 	if (S_ISDIR(ip->i_mode)) {
gfs2/libgfs2/buf.c +4 -4
index bd1ba6c1..cb5a3ea4 100644
@@ -22,7 +22,7 @@
   #endif
 #endif
 
-struct lgfs2_buffer_head *lgfs2_bget(struct gfs2_sbd *sdp, uint64_t num)
+struct lgfs2_buffer_head *lgfs2_bget(struct lgfs2_sbd *sdp, uint64_t num)
 {
 	struct lgfs2_buffer_head *bh;
 
@@ -38,7 +38,7 @@ struct lgfs2_buffer_head *lgfs2_bget(struct gfs2_sbd *sdp, uint64_t num)
 	return bh;
 }
 
-int __lgfs2_breadm(struct gfs2_sbd *sdp, struct lgfs2_buffer_head **bhs, size_t n,
+int __lgfs2_breadm(struct lgfs2_sbd *sdp, struct lgfs2_buffer_head **bhs, size_t n,
                    uint64_t block, int line, const char *caller)
 {
 	size_t v = (n < IOV_MAX) ? n : IOV_MAX;
@@ -71,7 +71,7 @@ int __lgfs2_breadm(struct gfs2_sbd *sdp, struct lgfs2_buffer_head **bhs, size_t
 	return 0;
 }
 
-struct lgfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num, int line,
+struct lgfs2_buffer_head *__lgfs2_bread(struct lgfs2_sbd *sdp, uint64_t num, int line,
 				 const char *caller)
 {
 	struct lgfs2_buffer_head *bh;
@@ -93,7 +93,7 @@ struct lgfs2_buffer_head *__lgfs2_bread(struct gfs2_sbd *sdp, uint64_t num, int
 
 int lgfs2_bwrite(struct lgfs2_buffer_head *bh)
 {
-	struct gfs2_sbd *sdp = bh->sdp;
+	struct lgfs2_sbd *sdp = bh->sdp;
 
 	if (pwritev(sdp->device_fd, &bh->iov, 1, bh->b_blocknr * sdp->sd_bsize) != bh->iov.iov_len)
 		return -1;
gfs2/libgfs2/check_ondisk.c +3 -3
index 6c8dd065..940a6b0c 100644
@@ -7,7 +7,7 @@ START_TEST(check_sb_in)
 {
 	char buf[sizeof(struct gfs2_sb)];
 	char namechk[GFS2_LOCKNAME_LEN];
-	struct gfs2_sbd sbd;
+	struct lgfs2_sbd sbd;
 	char uuidchk[sizeof(sbd.sd_uuid)];
 
 	memset(buf, 0x5a, sizeof(buf));
@@ -45,7 +45,7 @@ START_TEST(check_sb1_out)
 {
 	char namechk[GFS2_LOCKNAME_LEN];
 	char buf[sizeof(struct gfs_sb)];
-	struct gfs2_sbd sbd;
+	struct lgfs2_sbd sbd;
 	struct gfs_sb *sb;
 
 	memset(namechk, 0x5a, GFS2_LOCKNAME_LEN);
@@ -101,7 +101,7 @@ START_TEST(check_sb2_out)
 {
 	char buf[sizeof(struct gfs2_sb)];
 	char namechk[GFS2_LOCKNAME_LEN];
-	struct gfs2_sbd sbd;
+	struct lgfs2_sbd sbd;
 	struct gfs2_sb *sb;
 	char uuidchk[sizeof(sbd.sd_uuid)];
 
gfs2/libgfs2/check_rgrp.c +2 -2
index d2e7b4fb..1b3b1878 100644
@@ -15,7 +15,7 @@ lgfs2_rgrps_t tc_rgrps;
 
 static void mockup_rgrps(void)
 {
-	struct gfs2_sbd *sdp;
+	struct lgfs2_sbd *sdp;
 	lgfs2_rgrps_t rgs;
 	uint64_t addr;
 	struct gfs2_rindex ri = {0};
@@ -132,7 +132,7 @@ END_TEST
 START_TEST(test_rgrps_write_final)
 {
 	lgfs2_rgrp_t rg = lgfs2_rgrp_last(tc_rgrps);
-	struct gfs2_sbd *sdp = tc_rgrps->sdp;
+	struct lgfs2_sbd *sdp = tc_rgrps->sdp;
 	struct gfs2_rindex ri;
 	struct gfs2_rgrp rgrp;
 	uint64_t addr;
gfs2/libgfs2/device_geometry.c +1 -1
index 86ad84bd..c6c00c95 100644
@@ -92,7 +92,7 @@ size_check:
  *
  */
 
-void lgfs2_fix_device_geometry(struct gfs2_sbd *sdp)
+void lgfs2_fix_device_geometry(struct lgfs2_sbd *sdp)
 {
 	struct device *device = &sdp->device;
 
gfs2/libgfs2/fs_bits.c +2 -2
index db5e2772..b95732ef 100644
@@ -105,7 +105,7 @@ unsigned long lgfs2_bitfit(const unsigned char *buf, const unsigned int len,
  *
  * Returns: 0 if ok, -1 if out of bounds
  */
-int lgfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
+int lgfs2_check_range(struct lgfs2_sbd *sdp, uint64_t blkno)
 {
 	if((blkno > sdp->fssize) || (blkno <= LGFS2_SB_ADDR(sdp)))
 		return -1;
@@ -174,7 +174,7 @@ int lgfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
  *
  * Returns: state on success, -1 on error
  */
-int lgfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd)
+int lgfs2_get_bitmap(struct lgfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd)
 {
 	uint64_t offset;
 	uint32_t i = 0;
gfs2/libgfs2/fs_ops.c +26 -26

208 lines not on this page · raw message

gfs2/libgfs2/gfs1.c +5 -5
index 440b8918..0079021b 100644
@@ -70,7 +70,7 @@ void lgfs2_gfs1_lookup_block(struct lgfs2_inode *ip, struct lgfs2_buffer_head *b
 void lgfs2_gfs1_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
 		    uint64_t *dblock, uint32_t *extlen, int prealloc)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct lgfs2_buffer_head *bh;
 	struct metapath mp;
 	int create = *new;
@@ -166,7 +166,7 @@ void lgfs2_gfs1_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
 int lgfs2_gfs1_writei(struct lgfs2_inode *ip, void *buf, uint64_t offset,
 		unsigned int size)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct lgfs2_buffer_head *bh;
 	uint64_t lblock, dblock;
 	uint32_t extlen = 0;
@@ -245,7 +245,7 @@ int lgfs2_gfs1_writei(struct lgfs2_inode *ip, void *buf, uint64_t offset,
 	return copied;
 }
 
-static struct lgfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
+static struct lgfs2_inode *__gfs_inode_get(struct lgfs2_sbd *sdp, char *buf)
 {
 	struct gfs_dinode *di;
 	struct lgfs2_inode *ip;
@@ -284,12 +284,12 @@ static struct lgfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
 	return ip;
 }
 
-struct lgfs2_inode *lgfs2_gfs_inode_get(struct gfs2_sbd *sdp, char *buf)
+struct lgfs2_inode *lgfs2_gfs_inode_get(struct lgfs2_sbd *sdp, char *buf)
 {
 	return __gfs_inode_get(sdp, buf);
 }
 
-struct lgfs2_inode *lgfs2_gfs_inode_read(struct gfs2_sbd *sdp, uint64_t di_addr)
+struct lgfs2_inode *lgfs2_gfs_inode_read(struct lgfs2_sbd *sdp, uint64_t di_addr)
 {
 	struct lgfs2_buffer_head *bh;
 	struct lgfs2_inode *ip;
gfs2/libgfs2/gfs2l.c +2 -2
index b8c4ca41..3694a3d0 100644
@@ -104,7 +104,7 @@ static int getopts(int argc, char *argv[], struct cmdopts *opts)
 	return 0;
 }
 
-static int openfs(const char *path, struct gfs2_sbd *sdp)
+static int openfs(const char *path, struct lgfs2_sbd *sdp)
 {
 	int fd;
 	int ret;
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
 {
 	int ret;
 	struct cmdopts opts = {NULL, NULL};
-	struct gfs2_sbd sbd;
+	struct lgfs2_sbd sbd;
 	struct lgfs2_lang_result *result;
 	struct lgfs2_lang_state *state;
 
gfs2/libgfs2/lang.c +11 -11
index 0c869d07..2ac59796 100644
@@ -149,7 +149,7 @@ static void ast_string_unescape(char *str)
 	str[tail] = '\0';
 }
 
-static uint64_t ast_lookup_path(char *path, struct gfs2_sbd *sbd)
+static uint64_t ast_lookup_path(char *path, struct lgfs2_sbd *sbd)
 {
 	int err = 0;
 	char *c = NULL;
@@ -201,7 +201,7 @@ static const char *block_ids[] = {
 	[ID_END]	= NULL
 };
 
-static uint64_t ast_lookup_id(const char *id, struct gfs2_sbd *sbd)
+static uint64_t ast_lookup_id(const char *id, struct lgfs2_sbd *sbd)
 {
 	uint64_t bn = 0;
 	int i;
@@ -229,7 +229,7 @@ static uint64_t ast_lookup_id(const char *id, struct gfs2_sbd *sbd)
 	return bn;
 }
 
-static uint64_t ast_lookup_rgrp(uint64_t rgnum, struct gfs2_sbd *sbd)
+static uint64_t ast_lookup_rgrp(uint64_t rgnum, struct lgfs2_sbd *sbd)
 {
 	uint64_t i = rgnum;
 	struct osi_node *n;
@@ -242,7 +242,7 @@ static uint64_t ast_lookup_rgrp(uint64_t rgnum, struct gfs2_sbd *sbd)
 }
 
 static uint64_t ast_lookup_subscript(struct ast_node *id, struct ast_node *index,
-                                     struct gfs2_sbd *sbd)
+                                     struct lgfs2_sbd *sbd)
 {
 	uint64_t bn = 0;
 	const char *name = id->ast_str;
@@ -258,7 +258,7 @@ static uint64_t ast_lookup_subscript(struct ast_node *id, struct ast_node *index
  * Look up a block and return its number. The kind of lookup depends on the
  * type of the ast node.
  */
-static uint64_t ast_lookup_block_num(struct ast_node *ast, struct gfs2_sbd *sbd)
+static uint64_t ast_lookup_block_num(struct ast_node *ast, struct lgfs2_sbd *sbd)
 {
 	uint64_t bn = 0;
 	switch (ast->ast_type) {
@@ -285,7 +285,7 @@ static uint64_t ast_lookup_block_num(struct ast_node *ast, struct gfs2_sbd *sbd)
 	return bn;
 }
 
-static uint64_t ast_lookup_block(struct ast_node *node, struct gfs2_sbd *sbd)
+static uint64_t ast_lookup_block(struct ast_node *node, struct lgfs2_sbd *sbd)
 {
 	uint64_t bn = ast_lookup_block_num(node, sbd);
 	if (bn == 0) {
@@ -361,7 +361,7 @@ int lgfs2_lang_result_print(struct lgfs2_lang_result *result)
 	return 0;
 }
 
-static int ast_get_bitstate(uint64_t bn, struct gfs2_sbd *sbd)
+static int ast_get_bitstate(uint64_t bn, struct lgfs2_sbd *sbd)
 {
 	int ret = 0;
 	int state = 0;
@@ -424,7 +424,7 @@ static char *lang_read_block(int fd, unsigned bsize, uint64_t addr)
  * Interpret the get statement.
  */
 static struct lgfs2_lang_result *ast_interp_get(struct lgfs2_lang_state *state,
-                                     struct ast_node *ast, struct gfs2_sbd *sbd)
+                                     struct ast_node *ast, struct lgfs2_sbd *sbd)
 {
 	struct lgfs2_lang_result *result = calloc(1, sizeof(struct lgfs2_lang_result));
 	if (result == NULL) {
@@ -521,7 +521,7 @@ static int lang_write_result(int fd, unsigned bsize, struct lgfs2_lang_result *r
  * Interpret an assignment (set)
  */
 static struct lgfs2_lang_result *ast_interp_set(struct lgfs2_lang_state *state,
-                                    struct ast_node *ast, struct gfs2_sbd *sbd)
+                                    struct ast_node *ast, struct lgfs2_sbd *sbd)
 {
 	struct ast_node *lookup = ast->ast_right;
 	struct ast_node *fieldspec;
@@ -591,7 +591,7 @@ out_err:
 }
 
 static struct lgfs2_lang_result *ast_interpret_node(struct lgfs2_lang_state *state,
-                                        struct ast_node *ast, struct gfs2_sbd *sbd)
+                                        struct ast_node *ast, struct lgfs2_sbd *sbd)
 {
 	struct lgfs2_lang_result *result = NULL;
 
@@ -606,7 +606,7 @@ static struct lgfs2_lang_result *ast_interpret_node(struct lgfs2_lang_state *sta
 }
 
 struct lgfs2_lang_result *lgfs2_lang_result_next(struct lgfs2_lang_state *state,
-                                                           struct gfs2_sbd *sbd)
+                                                           struct lgfs2_sbd *sbd)
 {
 	struct lgfs2_lang_result *result;
 	if (state->ls_interp_curr == NULL) {
gfs2/libgfs2/lang.h +1 -1
index 211abd46..81d27445 100644
@@ -22,7 +22,7 @@ struct lgfs2_lang_result {
 extern struct lgfs2_lang_state *lgfs2_lang_init(void);
 extern int lgfs2_lang_parsef(struct lgfs2_lang_state *state, FILE *script);
 extern int lgfs2_lang_parses(struct lgfs2_lang_state *state, const char *script);
-extern struct lgfs2_lang_result *lgfs2_lang_result_next(struct lgfs2_lang_state *state, struct gfs2_sbd *sbd);
+extern struct lgfs2_lang_result *lgfs2_lang_result_next(struct lgfs2_lang_state *state, struct lgfs2_sbd *sbd);
 extern int lgfs2_lang_result_print(struct lgfs2_lang_result *result);
 extern void lgfs2_lang_result_free(struct lgfs2_lang_result **result);
 extern void lgfs2_lang_free(struct lgfs2_lang_state **state);
gfs2/libgfs2/libgfs2.h +42 -42

204 lines not on this page · raw message

gfs2/libgfs2/misc.c +1 -1
index 6092fa5c..80f098ab 100644
@@ -36,7 +36,7 @@ int lgfs2_compute_heightsize(unsigned bsize, uint64_t *heightsize,
 	return 0;
 }
 
-int lgfs2_compute_constants(struct gfs2_sbd *sdp)
+int lgfs2_compute_constants(struct lgfs2_sbd *sdp)
 {
 	sdp->md.next_inum = 1;
 
gfs2/libgfs2/ondisk.c +2 -2
index 9d06443c..b6e6a867 100644
@@ -25,7 +25,7 @@ void lgfs2_inum_out(const struct lgfs2_inum *i, void *inp)
 	in->no_addr = cpu_to_be64(i->in_addr);
 }
 
-void lgfs2_sb_in(struct gfs2_sbd *sdp, void *buf)
+void lgfs2_sb_in(struct lgfs2_sbd *sdp, void *buf)
 {
 	struct gfs2_sb *sb = buf;
 	struct gfs_sb *sb1 = buf;
@@ -46,7 +46,7 @@ void lgfs2_sb_in(struct gfs2_sbd *sdp, void *buf)
 	memcpy(sdp->sd_uuid, sb->sb_uuid, sizeof(sdp->sd_uuid));
 }
 
-void lgfs2_sb_out(const struct gfs2_sbd *sdp, void *buf)
+void lgfs2_sb_out(const struct lgfs2_sbd *sdp, void *buf)
 {
 	struct gfs2_sb *sb = buf;
 	struct gfs_sb *sb1 = buf;
gfs2/libgfs2/rgrp.c +10 -10
index e3f2e268..9ca92172 100644
@@ -86,7 +86,7 @@ errbits:
  *
  * Returns: Ths resource group, or NULL if not found
  */
-struct rgrp_tree *lgfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk)
+struct rgrp_tree *lgfs2_blk2rgrpd(struct lgfs2_sbd *sdp, uint64_t blk)
 {
 	struct rgrp_tree *rgd = (struct rgrp_tree *)sdp->rgtree.osi_node;
 	while (rgd) {
@@ -108,7 +108,7 @@ struct rgrp_tree *lgfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk)
  */
 int lgfs2_rgrp_bitbuf_alloc(lgfs2_rgrp_t rg)
 {
-	struct gfs2_sbd *sdp = rg->rgrps->sdp;
+	struct lgfs2_sbd *sdp = rg->rgrps->sdp;
 	size_t len = rg->rt_length * sdp->sd_bsize;
 	unsigned long io_align = sdp->sd_bsize;
 	unsigned i;
@@ -187,7 +187,7 @@ void lgfs2_rgrp_crc_set(char *buf)
  * @rgd - resource group structure
  * returns: 0 if no error, otherwise the block number that failed
  */
-uint64_t lgfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+uint64_t lgfs2_rgrp_read(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
 {
 	unsigned length = rgd->rt_length * sdp->sd_bsize;
 	off_t offset = rgd->rt_addr * sdp->sd_bsize;
@@ -227,7 +227,7 @@ uint64_t lgfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 	return 0;
 }
 
-void lgfs2_rgrp_relse(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+void lgfs2_rgrp_relse(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
 {
 	if (rgd->bits == NULL)
 		return;
@@ -279,7 +279,7 @@ struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
 	return data;
 }
 
-void lgfs2_rgrp_free(struct gfs2_sbd *sdp, struct osi_root *rgrp_tree)
+void lgfs2_rgrp_free(struct lgfs2_sbd *sdp, struct osi_root *rgrp_tree)
 {
 	struct rgrp_tree *rgd;
 	struct osi_node *n;
@@ -404,7 +404,7 @@ uint32_t lgfs2_rgrps_plan(const lgfs2_rgrps_t rgs, uint64_t space, uint32_t tgts
  * offset: The required stripe offset of the resource groups
  * Returns an initialised lgfs2_rgrps_t or NULL if unsuccessful with errno set
  */
-lgfs2_rgrps_t lgfs2_rgrps_init(struct gfs2_sbd *sdp, uint64_t align, uint64_t offset)
+lgfs2_rgrps_t lgfs2_rgrps_init(struct lgfs2_sbd *sdp, uint64_t align, uint64_t offset)
 {
 	lgfs2_rgrps_t rgs;
 
@@ -606,7 +606,7 @@ unsigned lgfs2_rgsize_for_data(uint64_t blksreq, unsigned bsize)
 }
 
 // Temporary function to aid in API migration
-void lgfs2_attach_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs)
+void lgfs2_attach_rgrps(struct lgfs2_sbd *sdp, lgfs2_rgrps_t rgs)
 {
 	sdp->rgtree.osi_node = rgs->root.osi_node;
 }
@@ -665,7 +665,7 @@ lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry, ui
  */
 int lgfs2_rgrp_write(int fd, const lgfs2_rgrp_t rg)
 {
-	struct gfs2_sbd *sdp = rg->rgrps->sdp;
+	struct lgfs2_sbd *sdp = rg->rgrps->sdp;
 	unsigned int i;
 	int freebufs = 0;
 	ssize_t ret;
@@ -749,7 +749,7 @@ lgfs2_rgrp_t lgfs2_rgrp_last(lgfs2_rgrps_t rgs)
 int lgfs2_rbm_from_block(struct lgfs2_rbm *rbm, uint64_t block)
 {
 	uint64_t rblock = block - rbm->rgd->rt_data0;
-	struct gfs2_sbd *sdp = rbm->rgd->rgrps->sdp;
+	struct lgfs2_sbd *sdp = rbm->rgd->rgrps->sdp;
 
 	if (rblock > UINT_MAX) {
 		errno = EINVAL;
@@ -880,7 +880,7 @@ static uint32_t lgfs2_free_extlen(const struct lgfs2_rbm *rrbm, uint32_t len)
 	uint8_t *ptr, *start, *end;
 	uint64_t block;
 	struct gfs2_bitmap *bi;
-	struct gfs2_sbd *sdp = rbm.rgd->rgrps->sdp;
+	struct lgfs2_sbd *sdp = rbm.rgd->rgrps->sdp;
 
 	if (n_unaligned &&
 	    lgfs2_unaligned_extlen(&rbm, 4 - n_unaligned, &len))
gfs2/libgfs2/rgrp.h +1 -1
index 386ade3d..423eaefc 100644
@@ -23,7 +23,7 @@ struct rgs_plan {
 struct _lgfs2_rgrps {
 	struct osi_root root;
 	struct rgs_plan *plan;
-	struct gfs2_sbd *sdp;
+	struct lgfs2_sbd *sdp;
 	unsigned long align;
 	unsigned long align_off;
 };
gfs2/libgfs2/structures.c +13 -13
index f738259a..011fe8ac 100644
@@ -16,7 +16,7 @@
 #include "libgfs2.h"
 #include "crc32c.h"
 
-int lgfs2_build_master(struct gfs2_sbd *sdp)
+int lgfs2_build_master(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
 	uint64_t bn;
@@ -41,7 +41,7 @@ int lgfs2_build_master(struct gfs2_sbd *sdp)
 	return 0;
 }
 
-int lgfs2_sb_write(const struct gfs2_sbd *sdp, int fd)
+int lgfs2_sb_write(const struct lgfs2_sbd *sdp, int fd)
 {
 	int i, err = -1;
 	struct iovec *iov;
@@ -103,7 +103,7 @@ uint32_t lgfs2_log_header_crc(char *buf, unsigned bsize)
  */
 int lgfs2_write_journal_data(struct lgfs2_inode *ip)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	unsigned blocks = (ip->i_size + sdp->sd_bsize - 1) / sdp->sd_bsize;
 	uint64_t jext0 = ip->i_num.in_addr + ip->i_blocks - blocks;
 	uint64_t seq = ((blocks) * (random() / (RAND_MAX + 1.0)));
@@ -153,7 +153,7 @@ int lgfs2_write_journal_data(struct lgfs2_inode *ip)
 
 static struct lgfs2_buffer_head *lgfs2_get_file_buf(struct lgfs2_inode *ip, uint64_t lbn, int prealloc)
 {
-	struct gfs2_sbd *sdp = ip->i_sbd;
+	struct lgfs2_sbd *sdp = ip->i_sbd;
 	uint64_t dbn;
 	int new = 1;
 
@@ -227,7 +227,7 @@ int lgfs2_write_journal(struct lgfs2_inode *jnl, unsigned bsize, unsigned int bl
 	return 0;
 }
 
-int lgfs2_build_journal(struct gfs2_sbd *sdp, int j, struct lgfs2_inode *jindex)
+int lgfs2_build_journal(struct lgfs2_sbd *sdp, int j, struct lgfs2_inode *jindex)
 {
 	char name[256];
 	int ret;
@@ -314,7 +314,7 @@ struct lgfs2_inode *lgfs2_build_statfs_change(struct lgfs2_inode *per_node, unsi
 
 struct lgfs2_inode *lgfs2_build_quota_change(struct lgfs2_inode *per_node, unsigned int j)
 {
-	struct gfs2_sbd *sdp = per_node->i_sbd;
+	struct lgfs2_sbd *sdp = per_node->i_sbd;
 	struct gfs2_meta_header mh;
 	char name[256];
 	struct lgfs2_inode *ip;
@@ -349,7 +349,7 @@ struct lgfs2_inode *lgfs2_build_quota_change(struct lgfs2_inode *per_node, unsig
 	return ip;
 }
 
-struct lgfs2_inode *lgfs2_build_inum(struct gfs2_sbd *sdp)
+struct lgfs2_inode *lgfs2_build_inum(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip;
 
@@ -358,7 +358,7 @@ struct lgfs2_inode *lgfs2_build_inum(struct gfs2_sbd *sdp)
 	return ip;
 }
 
-struct lgfs2_inode *lgfs2_build_statfs(struct gfs2_sbd *sdp)
+struct lgfs2_inode *lgfs2_build_statfs(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip;
 
@@ -367,7 +367,7 @@ struct lgfs2_inode *lgfs2_build_statfs(struct gfs2_sbd *sdp)
 	return ip;
 }
 
-struct lgfs2_inode *lgfs2_build_rindex(struct gfs2_sbd *sdp)
+struct lgfs2_inode *lgfs2_build_rindex(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip;
 	struct osi_node *n, *next = NULL;
@@ -401,7 +401,7 @@ struct lgfs2_inode *lgfs2_build_rindex(struct gfs2_sbd *sdp)
 	return ip;
 }
 
-struct lgfs2_inode *lgfs2_build_quota(struct gfs2_sbd *sdp)
+struct lgfs2_inode *lgfs2_build_quota(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip;
 	struct gfs2_quota qu;
@@ -428,7 +428,7 @@ struct lgfs2_inode *lgfs2_build_quota(struct gfs2_sbd *sdp)
 	return ip;
 }
 
-int lgfs2_build_root(struct gfs2_sbd *sdp)
+int lgfs2_build_root(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inum inum;
 	uint64_t bn;
@@ -453,7 +453,7 @@ int lgfs2_build_root(struct gfs2_sbd *sdp)
 	return 0;
 }
 
-int lgfs2_init_inum(struct gfs2_sbd *sdp)
+int lgfs2_init_inum(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip = sdp->md.inum;
 	__be64 buf;
@@ -467,7 +467,7 @@ int lgfs2_init_inum(struct gfs2_sbd *sdp)
 	return 0;
 }
 
-int lgfs2_init_statfs(struct gfs2_sbd *sdp, struct gfs2_statfs_change *res)
+int lgfs2_init_statfs(struct lgfs2_sbd *sdp, struct gfs2_statfs_change *res)
 {
 	struct lgfs2_inode *ip = sdp->md.statfs;
 	struct gfs2_statfs_change sc;
gfs2/libgfs2/super.c +4 -4
index 3535a0c7..6af366f7 100644
@@ -58,7 +58,7 @@ int lgfs2_check_sb(void *sbp)
  * Returns: 0 on success, -1 on failure
  * sdp->gfs1 will be set if this is gfs (gfs1)
  */
-int lgfs2_read_sb(struct gfs2_sbd *sdp)
+int lgfs2_read_sb(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_buffer_head *bh;
 	uint64_t space = 0;
@@ -146,7 +146,7 @@ int lgfs2_read_sb(struct gfs2_sbd *sdp)
  *
  * Returns: 1 if the rgd seems relatively sane
  */
-static int rgd_seems_ok(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+static int rgd_seems_ok(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
 {
 	uint32_t most_bitmaps_possible;
 
@@ -179,7 +179,7 @@ static int rgd_seems_ok(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
  * If not, we count it as not sane, and therefore, the whole rindex is not to
  * be trusted by fsck.gfs2.
  */
-static int good_on_disk(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
+static int good_on_disk(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
 {
 	struct lgfs2_buffer_head *bh;
 	int is_rgrp;
@@ -198,7 +198,7 @@ static int good_on_disk(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
  *
  * Returns: 0 on success, -1 on failure
  */
-int lgfs2_rindex_read(struct gfs2_sbd *sdp, uint64_t *rgcount, int *ok)
+int lgfs2_rindex_read(struct lgfs2_sbd *sdp, uint64_t *rgcount, int *ok)
 {
 	unsigned int rg;
 	int error;
gfs2/mkfs/main_grow.c +8 -8
index b2959285..f3c6d0ba 100644
@@ -33,8 +33,8 @@ static int test = 0;
 static uint64_t fssize = 0, fsgrowth;
 int print_level = MSG_NOTICE;
 
-extern int create_new_inode(struct gfs2_sbd *sdp);
-extern int rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name);
+extern int create_new_inode(struct lgfs2_sbd *sdp);
+extern int rename2system(struct lgfs2_sbd *sdp, char *new_dir, char *new_name);
 
 #ifndef FALLOC_FL_KEEP_SIZE
 #define FALLOC_FL_KEEP_SIZE 0x01
@@ -88,7 +88,7 @@ static void usage(void)
 	}
 }
 
-static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
+static void decode_arguments(int argc, char *argv[], struct lgfs2_sbd *sdp)
 {
 	int opt;
 
@@ -135,7 +135,7 @@ static void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
 	}
 }
 
-static lgfs2_rgrps_t rgrps_init(struct gfs2_sbd *sdp)
+static lgfs2_rgrps_t rgrps_init(struct lgfs2_sbd *sdp)
 {
 	int ret;
 	int error;
@@ -203,7 +203,7 @@ static uint64_t filesystem_size(lgfs2_rgrps_t rgs)
 /**
  * Write the new rg information to disk.
  */
-static unsigned initialize_new_portion(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs)
+static unsigned initialize_new_portion(struct lgfs2_sbd *sdp, lgfs2_rgrps_t rgs)
 {
 	unsigned rgcount = 0;
 	uint64_t rgaddr = fssize;
@@ -322,7 +322,7 @@ trunc:
 /**
  * print_info - Print out various bits of (interesting?) information
  */
-static void print_info(struct gfs2_sbd *sdp, char *device, char *mnt_path)
+static void print_info(struct lgfs2_sbd *sdp, char *device, char *mnt_path)
 {
 	log_notice(_("Mount point: %s\n"), mnt_path);
 	log_notice(_("Device: %s\n"), device);
@@ -353,7 +353,7 @@ static int open_rindex(char *metafs_path, int mode)
 #ifndef UNITTESTS
 int main(int argc, char *argv[])
 {
-	struct gfs2_sbd sbd, *sdp = &sbd;
+	struct lgfs2_sbd sbd, *sdp = &sbd;
 	int rindex_fd;
 	int error = EXIT_SUCCESS;
 	int devflags = (test ? O_RDONLY : O_RDWR) | O_CLOEXEC;
@@ -362,7 +362,7 @@ int main(int argc, char *argv[])
 	textdomain("gfs2-utils");
 	srandom(time(NULL) ^ getpid());
 
-	memset(sdp, 0, sizeof(struct gfs2_sbd));
+	memset(sdp, 0, sizeof(struct lgfs2_sbd));
 	sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
 	sdp->rgsize = -1;
 	sdp->jsize = GFS2_DEFAULT_JSIZE;
gfs2/mkfs/main_jadd.c +9 -9
index e11b63f6..90a216bb 100644
@@ -139,12 +139,12 @@ static void print_usage(const char *prog_name)
 }
 
 /**
- * Decode command line arguments and fill in the struct gfs2_sbd
+ * Decode command line arguments and fill in the struct lgfs2_sbd
  * @argc:
  * @argv:
  * @sdp: the decoded command line arguments
  */
-static int decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int decode_arguments(int argc, char *argv[], struct lgfs2_sbd *sdp, struct jadd_opts *opts)
 {
 	int cont = 1;
 	int optchar;
@@ -211,7 +211,7 @@ static int decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp, struct
 	return 0;
 }
 
-static int verify_arguments(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int verify_arguments(struct lgfs2_sbd *sdp, struct jadd_opts *opts)
 {
 	if (!opts->journals) {
 		fprintf(stderr, _("no journals specified\n"));
@@ -345,7 +345,7 @@ close_fd:
 	return close(fd) || error;
 }
 
-static int add_qc(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int add_qc(struct lgfs2_sbd *sdp, struct jadd_opts *opts)
 {
 	int fd, error = 0;
 	char new_name[256], buf[sdp->sd_bsize];
@@ -402,7 +402,7 @@ close_fd:
 	return close(fd) || error;
 }
 
-static int gather_info(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int gather_info(struct lgfs2_sbd *sdp, struct jadd_opts *opts)
 {
 	struct statfs statbuf;
 
@@ -512,7 +512,7 @@ out_errno:
 	return -1;
 }
 
-static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int add_j(struct lgfs2_sbd *sdp, struct jadd_opts *opts)
 {
 	int fd, error = 0;
 	char new_name[256], *buf;
@@ -596,7 +596,7 @@ close_fd:
 	return close(fd) || error;
 }
 
-static int check_fit(struct gfs2_sbd *sdp, struct jadd_opts *opts)
+static int check_fit(struct lgfs2_sbd *sdp, struct jadd_opts *opts)
 {
 	/* Compute how much space we'll need for the new journals
 	 * Number of blocks needed per added journal:
@@ -630,7 +630,7 @@ static int check_fit(struct gfs2_sbd *sdp, struct jadd_opts *opts)
 int main(int argc, char *argv[])
 {
 	struct jadd_opts opts = {0};
-	struct gfs2_sbd sbd, *sdp = &sbd;
+	struct lgfs2_sbd sbd, *sdp = &sbd;
 	struct metafs mfs = {0};
 	struct mntent *mnt;
 	unsigned int total, ret = 0;
@@ -639,7 +639,7 @@ int main(int argc, char *argv[])
 	textdomain("gfs2-utils");
 	srandom(time(NULL) ^ getpid());
 
-	memset(sdp, 0, sizeof(struct gfs2_sbd));
+	memset(sdp, 0, sizeof(struct lgfs2_sbd));
 	sdp->jsize = GFS2_DEFAULT_JSIZE;
 	sdp->qcsize = GFS2_DEFAULT_QCSIZE;
 	opts.journals = 1;
gfs2/mkfs/main_mkfs.c +11 -11
index 7c4700dc..c7712be8 100644
@@ -634,7 +634,7 @@ static int opts_check(struct mkfs_opts *opts)
 	return 0;
 }
 
-static void print_results(struct gfs2_sbd *sb, struct mkfs_opts *opts)
+static void print_results(struct lgfs2_sbd *sb, struct mkfs_opts *opts)
 {
 	char readable_uuid[36+1];
 
@@ -681,7 +681,7 @@ static int warn_of_destruction(const char *path)
 	return 0;
 }
 
-static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
+static int build_per_node(struct lgfs2_sbd *sdp, struct mkfs_opts *opts)
 {
 	struct lgfs2_inode *per_node;
 	unsigned int j;
@@ -739,7 +739,7 @@ static int build_per_node(struct gfs2_sbd *sdp, struct mkfs_opts *opts)
 	return 0;
 }
 
-static int zero_gap(struct gfs2_sbd *sdp, uint64_t addr, size_t blocks)
+static int zero_gap(struct lgfs2_sbd *sdp, uint64_t addr, size_t blocks)
 {
 	struct iovec *iov;
 	char *zerobuf;
@@ -775,7 +775,7 @@ static int zero_gap(struct gfs2_sbd *sdp, uint64_t addr, size_t blocks)
 	return 0;
 }
 
-static lgfs2_rgrps_t rgs_init(struct mkfs_opts *opts, struct gfs2_sbd *sdp)
+static lgfs2_rgrps_t rgs_init(struct mkfs_opts *opts, struct lgfs2_sbd *sdp)
 {
 	lgfs2_rgrps_t rgs;
 	uint64_t al_base = 0;
@@ -825,7 +825,7 @@ static lgfs2_rgrps_t rgs_init(struct mkfs_opts *opts, struct gfs2_sbd *sdp)
 	return rgs;
 }
 
-static int place_rgrp(struct gfs2_sbd *sdp, lgfs2_rgrp_t rg, int debug)
+static int place_rgrp(struct lgfs2_sbd *sdp, lgfs2_rgrp_t rg, int debug)
 {
 	uint64_t prev_end = (GFS2_SB_ADDR * GFS2_BASIC_BLOCK / sdp->sd_bsize) + 1;
 	lgfs2_rgrp_t prev = lgfs2_rgrp_prev(rg);
@@ -891,7 +891,7 @@ static int add_rgrp(lgfs2_rgrps_t rgs, uint64_t *addr, uint32_t len, lgfs2_rgrp_
 	return 0;
 }
 
-static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_opts *opts, uint64_t *rgaddr)
+static int place_journals(struct lgfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_opts *opts, uint64_t *rgaddr)
 {
 	struct gfs2_progress_bar progress;
 	uint64_t jfsize = lgfs2_space_for_data(sdp, sdp->sd_bsize, opts->jsize << 20);
@@ -965,7 +965,7 @@ static int place_journals(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, struct mkfs_o
 	return 0;
 }
 
-static int place_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, uint64_t *rgaddr, struct mkfs_opts *opts)
+static int place_rgrps(struct lgfs2_sbd *sdp, lgfs2_rgrps_t rgs, uint64_t *rgaddr, struct mkfs_opts *opts)
 {
 	struct gfs2_progress_bar progress;
 	uint32_t rgblks = ((opts->rgsize << 20) / sdp->sd_bsize);
@@ -999,7 +999,7 @@ static int place_rgrps(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, uint64_t *rgaddr
 	return 0;
 }
 
-static int create_jindex(struct gfs2_sbd *sdp, struct mkfs_opts *opts, struct lgfs2_inum *jnls)
+static int create_jindex(struct lgfs2_sbd *sdp, struct mkfs_opts *opts, struct lgfs2_inum *jnls)
 {
 	struct lgfs2_inode *jindex;
 
@@ -1047,9 +1047,9 @@ static int default_journal_size(unsigned bsize, uint64_t num_blocks)
 	return 262144;                          /*   1 GB */
 }
 
-static int sbd_init(struct gfs2_sbd *sdp, struct mkfs_opts *opts, unsigned bsize)
+static int sbd_init(struct lgfs2_sbd *sdp, struct mkfs_opts *opts, unsigned bsize)
 {
-	memset(sdp, 0, sizeof(struct gfs2_sbd));
+	memset(sdp, 0, sizeof(struct lgfs2_sbd));
 	sdp->sd_time = time(NULL);
 	sdp->rgtree.osi_node = NULL;
 	sdp->rgsize = opts->rgsize;
@@ -1197,7 +1197,7 @@ static int open_dev(struct mkfs_dev *dev, int withprobe)
 int main(int argc, char *argv[])
 {
 	struct gfs2_statfs_change sc;
-	struct gfs2_sbd sbd;
+	struct lgfs2_sbd sbd;
 	struct mkfs_opts opts;
 	struct lgfs2_inode *ip;
 	lgfs2_rgrps_t rgs;
tests/nukerg.c +5 -5
index e24151ef..a4c25a81 100644
@@ -177,7 +177,7 @@ static int opts_get(int argc, char *argv[], struct opts *opts)
 	return 0;
 }
 
-static int nuke_rgs(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, unsigned *rgnums, size_t count)
+static int nuke_rgs(struct lgfs2_sbd *sdp, lgfs2_rgrps_t rgs, unsigned *rgnums, size_t count)
 {
 	struct gfs2_rgrp blankrg;
 	lgfs2_rgrp_t rg;
@@ -211,7 +211,7 @@ static int nuke_rgs(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, unsigned *rgnums, s
 	return 0;
 }
 
-static int nuke_ris(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, unsigned *rinums, size_t count)
+static int nuke_ris(struct lgfs2_sbd *sdp, lgfs2_rgrps_t rgs, unsigned *rinums, size_t count)
 {
 	struct gfs2_rindex blankri;
 	lgfs2_rgrp_t rg;
@@ -244,7 +244,7 @@ static int nuke_ris(struct gfs2_sbd *sdp, lgfs2_rgrps_t rgs, unsigned *rinums, s
 	return 0;
 }
 
-static lgfs2_rgrps_t read_rindex(struct gfs2_sbd *sdp)
+static lgfs2_rgrps_t read_rindex(struct lgfs2_sbd *sdp)
 {
 	lgfs2_rgrps_t rgs;
 	unsigned rgcount;
@@ -276,7 +276,7 @@ static lgfs2_rgrps_t read_rindex(struct gfs2_sbd *sdp)
 	return rgs;
 }
 
-static int fill_super_block(struct gfs2_sbd *sdp)
+static int fill_super_block(struct lgfs2_sbd *sdp)
 {
 	sdp->sd_bsize = GFS2_BASIC_BLOCK;
 
@@ -298,7 +298,7 @@ static int fill_super_block(struct gfs2_sbd *sdp)
 
 int main(int argc, char **argv)
 {
-	struct gfs2_sbd sbd;
+	struct lgfs2_sbd sbd;
 	lgfs2_rgrps_t rgs;
 	struct opts opts;
 	int ret;
Signature · 1 line
2.34.1
#16 lore raw

PATCH 16/21 libgfs2: Namespace improvements - struct metapath

In reply to Andrew Price

Rename to struct lgfs2_metapath.

---
 gfs2/convert/gfs2_convert.c | 14 +++++++-------
 gfs2/edit/extended.c        |  4 ++--
 gfs2/edit/hexedit.c         |  4 ++--
 gfs2/edit/hexedit.h         |  4 ++--
 gfs2/libgfs2/fs_ops.c       | 12 ++++++------
 gfs2/libgfs2/gfs1.c         |  6 +++---
 gfs2/libgfs2/libgfs2.h      |  8 ++++----
 7 files changed, 26 insertions(+), 26 deletions(-)
gfs2/convert/gfs2_convert.c +7 -7
index e1c6a3c6..f6c7d3a7 100644
@@ -82,7 +82,7 @@ struct inode_block {
 struct blocklist {
 	osi_list_t list;
 	uint64_t block;
-	struct metapath mp;
+	struct lgfs2_metapath mp;
 	int height;
 	char *ptrbuf;
 };
@@ -219,7 +219,7 @@ static unsigned int calc_gfs2_tree_height(struct lgfs2_inode *ip, uint64_t size)
 /* mp_gfs1_to_gfs2 - convert a gfs1 metapath to a gfs2 metapath.             */
 /* ------------------------------------------------------------------------- */
 static void mp_gfs1_to_gfs2(struct lgfs2_sbd *sbp, int gfs1_h, int gfs2_h,
-		     struct metapath *gfs1mp, struct metapath *gfs2mp)
+		     struct lgfs2_metapath *gfs1mp, struct lgfs2_metapath *gfs2mp)
 {
 	uint64_t lblock;
 	int h;
@@ -378,7 +378,7 @@ static void fix_metatree(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip,
 /* ------------------------------------------------------------------------- */
 
 static void jdata_mp_gfs1_to_gfs2(struct lgfs2_sbd *sbp, int gfs1_h, int gfs2_h,
-			   struct metapath *gfs1mp, struct metapath *gfs2mp,
+			   struct lgfs2_metapath *gfs1mp, struct lgfs2_metapath *gfs2mp,
 			   unsigned int *len, uint64_t dinode_size)
 {
 	uint64_t offset;
@@ -575,7 +575,7 @@ static int fix_ind_reg_or_dir(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip, uin
 	unsigned int len, bufsize;
 	__be64 *ptr1, *ptr2;
 	int ptrnum;
-	struct metapath gfs2mp;
+	struct lgfs2_metapath gfs2mp;
 
 	bufsize = sbp->sd_bsize - sizeof(struct gfs_indirect);
 	len = bufsize;
@@ -601,7 +601,7 @@ static int fix_ind_reg_or_dir(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip, uin
 	}
 	blk->mp.mp_list[di_height - 1] = ptrnum;
 	mp_gfs1_to_gfs2(sbp, di_height, gfs2_hgt, &blk->mp, &gfs2mp);
-	memcpy(&blk->mp, &gfs2mp, sizeof(struct metapath));
+	memcpy(&blk->mp, &gfs2mp, sizeof(struct lgfs2_metapath));
 	blk->height -= di_height - gfs2_hgt;
 	if (len) {
 		fix_metatree(sbp, ip, blk, ptr1, len);
@@ -621,7 +621,7 @@ static int fix_ind_jdata(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t
 	uint64_t block;
 	__be64 *ptr1;
 	int ptrnum, h;
-	struct metapath gfs2mp;
+	struct lgfs2_metapath gfs2mp;
 	struct lgfs2_buffer_head *bh;
 
 	bufsize = sbp->sd_bsize - sizeof(struct gfs2_meta_header);
@@ -670,7 +670,7 @@ static int fix_ind_jdata(struct lgfs2_sbd *sbp, struct lgfs2_inode *ip, uint32_t
 		len = bufsize;
 		jdata_mp_gfs1_to_gfs2(sbp, di_height, gfs2_hgt, &newblk->mp, &gfs2mp,
 				      &len, dinode_size);
-		memcpy(&newblk->mp, &gfs2mp, sizeof(struct metapath));
+		memcpy(&newblk->mp, &gfs2mp, sizeof(struct lgfs2_metapath));
 		newblk->height -= di_height - gfs2_hgt;
 		if (len)
 			ip->i_goal_meta = fix_jdatatree(sbp, ip, newblk,
gfs2/edit/extended.c +2 -2
index 98c0dfce..81548939 100644
@@ -97,7 +97,7 @@ static int dinode_valid(void)
 	return 0;
 }
 
-static uint64_t metapath_to_lblock(struct metapath *mp, int hgt)
+static uint64_t metapath_to_lblock(struct lgfs2_metapath *mp, int hgt)
 {
 	int h;
 	uint64_t lblock = 0;
@@ -401,7 +401,7 @@ static void print_block_details(struct iinfo *ind, int level, int cur_height,
 			for (x = 0; x < 512; x++) {
 				memcpy(&more_indir->ii[x].mp,
 				       &ind->ii[pndx].mp,
-				       sizeof(struct metapath));
+				       sizeof(struct lgfs2_metapath));
 				more_indir->ii[x].mp.mp_list[cur_height+1] = x;
 			}
 			more_ind = _do_indirect_extended(tmpbuf, more_indir,
gfs2/edit/hexedit.c +2 -2
index 4eb1a839..17ed5062 100644
@@ -1032,7 +1032,7 @@ int display(int identify_only, int trunc_zeros, uint64_t flagref,
 			for (i = 0; i < 512; i++)
 				memcpy(&indirect->ii[i].mp,
 				       &blockstack[blockhist - 1].mp,
-				       sizeof(struct metapath));
+				       sizeof(struct lgfs2_metapath));
 		}
 		indirect_blocks = do_indirect_extended(bh->b_data, indirect);
 	}
@@ -1091,7 +1091,7 @@ static void push_block(uint64_t blk)
 		if (edit_row[dmode] >= 0 && !block_is_rindex(block))
 			memcpy(&blockstack[bhst].mp,
 			       &indirect->ii[edit_row[dmode]].mp,
-			       sizeof(struct metapath));
+			       sizeof(struct lgfs2_metapath));
 		blockhist++;
 		blockstack[blockhist % BLOCK_STACK_SIZE].block = blk;
 	}
gfs2/edit/hexedit.h +2 -2
index d45fae2b..6b7e66e1 100644
@@ -78,7 +78,7 @@ struct indirect_info {
 	uint64_t block;
 	uint32_t dirents;
 	struct gfs2_leaf lf;
-	struct metapath mp;
+	struct lgfs2_metapath mp;
 	struct idirent dirent[64];
 	uint64_t ptroff;
 };
@@ -96,7 +96,7 @@ struct blkstack_info {
 	int edit_col[DMODES];
 	enum dsp_mode dmode;
 	int gfs2_struct_type;
-	struct metapath mp;
+	struct lgfs2_metapath mp;
 };
 
 extern struct blkstack_info blockstack[BLOCK_STACK_SIZE];
gfs2/libgfs2/fs_ops.c +6 -6
index f485860a..0f94c09b 100644
@@ -16,7 +16,7 @@
 
 static __inline__ __be64 *metapointer(char *buf,
 					unsigned int height,
-					struct metapath *mp)
+					struct lgfs2_metapath *mp)
 {
 	unsigned int head_size = (height > 0) ?
 		sizeof(struct gfs2_meta_header) : sizeof(struct gfs2_dinode);
@@ -423,12 +423,12 @@ void lgfs2_build_height(struct lgfs2_inode *ip, int height)
 	}
 }
 
-void lgfs2_find_metapath(struct lgfs2_inode *ip, uint64_t block, struct metapath *mp)
+void lgfs2_find_metapath(struct lgfs2_inode *ip, uint64_t block, struct lgfs2_metapath *mp)
 {
 	const uint32_t inptrs = ip->i_sbd->sd_inptrs;
 	unsigned int i = ip->i_height;
 
-	memset(mp, 0, sizeof(struct metapath));
+	memset(mp, 0, sizeof(struct lgfs2_metapath));
 	while (i--) {
 		mp->mp_list[i] = block % inptrs;
 		block /= inptrs;
@@ -436,7 +436,7 @@ void lgfs2_find_metapath(struct lgfs2_inode *ip, uint64_t block, struct metapath
 }
 
 void lgfs2_lookup_block(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
-                        unsigned int height, struct metapath *mp,
+                        unsigned int height, struct lgfs2_metapath *mp,
                         int create, int *new, uint64_t *block)
 {
 	__be64 *ptr = metapointer(bh->b_data, height, mp);
@@ -466,7 +466,7 @@ void lgfs2_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
 {
 	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct lgfs2_buffer_head *bh;
-	struct metapath mp;
+	struct lgfs2_metapath mp;
 	int create = *new;
 	unsigned int bsize;
 	unsigned int height;
@@ -1437,7 +1437,7 @@ static void lgfs2_fill_indir(char *start, char *end, uint64_t ptr0, unsigned n,
 int lgfs2_write_filemeta(struct lgfs2_inode *ip)
 {
 	unsigned height = 0;
-	struct metapath mp;
+	struct lgfs2_metapath mp;
 	struct lgfs2_sbd *sdp = ip->i_sbd;
 	uint64_t dblocks = (ip->i_size + sdp->sd_bsize - 1) / sdp->sd_bsize;
 	uint64_t ptr0 = ip->i_num.in_addr + 1;
gfs2/libgfs2/gfs1.c +3 -3
index 0079021b..c6ad8dbe 100644
@@ -23,7 +23,7 @@ static __inline__ int fs_is_jdata(struct lgfs2_inode *ip)
 }
 
 static __inline__ __be64 *
-gfs1_metapointer(char *buf, unsigned int height, struct metapath *mp)
+gfs1_metapointer(char *buf, unsigned int height, struct lgfs2_metapath *mp)
 {
 	unsigned int head_size = (height > 0) ?
 		sizeof(struct gfs_indirect) : sizeof(struct gfs_dinode);
@@ -39,7 +39,7 @@ int lgfs2_is_gfs_dir(struct lgfs2_inode *ip)
 }
 
 void lgfs2_gfs1_lookup_block(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
-		  unsigned int height, struct metapath *mp,
+		  unsigned int height, struct lgfs2_metapath *mp,
 		  int create, int *new, uint64_t *block)
 {
 	__be64 *ptr = gfs1_metapointer(bh->b_data, height, mp);
@@ -72,7 +72,7 @@ void lgfs2_gfs1_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
 {
 	struct lgfs2_sbd *sdp = ip->i_sbd;
 	struct lgfs2_buffer_head *bh;
-	struct metapath mp;
+	struct lgfs2_metapath mp;
 	int create = *new;
 	unsigned int bsize;
 	unsigned int height;
gfs2/libgfs2/libgfs2.h +4 -4
index 98e8b8ce..00deb455 100644
@@ -412,7 +412,7 @@ struct lgfs2_leaf {
 	uint64_t lf_sec;
 };
 
-struct metapath {
+struct lgfs2_metapath {
 	unsigned int mp_list[GFS2_MAX_META_HEIGHT];
 };
 
@@ -494,9 +494,9 @@ extern int lgfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
 #define IS_LEAF     (1)
 #define IS_DINODE   (2)
 
-extern void lgfs2_find_metapath(struct lgfs2_inode *ip, uint64_t block, struct metapath *mp);
+extern void lgfs2_find_metapath(struct lgfs2_inode *ip, uint64_t block, struct lgfs2_metapath *mp);
 extern void lgfs2_lookup_block(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
-			 unsigned int height, struct metapath *mp,
+			 unsigned int height, struct lgfs2_metapath *mp,
 			 int create, int *new, uint64_t *block);
 extern struct lgfs2_inode *lgfs2_inode_get(struct lgfs2_sbd *sdp,
 				    struct lgfs2_buffer_head *bh);
@@ -710,7 +710,7 @@ struct gfs_log_descriptor {
 extern int lgfs2_is_gfs_dir(struct lgfs2_inode *ip);
 extern void lgfs2_gfs1_lookup_block(struct lgfs2_inode *ip,
 			      struct lgfs2_buffer_head *bh,
-			      unsigned int height, struct metapath *mp,
+			      unsigned int height, struct lgfs2_metapath *mp,
 			      int create, int *new, uint64_t *block);
 extern void lgfs2_gfs1_block_map(struct lgfs2_inode *ip, uint64_t lblock, int *new,
 			   uint64_t *dblock, uint32_t *extlen, int prealloc);
Signature · 1 line
2.34.1
#17 lore raw

PATCH 17/21 libgfs2: Namespace improvements - struct master_dir

In reply to Andrew Price

Rename to struct lgfs2_meta_dir.

---
 gfs2/fsck/initialize.c | 2 +-
 gfs2/libgfs2/libgfs2.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
gfs2/fsck/initialize.c +1 -1
index 2bde52ab..ec9a8eef 100644
@@ -32,7 +32,7 @@
 
 static int was_mounted_ro = 0;
 static uint64_t possible_root = HIGHEST_BLOCK;
-static struct master_dir fix_md;
+static struct lgfs2_meta_dir fix_md;
 static uint64_t blks_2free = 0;
 
 /**
gfs2/libgfs2/libgfs2.h +2 -2
index 00deb455..3673182b 100644
@@ -300,7 +300,7 @@ struct lgfs2_inode {
 	};
 };
 
-struct master_dir
+struct lgfs2_meta_dir
 {
 	struct lgfs2_inode *inum;
 	uint64_t next_inum;
@@ -375,7 +375,7 @@ struct lgfs2_sbd {
 	struct osi_root rgtree;
 
 	struct lgfs2_inode *master_dir;
-	struct master_dir md;
+	struct lgfs2_meta_dir md;
 
 	unsigned int gfs1:1;
 };
Signature · 1 line
2.34.1
#18 lore raw

PATCH 18/21 libgfs2: Namespace improvements - struct device

In reply to Andrew Price

Rename to struct lgfs2_device.

---
 gfs2/fsck/rgrepair.c           | 4 ++--
 gfs2/libgfs2/device_geometry.c | 2 +-
 gfs2/libgfs2/libgfs2.h         | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
gfs2/fsck/rgrepair.c +2 -2
index 5bfbb7da..b74eaa4a 100644
@@ -696,7 +696,7 @@ out:
  *
  * Returns: the number of RGs
  */
-static uint64_t how_many_rgrps(struct lgfs2_sbd *sdp, struct device *dev)
+static uint64_t how_many_rgrps(struct lgfs2_sbd *sdp, struct lgfs2_device *dev)
 {
 	uint64_t nrgrp;
 	uint32_t rgblocks1, rgblocksn, bitblocks1, bitblocksn;
@@ -732,7 +732,7 @@ static uint64_t how_many_rgrps(struct lgfs2_sbd *sdp, struct device *dev)
  */
 static struct osi_root compute_rgrp_layout(struct lgfs2_sbd *sdp)
 {
-	struct device *dev;
+	struct lgfs2_device *dev;
 	struct rgrp_tree *rl, *rlast = NULL;
 	unsigned int rgrp = 0, nrgrp, rglength;
 	struct osi_root rgtree = {NULL};
gfs2/libgfs2/device_geometry.c +1 -1
index c6c00c95..1950d017 100644
@@ -94,7 +94,7 @@ size_check:
 
 void lgfs2_fix_device_geometry(struct lgfs2_sbd *sdp)
 {
-	struct device *device = &sdp->device;
+	struct lgfs2_device *device = &sdp->device;
 
 	device->length = sdp->dinfo.size / sdp->sd_bsize;
 }
gfs2/libgfs2/libgfs2.h +2 -2
index 3673182b..2fc831e4 100644
@@ -156,7 +156,7 @@ struct lgfs2_dev_info {
 	uint64_t size;
 };
 
-struct device {
+struct lgfs2_device {
 	uint64_t length;
 };
 
@@ -361,7 +361,7 @@ struct lgfs2_sbd {
 	int64_t sd_time;
 
 	struct lgfs2_dev_info dinfo;
-	struct device device;
+	struct lgfs2_device device;
 
 	int device_fd;
 	int path_fd;
Signature · 1 line
2.34.1
#19 lore raw

PATCH 19/21 libgfs2: Namespace improvements - struct gfs2_bitmap

In reply to Andrew Price

Rename to struct lgfs2_bitmap.

---
 gfs2/convert/gfs2_convert.c |  6 +++---
 gfs2/edit/hexedit.c         |  2 +-
 gfs2/fsck/pass5.c           |  2 +-
 gfs2/libgfs2/fs_bits.c      |  4 ++--
 gfs2/libgfs2/fs_ops.c       |  2 +-
 gfs2/libgfs2/libgfs2.h      |  4 ++--
 gfs2/libgfs2/rgrp.c         | 12 ++++++------
 gfs2/libgfs2/rgrp.h         |  2 +-
 gfs2/libgfs2/structures.c   |  2 +-
 9 files changed, 18 insertions(+), 18 deletions(-)
gfs2/convert/gfs2_convert.c +3 -3
index f6c7d3a7..50df7f5f 100644
@@ -126,7 +126,7 @@ static void convert_bitmaps(struct lgfs2_sbd *sdp, struct rgrp_tree *rg)
 	unsigned char state;
 
 	for (blk = 0; blk < rg->rt_length; blk++) {
-		struct gfs2_bitmap *bi;
+		struct lgfs2_bitmap *bi;
 		x = (blk) ? sizeof(struct gfs2_meta_header) :
 			sizeof(struct gfs2_rgrp);
 
@@ -951,7 +951,7 @@ err_freei:
 
 static int next_rg_meta(struct rgrp_tree *rgd, uint64_t *block, int first)
 {
-	struct gfs2_bitmap *bits = NULL;
+	struct lgfs2_bitmap *bits = NULL;
 	uint32_t length = rgd->rt_length;
 	uint32_t blk = (first)? 0: (uint32_t)((*block + 1) - rgd->rt_data0);
 	int i;
@@ -1070,7 +1070,7 @@ static int inode_renumber(struct lgfs2_sbd *sbp, uint64_t root_inode_addr, osi_l
 				byte_bit = (block - rgd->rt_data0) % GFS2_NBBY;
 				/* Now figure out which bitmap block the byte is on */
 				for (blk = 0; blk < rgd->rt_length; blk++) {
-					struct gfs2_bitmap *bi = &rgd->bits[blk];
+					struct lgfs2_bitmap *bi = &rgd->bits[blk];
 					/* figure out offset of first bitmap byte for this map: */
 					buf_offset = (blk) ? sizeof(struct gfs2_meta_header) :
 						sizeof(struct gfs2_rgrp);
gfs2/edit/hexedit.c +1 -1
index 17ed5062..90140391 100644
@@ -1610,7 +1610,7 @@ static void find_print_block_rg(int bitmap)
 		if (rgd) {
 			rgblock = rgd->rt_addr;
 			if (bitmap) {
-				struct gfs2_bitmap *bits = NULL;
+				struct lgfs2_bitmap *bits = NULL;
 
 				for (i = 0; i < rgd->rt_length; i++) {
 					bits = &(rgd->bits[i]);
gfs2/fsck/pass5.c +1 -1
index 55ede8db..302ebaf2 100644
@@ -117,7 +117,7 @@ static void update_rgrp(struct lgfs2_sbd *sdp, struct rgrp_tree *rgp,
 			struct gfs2_bmap *bl, uint32_t *count)
 {
 	uint32_t i;
-	struct gfs2_bitmap *bits;
+	struct lgfs2_bitmap *bits;
 	uint64_t rg_block = 0;
 	int update = 0;
 
gfs2/libgfs2/fs_bits.c +2 -2
index b95732ef..a75c1aa5 100644
@@ -127,7 +127,7 @@ int lgfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
 {
 	int           buf;
 	uint32_t        rgrp_block;
-	struct gfs2_bitmap *bits = NULL;
+	struct lgfs2_bitmap *bits = NULL;
 	unsigned char *byte, cur_state;
 	unsigned int bit;
 
@@ -180,7 +180,7 @@ int lgfs2_get_bitmap(struct lgfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rg
 	uint32_t i = 0;
 	char *byte;
 	unsigned int bit;
-	struct gfs2_bitmap *bi;
+	struct lgfs2_bitmap *bi;
 
 	if (rgd == NULL) {
 		rgd = lgfs2_blk2rgrpd(sdp, blkno);
gfs2/libgfs2/fs_ops.c +1 -1
index 0f94c09b..9083b811 100644
@@ -119,7 +119,7 @@ static uint64_t find_free_block(struct rgrp_tree *rgd)
 
 	for (bm = 0; bm < rgd->rt_length; bm++) {
 		unsigned long blk = 0;
-		struct gfs2_bitmap *bits = &rgd->bits[bm];
+		struct lgfs2_bitmap *bits = &rgd->bits[bm];
 
 		blk = lgfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
 		                  bits->bi_len, blk, GFS2_BLKST_FREE);
gfs2/libgfs2/libgfs2.h +2 -2
index 2fc831e4..1fc04926 100644
@@ -160,7 +160,7 @@ struct lgfs2_device {
 	uint64_t length;
 };
 
-struct gfs2_bitmap
+struct lgfs2_bitmap
 {
 	char *bi_data;
 	uint32_t bi_offset;  /* The offset in the buffer of the first byte */
@@ -175,7 +175,7 @@ typedef struct _lgfs2_rgrps *lgfs2_rgrps_t;
 
 struct rgrp_tree {
 	struct osi_node node;
-	struct gfs2_bitmap *bits;
+	struct lgfs2_bitmap *bits;
 	lgfs2_rgrps_t rgrps;
 
 	/* Native-endian counterparts of the on-disk rindex struct */
gfs2/libgfs2/rgrp.c +6 -6
index 9ca92172..3ae490e8 100644
@@ -52,7 +52,7 @@ int lgfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd)
 		return -1;
 
 	if(rgd->bits == NULL) {
-		rgd->bits = calloc(length, sizeof(struct gfs2_bitmap));
+		rgd->bits = calloc(length, sizeof(struct lgfs2_bitmap));
 		if(rgd->bits == NULL)
 			return -1;
 		ownbits = 1;
@@ -635,11 +635,11 @@ lgfs2_rgrp_t lgfs2_rgrps_append(lgfs2_rgrps_t rgs, struct gfs2_rindex *entry, ui
 		link = &lastrg->node.osi_right;
 	}
 
-	rg = calloc(1, sizeof(*rg) + (be32_to_cpu(entry->ri_length) * sizeof(struct gfs2_bitmap)));
+	rg = calloc(1, sizeof(*rg) + (be32_to_cpu(entry->ri_length) * sizeof(struct lgfs2_bitmap)));
 	if (rg == NULL)
 		return NULL;
 
-	rg->bits = (struct gfs2_bitmap *)(rg + 1);
+	rg->bits = (struct lgfs2_bitmap *)(rg + 1);
 
 	osi_link_node(&rg->node, parent, link);
 	osi_insert_color(&rg->node, &rgs->root);
@@ -807,7 +807,7 @@ static int lgfs2_rbm_incr(struct lgfs2_rbm *rbm)
  */
 static inline uint8_t lgfs2_testbit(const struct lgfs2_rbm *rbm)
 {
-	struct gfs2_bitmap *bi = rbm_bi(rbm);
+	struct lgfs2_bitmap *bi = rbm_bi(rbm);
 	const uint8_t *buffer = (uint8_t *)bi->bi_data + bi->bi_offset;
 	const uint8_t *byte;
 	unsigned int bit;
@@ -879,7 +879,7 @@ static uint32_t lgfs2_free_extlen(const struct lgfs2_rbm *rrbm, uint32_t len)
 	uint32_t chunk_size;
 	uint8_t *ptr, *start, *end;
 	uint64_t block;
-	struct gfs2_bitmap *bi;
+	struct lgfs2_bitmap *bi;
 	struct lgfs2_sbd *sdp = rbm.rgd->rgrps->sdp;
 
 	if (n_unaligned &&
@@ -943,7 +943,7 @@ int lgfs2_rbm_find(struct lgfs2_rbm *rbm, uint8_t state, uint32_t *minext)
 		iters++;
 
 	for (n = 0; n < iters; n++) {
-		struct gfs2_bitmap *bi = rbm_bi(rbm);
+		struct lgfs2_bitmap *bi = rbm_bi(rbm);
 		uint8_t *buf = (uint8_t *)bi->bi_data + bi->bi_offset;
 		uint64_t block;
 		int ret;
gfs2/libgfs2/rgrp.h +1 -1
index 423eaefc..f23f25a3 100644
@@ -34,7 +34,7 @@ struct lgfs2_rbm {
 	unsigned bii;       /* Bitmap index */
 };
 
-static inline struct gfs2_bitmap *rbm_bi(const struct lgfs2_rbm *rbm)
+static inline struct lgfs2_bitmap *rbm_bi(const struct lgfs2_rbm *rbm)
 {
 	return rbm->rgd->bits + rbm->bii;
 }
gfs2/libgfs2/structures.c +1 -1
index 011fe8ac..d67c1fc0 100644
@@ -499,7 +499,7 @@ int lgfs2_check_meta(const char *buf, int type)
 
 unsigned lgfs2_bm_scan(struct rgrp_tree *rgd, unsigned idx, uint64_t *buf, uint8_t state)
 {
-	struct gfs2_bitmap *bi = &rgd->bits[idx];
+	struct lgfs2_bitmap *bi = &rgd->bits[idx];
 	unsigned n = 0;
 	uint32_t blk = 0;
 
Signature · 1 line
2.34.1
#20 lore raw

PATCH 20/21 libgfs2: Namespace improvements - constants

In reply to Andrew Price

Use the LGFS2_ prefix for preprocessor #defines.

---
 gfs2/convert/gfs2_convert.c | 12 ++++++------
 gfs2/edit/hexedit.c         | 12 ++++++------
 gfs2/fsck/fs_recovery.c     |  4 ++--
 gfs2/fsck/initialize.c      | 20 ++++++++++----------
 gfs2/fsck/rgrepair.c        |  6 +++---
 gfs2/libgfs2/fs_bits.c      |  2 +-
 gfs2/libgfs2/fs_ops.c       | 12 ++++++------
 gfs2/libgfs2/libgfs2.h      | 29 +++++++++++++----------------
 gfs2/libgfs2/rgrp.c         |  6 +++---
 gfs2/libgfs2/structures.c   |  2 +-
 gfs2/libgfs2/super.c        |  4 ++--
 gfs2/mkfs/main_grow.c       | 10 +++++-----
 gfs2/mkfs/main_jadd.c       |  4 ++--
 gfs2/mkfs/main_mkfs.c       | 24 ++++++++++++------------
 gfs2/tune/super.c           |  6 +++---
 15 files changed, 75 insertions(+), 78 deletions(-)
gfs2/convert/gfs2_convert.c +6 -6
index 50df7f5f..104f9812 100644
@@ -970,7 +970,7 @@ static int next_rg_meta(struct rgrp_tree *rgd, uint64_t *block, int first)
 		bits = &rgd->bits[i];
 		blk = lgfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
 		                   bits->bi_len, blk, GFS2_BLKST_DINODE);
-		if(blk != BFITNOENT){
+		if(blk != LGFS2_BFITNOENT){
 			*block = blk + (bits->bi_start * GFS2_NBBY) + rgd->rt_data0;
 			break;
 		}
@@ -1132,7 +1132,7 @@ static int process_dirent_info(struct lgfs2_inode *dip, struct lgfs2_sbd *sbp,
 	int de; /* directory entry index */
 	
 	error = lgfs2_dirent_first(dip, bh, &dent);
-	if (error != IS_LEAF && error != IS_DINODE) {
+	if (error != LGFS2_IS_LEAF && error != LGFS2_IS_DINODE) {
 		log_crit(_("Error retrieving directory.\n"));
 		return -1;
 	}
@@ -1576,14 +1576,14 @@ static int init(struct lgfs2_sbd *sbp, struct gfs2_options *opts)
 	/* ---------------------------------------------- */
 	/* Initialize lists and read in the superblock.   */
 	/* ---------------------------------------------- */
-	sbp->jsize = GFS2_DEFAULT_JSIZE;
-	sbp->rgsize = GFS2_DEFAULT_RGSIZE;
-	sbp->qcsize = GFS2_DEFAULT_QCSIZE;
+	sbp->jsize = LGFS2_DEFAULT_JSIZE;
+	sbp->rgsize = LGFS2_DEFAULT_RGSIZE;
+	sbp->qcsize = LGFS2_DEFAULT_QCSIZE;
 	sbp->sd_time = time(NULL);
 	sbp->blks_total = 0;   /* total blocks         - total them up later */
 	sbp->blks_alloced = 0; /* blocks allocated     - total them up later */
 	sbp->dinodes_alloced = 0; /* dinodes allocated - total them up later */
-	sbp->sd_bsize = GFS2_DEFAULT_BSIZE;
+	sbp->sd_bsize = LGFS2_DEFAULT_BSIZE;
 	sbp->rgtree.osi_node = NULL;
 	if (lgfs2_compute_constants(sbp)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
gfs2/edit/hexedit.c +6 -6
index 90140391..9a90587f 100644
@@ -874,12 +874,12 @@ static void read_superblock(int fd)
 
 	ioctl(fd, BLKFLSBUF, 0);
 	memset(&sbd, 0, sizeof(struct lgfs2_sbd));
-	sbd.sd_bsize = GFS2_DEFAULT_BSIZE;
+	sbd.sd_bsize = LGFS2_DEFAULT_BSIZE;
 	sbd.device_fd = fd;
 	bh = lgfs2_bread(&sbd, 0x10);
-	sbd.jsize = GFS2_DEFAULT_JSIZE;
-	sbd.rgsize = GFS2_DEFAULT_RGSIZE;
-	sbd.qcsize = GFS2_DEFAULT_QCSIZE;
+	sbd.jsize = LGFS2_DEFAULT_JSIZE;
+	sbd.rgsize = LGFS2_DEFAULT_RGSIZE;
+	sbd.qcsize = LGFS2_DEFAULT_QCSIZE;
 	sbd.sd_time = time(NULL);
 	sbd.rgtree.osi_node = NULL;
 	lgfs2_sb_in(&sbd, bh->b_data);
@@ -894,7 +894,7 @@ static void read_superblock(int fd)
 	else
 		sbd.gfs1 = FALSE;
 	if (!sbd.sd_bsize)
-		sbd.sd_bsize = GFS2_DEFAULT_BSIZE;
+		sbd.sd_bsize = LGFS2_DEFAULT_BSIZE;
 	if (lgfs2_get_dev_info(fd, &sbd.dinfo)) {
 		perror(device);
 		exit(-1);
@@ -905,7 +905,7 @@ static void read_superblock(int fd)
 	}
 	if (sbd.gfs1 || (be32_to_cpu(mh->mh_magic) == GFS2_MAGIC &&
 	                 be32_to_cpu(mh->mh_type) == GFS2_METATYPE_SB))
-		block = 0x10 * (GFS2_DEFAULT_BSIZE / sbd.sd_bsize);
+		block = 0x10 * (LGFS2_DEFAULT_BSIZE / sbd.sd_bsize);
 	else {
 		block = starting_blk = 0;
 	}
gfs2/fsck/fs_recovery.c +2 -2
index 45bd213a..f65c4a33 100644
@@ -683,7 +683,7 @@ int replay_journals(struct lgfs2_sbd *sdp, int preen, int force_check,
 
 	*clean_journals = 0;
 
-	sdp->jsize = GFS2_DEFAULT_JSIZE;
+	sdp->jsize = LGFS2_DEFAULT_JSIZE;
 
 	for(i = 0; i < sdp->md.journals; i++) {
 		if (sdp->md.journal[i]) {
@@ -704,7 +704,7 @@ int replay_journals(struct lgfs2_sbd *sdp, int preen, int force_check,
 		if (!error) {
 			uint64_t jsize = sdp->md.journal[i]->i_size / (1024 * 1024);
 
-			if (sdp->jsize == GFS2_DEFAULT_JSIZE && jsize &&
+			if (sdp->jsize == LGFS2_DEFAULT_JSIZE && jsize &&
 			    jsize != sdp->jsize)
 				sdp->jsize = jsize;
 			error = gfs2_recover_journal(sdp->md.journal[i], i,
gfs2/fsck/initialize.c +10 -10
index ec9a8eef..8957ddf9 100644
@@ -1130,14 +1130,14 @@ static int find_rgs_for_bsize(struct lgfs2_sbd *sdp, uint64_t startblock,
 	uint32_t bsize, bsize2;
 	int found_rg;
 
-	sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
+	sdp->sd_bsize = LGFS2_DEFAULT_BSIZE;
 	max_rg_size = 524288;
 	/* Max RG size is 2GB. Max block size is 4K. 2G / 4K blks = 524288,
 	   So this is traversing 2GB in 4K block increments. */
 	for (blk = startblock; blk < startblock + max_rg_size; blk++) {
 		bh = lgfs2_bread(sdp, blk);
 		found_rg = 0;
-		for (bsize = 0; bsize < GFS2_DEFAULT_BSIZE; bsize += GFS2_BASIC_BLOCK) {
+		for (bsize = 0; bsize < LGFS2_DEFAULT_BSIZE; bsize += GFS2_BASIC_BLOCK) {
 			struct gfs2_meta_header *mhp;
 
 			mhp = (struct gfs2_meta_header *)(bh->b_data + bsize);
@@ -1151,13 +1151,13 @@ static int find_rgs_for_bsize(struct lgfs2_sbd *sdp, uint64_t startblock,
 		if (!found_rg)
 			continue;
 		/* Try all the block sizes in 512 byte multiples */
-		for (bsize2 = GFS2_BASIC_BLOCK; bsize2 <= GFS2_DEFAULT_BSIZE;
+		for (bsize2 = GFS2_BASIC_BLOCK; bsize2 <= LGFS2_DEFAULT_BSIZE;
 		     bsize2 += GFS2_BASIC_BLOCK) {
 			struct gfs2_meta_header *mh;
 			int is_rb;
 
 			rb_addr = (bh->b_blocknr *
-				   (GFS2_DEFAULT_BSIZE / bsize2)) +
+				   (LGFS2_DEFAULT_BSIZE / bsize2)) +
 				(bsize / bsize2) + 1;
 			sdp->sd_bsize = bsize2; /* temporarily */
 			rb_bh = lgfs2_bread(sdp, rb_addr);
@@ -1175,7 +1175,7 @@ static int find_rgs_for_bsize(struct lgfs2_sbd *sdp, uint64_t startblock,
 		}
 		lgfs2_brelse(bh);
 		if (!(*known_bsize)) {
-			sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
+			sdp->sd_bsize = LGFS2_DEFAULT_BSIZE;
 			continue;
 		}
 
@@ -1227,11 +1227,11 @@ static int sb_repair(struct lgfs2_sbd *sdp)
 
 	memset(&fix_md, 0, sizeof(fix_md));
 	/* Step 1 - First we need to determine the correct block size. */
-	sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
+	sdp->sd_bsize = LGFS2_DEFAULT_BSIZE;
 	log_warn(_("Gathering information to repair the gfs2 superblock.  "
 		   "This may take some time.\n"));
 	error = find_rgs_for_bsize(sdp, (GFS2_SB_ADDR * GFS2_BASIC_BLOCK) /
-				   GFS2_DEFAULT_BSIZE, &known_bsize);
+				   LGFS2_DEFAULT_BSIZE, &known_bsize);
 	if (error)
 		return error;
 	if (!known_bsize) {
@@ -1253,7 +1253,7 @@ static int sb_repair(struct lgfs2_sbd *sdp)
 	}
 	/* Step 2 - look for the sytem dinodes */
 	error = peruse_metadata(sdp, (GFS2_SB_ADDR * GFS2_BASIC_BLOCK) /
-				GFS2_DEFAULT_BSIZE);
+				LGFS2_DEFAULT_BSIZE);
 	if (error)
 		return error;
 	if (!sdp->sd_meta_dir.in_addr) {
@@ -1340,7 +1340,7 @@ static int fill_super_block(struct lgfs2_sbd *sdp)
 	log_info( _("Initializing lists...\n"));
 	sdp->rgtree.osi_node = NULL;
 
-	sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
+	sdp->sd_bsize = LGFS2_DEFAULT_BSIZE;
 	if (lgfs2_compute_constants(sdp)) {
 		log_crit("%s\n", _("Failed to compute file system constants"));
 		return FSCK_ERROR;
@@ -1434,7 +1434,7 @@ static int correct_journal_seg_size(struct lgfs2_sbd *sdp)
 	int count;
 	struct gfs_jindex *ji_0, *ji_1;
 	char buf[sizeof(struct gfs_jindex)];
-	unsigned int jsize = GFS2_DEFAULT_JSIZE * 1024 * 1024;
+	unsigned int jsize = LGFS2_DEFAULT_JSIZE * 1024 * 1024;
 
 	count = lgfs2_readi(sdp->md.jiinode, buf, 0, sizeof(struct gfs_jindex));
 	if (count != sizeof(struct gfs_jindex)) {
gfs2/fsck/rgrepair.c +3 -3
index b74eaa4a..2cfc3f5b 100644
@@ -712,9 +712,9 @@ static uint64_t how_many_rgrps(struct lgfs2_sbd *sdp, struct lgfs2_device *dev)
 		if (bitblocks1 <= 2149 && bitblocksn <= 2149)
 			break;
 
-		sdp->rgsize -= GFS2_DEFAULT_RGSIZE; /* smaller rgs */
+		sdp->rgsize -= LGFS2_DEFAULT_RGSIZE; /* smaller rgs */
 
-		if (sdp->rgsize < GFS2_DEFAULT_RGSIZE) {
+		if (sdp->rgsize < LGFS2_DEFAULT_RGSIZE) {
 			log_err(_("Cannot use the entire device with block size %u bytes.\n"),
 			        sdp->sd_bsize);
 			return 0;
@@ -821,7 +821,7 @@ static int gfs2_rindex_calculate(struct lgfs2_sbd *sdp, int *num_rgs)
 	lgfs2_fix_device_geometry(sdp);
 
 	/* Try all possible rgrp sizes: 2048, 1024, 512, 256, 128, 64, 32 */
-	for (sdp->rgsize = GFS2_DEFAULT_RGSIZE; sdp->rgsize >= 32;
+	for (sdp->rgsize = LGFS2_DEFAULT_RGSIZE; sdp->rgsize >= 32;
 	     sdp->rgsize /= 2) {
 		num_rgrps = how_many_rgrps(sdp, &sdp->device);
 		if (num_rgrps == *num_rgs) {
gfs2/libgfs2/fs_bits.c +1 -1
index a75c1aa5..7bcd34b9 100644
@@ -91,7 +91,7 @@ unsigned long lgfs2_bitfit(const unsigned char *buf, const unsigned int len,
 			(64 - 8 * (len & (sizeof(uint64_t) - 1))));
 	/* Didn't find anything, so return */
 	if (tmp == 0)
-		return BFITNOENT;
+		return LGFS2_BFITNOENT;
 	ptr--;
 	bit = ffsll(tmp);
 	bit /= 2;	/* two bits per entry in the bitmap */
gfs2/libgfs2/fs_ops.c +6 -6
index 9083b811..788509f3 100644
@@ -123,7 +123,7 @@ static uint64_t find_free_block(struct rgrp_tree *rgd)
 
 		blk = lgfs2_bitfit((uint8_t *)bits->bi_data + bits->bi_offset,
 		                  bits->bi_len, blk, GFS2_BLKST_FREE);
-		if (blk != BFITNOENT) {
+		if (blk != LGFS2_BFITNOENT) {
 			blkno = blk + (bits->bi_start * GFS2_NBBY) + rgd->rt_data0;
 			break;
 		}
@@ -744,10 +744,10 @@ int lgfs2_dirent_first(struct lgfs2_inode *dip, struct lgfs2_buffer_head *bh,
 
 	if (be32_to_cpu(h->mh_type) == GFS2_METATYPE_LF) {
 		*dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_leaf));
-		return IS_LEAF;
+		return LGFS2_IS_LEAF;
 	} else {
 		*dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_dinode));
-		return IS_DINODE;
+		return LGFS2_IS_DINODE;
 	}
 }
 
@@ -783,7 +783,7 @@ static int dirent_alloc(struct lgfs2_inode *dip, struct lgfs2_buffer_head *bh,
 
 	type = lgfs2_dirent_first(dip, bh, &dent);
 
-	if (type == IS_LEAF) {
+	if (type == LGFS2_IS_LEAF) {
 		struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
 		entries = be16_to_cpu(leaf->lf_entries);
 		offset = sizeof(struct gfs2_leaf);
@@ -1590,10 +1590,10 @@ static int leaf_search(struct lgfs2_inode *dip, struct lgfs2_buffer_head *bh,
 
 	type = lgfs2_dirent_first(dip, bh, &dent);
 
-	if (type == IS_LEAF){
+	if (type == LGFS2_IS_LEAF){
 		struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
 		entries = be16_to_cpu(leaf->lf_entries);
-	} else if (type == IS_DINODE)
+	} else if (type == LGFS2_IS_DINODE)
 		entries = dip->i_entries;
 	else
 		return -1;
gfs2/libgfs2/libgfs2.h +13 -16
index 1fc04926..625fc017 100644
@@ -417,19 +417,16 @@ struct lgfs2_metapath {
 };
 
 
-#define GFS2_DEFAULT_BSIZE          (4096)
-#define GFS2_DEFAULT_JSIZE          (128)
-#define GFS2_MAX_JSIZE              (1024)
-#define GFS2_MIN_JSIZE              (8)
-#define GFS2_DEFAULT_RGSIZE         (256)
-#define GFS2_DEFAULT_UTSIZE         (1)
-#define GFS2_DEFAULT_QCSIZE         (1)
-#define GFS2_DEFAULT_LOCKPROTO      "lock_dlm"
-#define GFS2_MIN_GROW_SIZE          (10)
-#define GFS2_EXCESSIVE_RGS          (10000)
-
-#define GFS2_MIN_RGSIZE             (32)
-#define GFS2_MAX_RGSIZE             (2048)
+#define LGFS2_DEFAULT_BSIZE          (4096)
+#define LGFS2_DEFAULT_JSIZE          (128)
+#define LGFS2_MAX_JSIZE              (1024)
+#define LGFS2_MIN_JSIZE              (8)
+#define LGFS2_DEFAULT_RGSIZE         (256)
+#define LGFS2_DEFAULT_QCSIZE         (1)
+#define LGFS2_DEFAULT_LOCKPROTO      "lock_dlm"
+
+#define LGFS2_MIN_RGSIZE             (32)
+#define LGFS2_MAX_RGSIZE             (2048)
 
 #define LGFS2_FS_FORMAT_MIN (1801)
 #define LGFS2_FS_FORMAT_MAX (1802)
@@ -476,7 +473,7 @@ extern int lgfs2_get_dev_info(int fd, struct lgfs2_dev_info *i);
 extern void lgfs2_fix_device_geometry(struct lgfs2_sbd *sdp);
 
 /* fs_bits.c */
-#define BFITNOENT (0xFFFFFFFF)
+#define LGFS2_BFITNOENT (0xFFFFFFFF)
 
 /* functions with blk #'s that are buffer relative */
 extern unsigned long lgfs2_bitfit(const unsigned char *buffer,
@@ -491,8 +488,8 @@ extern int lgfs2_get_bitmap(struct lgfs2_sbd *sdp, uint64_t blkno, struct rgrp_t
 extern int lgfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
 
 /* fs_ops.c */
-#define IS_LEAF     (1)
-#define IS_DINODE   (2)
+#define LGFS2_IS_LEAF   (1)
+#define LGFS2_IS_DINODE (2)
 
 extern void lgfs2_find_metapath(struct lgfs2_inode *ip, uint64_t block, struct lgfs2_metapath *mp);
 extern void lgfs2_lookup_block(struct lgfs2_inode *ip, struct lgfs2_buffer_head *bh,
gfs2/libgfs2/rgrp.c +3 -3
index 3ae490e8..3ec56f08 100644
@@ -344,8 +344,8 @@ uint32_t lgfs2_rgrp_align_len(const lgfs2_rgrps_t rgs, uint32_t len)
  */
 uint32_t lgfs2_rgrps_plan(const lgfs2_rgrps_t rgs, uint64_t space, uint32_t tgtsize)
 {
-	uint32_t maxlen = (GFS2_MAX_RGSIZE << 20) / rgs->sdp->sd_bsize;
-	uint32_t minlen = (GFS2_MIN_RGSIZE << 20) / rgs->sdp->sd_bsize;
+	uint32_t maxlen = (LGFS2_MAX_RGSIZE << 20) / rgs->sdp->sd_bsize;
+	uint32_t minlen = (LGFS2_MIN_RGSIZE << 20) / rgs->sdp->sd_bsize;
 	struct rg_spec *spec = rgs->plan->rg_specs;
 
 	/* Apps should already have checked that the rg size is <=
@@ -952,7 +952,7 @@ int lgfs2_rbm_find(struct lgfs2_rbm *rbm, uint8_t state, uint32_t *minext)
 			goto next_bitmap;
 
 		offset = lgfs2_bitfit(buf, bi->bi_len, rbm->offset, state);
-		if (offset == BFITNOENT)
+		if (offset == LGFS2_BFITNOENT)
 			goto next_bitmap;
 
 		rbm->offset = offset;
gfs2/libgfs2/structures.c +1 -1
index d67c1fc0..d13f67a4 100644
@@ -506,7 +506,7 @@ unsigned lgfs2_bm_scan(struct rgrp_tree *rgd, unsigned idx, uint64_t *buf, uint8
 	while(blk < (bi->bi_len * GFS2_NBBY)) {
 		blk = lgfs2_bitfit((uint8_t *)bi->bi_data + bi->bi_offset,
 				  bi->bi_len, blk, state);
-		if (blk == BFITNOENT)
+		if (blk == LGFS2_BFITNOENT)
 			break;
 		buf[n++] = blk + (bi->bi_start * GFS2_NBBY) + rgd->rt_data0;
 		blk++;
gfs2/libgfs2/super.c +2 -2
index 6af366f7..d42bdb03 100644
@@ -132,7 +132,7 @@ int lgfs2_read_sb(struct lgfs2_sbd *sdp)
 	sdp->fssize = lseek(sdp->device_fd, 0, SEEK_END) / sdp->sd_bsize;
 	sdp->sd_blocks_per_bitmap = (sdp->sd_bsize - sizeof(struct gfs2_meta_header))
 	                             * GFS2_NBBY;
-	sdp->qcsize = GFS2_DEFAULT_QCSIZE;
+	sdp->qcsize = LGFS2_DEFAULT_QCSIZE;
 
 	return 0;
 }
@@ -157,7 +157,7 @@ static int rgd_seems_ok(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
 	/* A max rgrp, 2GB, divided into blocksize, divided by blocks/byte
 	   represented in the bitmap, NBBY. Rough approximation only, due to
 	   metadata headers. I'm doing the math this way to avoid overflow. */
-	most_bitmaps_possible = (GFS2_MAX_RGSIZE * 1024 * 256) / sdp->sd_bsize;
+	most_bitmaps_possible = (LGFS2_MAX_RGSIZE * 1024 * 256) / sdp->sd_bsize;
 	if (rgd->rt_length > most_bitmaps_possible)
 		return 0;
 
gfs2/mkfs/main_grow.c +5 -5
index f3c6d0ba..524efe1b 100644
@@ -363,10 +363,10 @@ int main(int argc, char *argv[])
 	srandom(time(NULL) ^ getpid());
 
 	memset(sdp, 0, sizeof(struct lgfs2_sbd));
-	sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
+	sdp->sd_bsize = LGFS2_DEFAULT_BSIZE;
 	sdp->rgsize = -1;
-	sdp->jsize = GFS2_DEFAULT_JSIZE;
-	sdp->qcsize = GFS2_DEFAULT_QCSIZE;
+	sdp->jsize = LGFS2_DEFAULT_JSIZE;
+	sdp->qcsize = LGFS2_DEFAULT_QCSIZE;
 	sdp->md.journals = 1;
 	decode_arguments(argc, argv, sdp);
 
@@ -392,7 +392,7 @@ int main(int argc, char *argv[])
 			perror(mnt->mnt_fsname);
 			exit(EXIT_FAILURE);
 		}
-		sdp->sd_bsize = GFS2_DEFAULT_BSIZE;
+		sdp->sd_bsize = LGFS2_DEFAULT_BSIZE;
 		sdp->sd_bsize = sdp->sd_bsize;
 		if (lgfs2_compute_constants(sdp)) {
 			log_crit("%s\n", _("Failed to compute file system constants"));
@@ -454,7 +454,7 @@ int main(int argc, char *argv[])
 			goto out;
 		}
 		fsgrowth = (sdp->device.length - fssize);
-		rgcount = lgfs2_rgrps_plan(rgs, fsgrowth, ((GFS2_MAX_RGSIZE << 20) / sdp->sd_bsize));
+		rgcount = lgfs2_rgrps_plan(rgs, fsgrowth, ((LGFS2_MAX_RGSIZE << 20) / sdp->sd_bsize));
 		if (rgcount == 0) {
 			log_err( _("The calculated resource group size is too small.\n"));
 			log_err( _("%s has not grown.\n"), argv[optind]);
gfs2/mkfs/main_jadd.c +2 -2
index 90a216bb..670a75c0 100644
@@ -640,8 +640,8 @@ int main(int argc, char *argv[])
 	srandom(time(NULL) ^ getpid());
 
 	memset(sdp, 0, sizeof(struct lgfs2_sbd));
-	sdp->jsize = GFS2_DEFAULT_JSIZE;
-	sdp->qcsize = GFS2_DEFAULT_QCSIZE;
+	sdp->jsize = LGFS2_DEFAULT_JSIZE;
+	sdp->qcsize = LGFS2_DEFAULT_QCSIZE;
 	opts.journals = 1;
 
 	ret = decode_arguments(argc, argv, sdp, &opts);
gfs2/mkfs/main_mkfs.c +12 -12
index c7712be8..f72f7e17 100644
@@ -150,10 +150,10 @@ static void opts_init(struct mkfs_opts *opts)
 	memset(opts, 0, sizeof(*opts));
 	opts->discard = 1;
 	opts->journals = 1;
-	opts->bsize = GFS2_DEFAULT_BSIZE;
-	opts->jsize = GFS2_DEFAULT_JSIZE;
-	opts->qcsize = GFS2_DEFAULT_QCSIZE;
-	opts->rgsize = GFS2_DEFAULT_RGSIZE;
+	opts->bsize = LGFS2_DEFAULT_BSIZE;
+	opts->jsize = LGFS2_DEFAULT_JSIZE;
+	opts->qcsize = LGFS2_DEFAULT_QCSIZE;
+	opts->rgsize = LGFS2_DEFAULT_RGSIZE;
 	opts->lockproto = "lock_dlm";
 	opts->locktable = "";
 	opts->confirm = 1;
@@ -561,10 +561,10 @@ static int choose_blocksize(struct mkfs_opts *opts, unsigned *pbsize)
 	}
 	if (!opts->got_bsize && got_topol) {
 		if (dev->optimal_io_size <= getpagesize() &&
-		    dev->optimal_io_size >= GFS2_DEFAULT_BSIZE)
+		    dev->optimal_io_size >= LGFS2_DEFAULT_BSIZE)
 			bsize = dev->optimal_io_size;
 		else if (dev->physical_sector_size <= getpagesize() &&
-		         dev->physical_sector_size >= GFS2_DEFAULT_BSIZE)
+		         dev->physical_sector_size >= LGFS2_DEFAULT_BSIZE)
 			bsize = dev->physical_sector_size;
 	}
 	/* Block sizes must be a power of two from 512 to 65536 */
@@ -602,7 +602,7 @@ static int opts_check(struct mkfs_opts *opts)
 	if (test_locking(opts) != 0)
 		return -1;
 
-	if (GFS2_MIN_RGSIZE > opts->rgsize || opts->rgsize > GFS2_MAX_RGSIZE) {
+	if (LGFS2_MIN_RGSIZE > opts->rgsize || opts->rgsize > LGFS2_MAX_RGSIZE) {
 		/* Translators: gfs2 file systems are split into equal sized chunks called
 		   resource groups. We're checking that the user gave a valid size for them. */
 		fprintf(stderr, _("Bad resource group size\n"));
@@ -617,7 +617,7 @@ static int opts_check(struct mkfs_opts *opts)
 		fprintf(stderr, _("Number of journals cannot be negative: %d\n"), opts->journals);
 		return -1;
 	}
-	if (opts->jsize < GFS2_MIN_JSIZE || opts->jsize > GFS2_MAX_JSIZE) {
+	if (opts->jsize < LGFS2_MIN_JSIZE || opts->jsize > LGFS2_MAX_JSIZE) {
 		fprintf(stderr, _("Bad journal size\n"));
 		return -1;
 	}
@@ -1028,7 +1028,7 @@ static int create_jindex(struct lgfs2_sbd *sdp, struct mkfs_opts *opts, struct l
  */
 static int default_journal_size(unsigned bsize, uint64_t num_blocks)
 {
-	int min_blocks = (GFS2_MIN_JSIZE << 20) / bsize;
+	int min_blocks = (LGFS2_MIN_JSIZE << 20) / bsize;
 
 	if (num_blocks < 2 * min_blocks)
 		return -1;
@@ -1091,15 +1091,15 @@ static int sbd_init(struct lgfs2_sbd *sdp, struct mkfs_opts *opts, unsigned bsiz
 			return -1;
 		}
 		jsize_mb = (default_jsize * sdp->sd_bsize) >> 20;
-		if (jsize_mb < GFS2_MIN_JSIZE)
-			opts->jsize = GFS2_MIN_JSIZE;
+		if (jsize_mb < LGFS2_MIN_JSIZE)
+			opts->jsize = LGFS2_MIN_JSIZE;
 		else
 			opts->jsize = jsize_mb;
 	} else if ((((opts->jsize * opts->journals) << 20) / sdp->sd_bsize) > (sdp->device.length / 2)) {
 		unsigned max_jsize = (sdp->device.length / 2 * sdp->sd_bsize / opts->journals) >> 20;
 
 		fprintf(stderr, _("gfs2 will not fit on this device.\n"));
-		if (max_jsize >= GFS2_MIN_JSIZE)
+		if (max_jsize >= LGFS2_MIN_JSIZE)
 			fprintf(stderr, _("Maximum size for %u journals on this device is %uMB.\n"),
 			        opts->journals, max_jsize);
 		return -1;
gfs2/tune/super.c +3 -3
index 03df530e..ff727fab 100644
@@ -19,12 +19,12 @@ int read_super(struct tunegfs2 *tfs)
 	void *block;
 	int n;
        	tfs->sb_start = GFS2_SB_ADDR << GFS2_BASIC_BLOCK_SHIFT;
-	block = malloc(sizeof(char) * GFS2_DEFAULT_BSIZE);
+	block = malloc(sizeof(char) * LGFS2_DEFAULT_BSIZE);
 	if (!block) {
 		perror("read_super: malloc");
 		return EX_UNAVAILABLE;
 	}
-	n = pread(tfs->fd, block, GFS2_DEFAULT_BSIZE, tfs->sb_start);
+	n = pread(tfs->fd, block, LGFS2_DEFAULT_BSIZE, tfs->sb_start);
 	if (n < 0) {
 		perror("read_super: pread");
 		free(block);
@@ -71,7 +71,7 @@ int print_super(const struct tunegfs2 *tfs)
 int write_super(const struct tunegfs2 *tfs)
 {
 	int n;
-	n = pwrite(tfs->fd, tfs->sb, GFS2_DEFAULT_BSIZE, tfs->sb_start);
+	n = pwrite(tfs->fd, tfs->sb, LGFS2_DEFAULT_BSIZE, tfs->sb_start);
 	if (n < 0) {
 		perror("write_super: pwrite");
 		return EX_IOERR;
Signature · 1 line
2.34.1
#21 lore raw

PATCH 21/21 libgfs2: Namespace improvements - struct rgrp_tree

In reply to Andrew Price

Rename to struct lgfs2_rgrp_tree.

---
 gfs2/convert/gfs2_convert.c | 22 +++++++++----------
 gfs2/edit/extended.c        |  2 +-
 gfs2/edit/hexedit.c         | 24 ++++++++++-----------
 gfs2/edit/journal.c         |  8 +++----
 gfs2/edit/savemeta.c        |  8 +++----
 gfs2/fsck/fs_recovery.c     |  4 ++--
 gfs2/fsck/fsck.h            |  6 +++---
 gfs2/fsck/initialize.c      | 18 ++++++++--------
 gfs2/fsck/main.c            |  4 ++--
 gfs2/fsck/metawalk.c        |  6 +++---
 gfs2/fsck/metawalk.h        |  2 +-
 gfs2/fsck/pass1.c           | 12 +++++------
 gfs2/fsck/pass5.c           |  6 +++---
 gfs2/fsck/rgrepair.c        | 42 ++++++++++++++++++-------------------
 gfs2/fsck/util.c            |  4 ++--
 gfs2/fsck/util.h            |  2 +-
 gfs2/libgfs2/fs_bits.c      |  2 +-
 gfs2/libgfs2/fs_ops.c       | 12 +++++------
 gfs2/libgfs2/lang.c         |  4 ++--
 gfs2/libgfs2/libgfs2.h      | 20 +++++++++---------
 gfs2/libgfs2/rgrp.c         | 28 ++++++++++++-------------
 gfs2/libgfs2/structures.c   |  6 +++---
 gfs2/libgfs2/super.c        |  6 +++---
 23 files changed, 124 insertions(+), 124 deletions(-)
gfs2/convert/gfs2_convert.c +11 -11
index 104f9812..3eb1bf24 100644
@@ -119,7 +119,7 @@ int print_level = MSG_NOTICE;
 /*                   Fixes all unallocated metadata bitmap states (which are */
 /*                   valid in gfs1 but invalid in gfs2).                     */
 /* ------------------------------------------------------------------------- */
-static void convert_bitmaps(struct lgfs2_sbd *sdp, struct rgrp_tree *rg)
+static void convert_bitmaps(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rg)
 {
 	uint32_t blk;
 	int x, y;
@@ -148,7 +148,7 @@ static void convert_bitmaps(struct lgfs2_sbd *sdp, struct rgrp_tree *rg)
 /* ------------------------------------------------------------------------- */
 static int convert_rgs(struct lgfs2_sbd *sbp)
 {
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	struct osi_node *n, *next = NULL;
 	int rgs = 0;
 
@@ -157,7 +157,7 @@ static int convert_rgs(struct lgfs2_sbd *sbp)
 	/* --------------------------------- */
 	for (n = osi_first(&sbp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 
 		rgd->rt_free = rgd->rt_free + rgd->rt_freemeta;
 		/* Zero it out so we don't add it again in case something breaks */
@@ -949,7 +949,7 @@ err_freei:
 	return -1;
 } /* adjust_inode */
 
-static int next_rg_meta(struct rgrp_tree *rgd, uint64_t *block, int first)
+static int next_rg_meta(struct lgfs2_rgrp_tree *rgd, uint64_t *block, int first)
 {
 	struct lgfs2_bitmap *bits = NULL;
 	uint32_t length = rgd->rt_length;
@@ -981,7 +981,7 @@ static int next_rg_meta(struct rgrp_tree *rgd, uint64_t *block, int first)
 	return 0;
 }
 
-static int next_rg_metatype(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
+static int next_rg_metatype(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd,
                             uint64_t *block, uint32_t type, int first)
 {
 	struct lgfs2_buffer_head *bh = NULL;
@@ -1008,7 +1008,7 @@ static int next_rg_metatype(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
 /* ------------------------------------------------------------------------- */
 static int inode_renumber(struct lgfs2_sbd *sbp, uint64_t root_inode_addr, osi_list_t *cdpn_to_fix)
 {
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	struct osi_node *n, *next = NULL;
 	uint64_t block = 0;
 	struct lgfs2_buffer_head *bh;
@@ -1026,7 +1026,7 @@ static int inode_renumber(struct lgfs2_sbd *sbp, uint64_t root_inode_addr, osi_l
 	/* ---------------------------------------------------------------- */
 	for (n = osi_first(&sbp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		rgs_processed++;
 		first = 1;
 		while (1) {    /* for all inodes in the resource group */
@@ -1519,7 +1519,7 @@ static int sanity_check(struct lgfs2_sbd *sdp)
  */
 static int gfs1_ri_update(struct lgfs2_sbd *sdp, int *rgcount, int quiet)
 {
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	uint64_t count1 = 0, count2 = 0;
 	uint64_t errblock = 0;
 	uint64_t rmax = 0;
@@ -1530,7 +1530,7 @@ static int gfs1_ri_update(struct lgfs2_sbd *sdp, int *rgcount, int quiet)
 		goto fail;
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		/* Read resource group header */
 		errblock = lgfs2_rgrp_read(sdp, rgd);
 		if (errblock)
@@ -1808,7 +1808,7 @@ static int journ_space_to_rg(struct lgfs2_sbd *sdp)
 {
 	int error = 0;
 	int j;
-	struct rgrp_tree *rgd, *rgdhigh;
+	struct lgfs2_rgrp_tree *rgd, *rgdhigh;
 	struct osi_node *n, *next = NULL;
 	struct gfs2_meta_header mh = {0};
 	uint64_t ri_addr;
@@ -1834,7 +1834,7 @@ static int journ_space_to_rg(struct lgfs2_sbd *sdp)
 		rgdhigh = NULL;
 		for (n = osi_first(&sdp->rgtree); n; n = next) {
 			next = osi_next(n);
-			rgd = (struct rgrp_tree *)n;
+			rgd = (struct lgfs2_rgrp_tree *)n;
 			if (rgd->rt_addr < ji_addr &&
 				((rgdhigh == NULL) ||
 				 (rgd->rt_addr > rgdhigh->rt_addr)))
gfs2/edit/extended.c +1 -1
index 81548939..aec8cbdc 100644
@@ -494,7 +494,7 @@ static int parse_rindex(struct lgfs2_inode *dip, int print_rindex)
 	int error, start_line;
 	struct gfs2_rindex ri;
 	char highlighted_addr[32];
-	struct rgrp_tree rg = {0};
+	struct lgfs2_rgrp_tree rg = {0};
 
 	start_line = line;
 	print_gfs2("RG index entries found: %"PRIu64".",
gfs2/edit/hexedit.c +12 -12
index 9a90587f..af17e720 100644
@@ -348,7 +348,7 @@ int display_block_type(char *buf, uint64_t addr, int from_restore)
 		return ret_type;
 	if (termlines && dmode == HEX_MODE) {
 		int type;
-		struct rgrp_tree *rgd;
+		struct lgfs2_rgrp_tree *rgd;
 
 		rgd = lgfs2_blk2rgrpd(&sbd, block);
 		if (rgd) {
@@ -942,7 +942,7 @@ static int read_rindex(void)
 		lgfs2_rindex_read(&sbd, &count, &ok);
 
 	if (!OSI_EMPTY_ROOT(&sbd.rgtree)) {
-		struct rgrp_tree *rg = (struct rgrp_tree *)osi_last(&sbd.rgtree);
+		struct lgfs2_rgrp_tree *rg = (struct lgfs2_rgrp_tree *)osi_last(&sbd.rgtree);
 		sbd.fssize = rg->rt_data0 + rg->rt_data;
 	}
 	return 0;
@@ -1160,7 +1160,7 @@ static uint64_t find_metablockoftype_slow(uint64_t startblk, int metatype, int p
 	return blk;
 }
 
-static int find_rg_metatype(struct rgrp_tree *rgd, uint64_t *blk, uint64_t startblk, int mtype)
+static int find_rg_metatype(struct lgfs2_rgrp_tree *rgd, uint64_t *blk, uint64_t startblk, int mtype)
 {
 	int found;
 	unsigned i, j, m;
@@ -1197,12 +1197,12 @@ static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int pri
 	struct osi_node *next = NULL;
 	uint64_t blk, errblk;
 	int first = 1, found = 0;
-	struct rgrp_tree *rgd = NULL;
+	struct lgfs2_rgrp_tree *rgd = NULL;
 
 	blk = 0;
 	/* Skip the rgs prior to the block we've been given */
 	for (next = osi_first(&sbd.rgtree); next; next = osi_next(next)) {
-		rgd = (struct rgrp_tree *)next;
+		rgd = (struct lgfs2_rgrp_tree *)next;
 		if (first && startblk <= rgd->rt_data0) {
 			startblk = rgd->rt_data0;
 			break;
@@ -1221,7 +1221,7 @@ static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int pri
 			exit(-1);
 	}
 	for (; !found && next; next = osi_next(next)){
-		rgd = (struct rgrp_tree *)next;
+		rgd = (struct lgfs2_rgrp_tree *)next;
 		errblk = lgfs2_rgrp_read(&sbd, rgd);
 		if (errblk)
 			continue;
@@ -1600,7 +1600,7 @@ static void find_print_block_rg(int bitmap)
 {
 	uint64_t rblock, rgblock;
 	int i;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 
 	rblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
 	if (rblock == LGFS2_SB_ADDR(&sbd))
@@ -1643,7 +1643,7 @@ static void find_change_block_alloc(int *newval)
 {
 	uint64_t ablock;
 	int type;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 
 	if (newval &&
 	    (*newval < GFS2_BLKST_FREE || *newval > GFS2_BLKST_DINODE)) {
@@ -2116,7 +2116,7 @@ static void getgziplevel(char *argv[], int *i)
 	(*i)++;
 }
 
-static int count_dinode_blks(struct rgrp_tree *rgd, int bitmap,
+static int count_dinode_blks(struct lgfs2_rgrp_tree *rgd, int bitmap,
 			     struct lgfs2_buffer_head *rbh)
 {
 	struct lgfs2_buffer_head *tbh;
@@ -2175,7 +2175,7 @@ static int count_dinode_bits(struct lgfs2_buffer_head *rbh)
 static void rg_repair(void)
 {
 	struct lgfs2_buffer_head *rbh;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	struct osi_node *n;
 	int b;
 	int rgs_fixed = 0;
@@ -2183,7 +2183,7 @@ static void rg_repair(void)
 
 	/* Walk through the resource groups saving everything within */
 	for (n = osi_first(&sbd.rgtree); n; n = osi_next(n)) {
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		if (lgfs2_rgrp_read(&sbd, rgd) == 0) { /* was read in okay */
 			lgfs2_rgrp_relse(&sbd, rgd);
 			continue; /* ignore it */
@@ -2448,7 +2448,7 @@ static void process_parameters(int argc, char *argv[], int pass)
 		} else if (!strcmp(argv[i], "rgbitmaps")) {
 			int rg, bmap;
 			uint64_t rgblk;
-			struct rgrp_tree *rgd;
+			struct lgfs2_rgrp_tree *rgd;
 
 			i++;
 			if (i >= argc - 1) {
gfs2/edit/journal.c +4 -4
index c977ef7f..f5dc0518 100644
@@ -174,7 +174,7 @@ static int fsck_readi(struct lgfs2_inode *ip, void *rbuf, uint64_t roffset,
  * references to a given traced block, or its rgrp bitmap block.
  */
 static int ld_is_pertinent(const __be64 *b, const char *end, uint64_t tblk,
-			   struct rgrp_tree *rgd, uint64_t bitblk)
+			   struct lgfs2_rgrp_tree *rgd, uint64_t bitblk)
 {
 	const __be64 *blk = b;
 
@@ -197,7 +197,7 @@ static int ld_is_pertinent(const __be64 *b, const char *end, uint64_t tblk,
  */
 static int print_ld_blks(const __be64 *b, const char *end, int start_line,
 			 uint64_t tblk, uint64_t *tblk_off, uint64_t bitblk,
-			 struct rgrp_tree *rgd, uint64_t abs_block, int prnt,
+			 struct lgfs2_rgrp_tree *rgd, uint64_t abs_block, int prnt,
 			 uint64_t *bblk_off, int is_meta_ld)
 {
 	int bcount = 0, found_tblk = 0, found_bblk = 0;
@@ -352,7 +352,7 @@ static uint64_t find_wrap_pt(struct lgfs2_inode *ji, char *jbuf, uint64_t jblock
 static int process_ld(uint64_t abs_block, uint64_t wrappt, uint64_t j_size,
 		      uint64_t jb, char *buf, int tblk,
 		      uint64_t *tblk_off, uint64_t bitblk,
-		      struct rgrp_tree *rgd, int *prnt, uint64_t *bblk_off)
+		      struct lgfs2_rgrp_tree *rgd, int *prnt, uint64_t *bblk_off)
 {
 	__be64 *b;
 	struct gfs2_log_descriptor *ld = (void *)buf;
@@ -511,7 +511,7 @@ void dump_journal(const char *journal, uint64_t tblk)
 	uint64_t highest_seq = 0;
 	char *jbuf = NULL;
 	char *buf = NULL;
-	struct rgrp_tree *rgd = NULL;
+	struct lgfs2_rgrp_tree *rgd = NULL;
 	uint64_t abs_ld = 0;
 
 	mtype = lgfs2_find_mtype(GFS2_METATYPE_LH, sbd.gfs1 ? LGFS2_MD_GFS1 : LGFS2_MD_GFS2);
gfs2/edit/savemeta.c +4 -4
index 4ab4f4a1..05c3f295 100644
@@ -989,7 +989,7 @@ static void save_allocated_range(struct metafd *mfd, struct block_range *br)
 	free(br->buf);
 }
 
-static void save_allocated(struct rgrp_tree *rgd, struct metafd *mfd)
+static void save_allocated(struct lgfs2_rgrp_tree *rgd, struct metafd *mfd)
 {
 	uint64_t blk = 0;
 	unsigned i, j, m;
@@ -1055,7 +1055,7 @@ static char *rgrp_read(struct lgfs2_sbd *sdp, uint64_t addr, unsigned blocks)
 	return buf;
 }
 
-static void save_rgrp(struct lgfs2_sbd *sdp, struct metafd *mfd, struct rgrp_tree *rgd, int withcontents)
+static void save_rgrp(struct lgfs2_sbd *sdp, struct metafd *mfd, struct lgfs2_rgrp_tree *rgd, int withcontents)
 {
 	uint64_t addr = rgd->rt_addr;
 	char *buf;
@@ -1188,9 +1188,9 @@ void savemeta(char *out_fn, int saveoption, int gziplevel)
 	}
 	/* Walk through the resource groups saving everything within */
 	for (n = osi_first(&sbd.rgtree); n; n = osi_next(n)) {
-		struct rgrp_tree *rgd;
+		struct lgfs2_rgrp_tree *rgd;
 
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		save_rgrp(&sbd, &mfd, rgd, (saveoption != 2));
 	}
 	/* Clean up */
gfs2/fsck/fs_recovery.c +2 -2
index f65c4a33..97c42e4d 100644
@@ -98,7 +98,7 @@ static void revoke_clean(struct lgfs2_sbd *sdp)
 	}
 }
 
-static void refresh_rgrp(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
+static void refresh_rgrp(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd,
 			 struct lgfs2_buffer_head *bh, uint64_t blkno)
 {
 	int i;
@@ -130,7 +130,7 @@ static int buf_lo_scan_elements(struct lgfs2_inode *ip, unsigned int start,
 	struct lgfs2_buffer_head *bh_log, *bh_ip;
 	uint64_t blkno;
 	int error = 0;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 
 	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA)
 		return 0;
gfs2/fsck/fsck.h +3 -3
index baf7c926..94b8620c 100644
@@ -110,7 +110,7 @@ enum rgindex_trust_level { /* how far can we trust our RG index? */
 
 extern struct lgfs2_inode *fsck_load_inode(struct lgfs2_sbd *sdp, uint64_t block);
 extern struct lgfs2_inode *fsck_inode_get(struct lgfs2_sbd *sdp,
-					 struct rgrp_tree *rgd,
+					 struct lgfs2_rgrp_tree *rgd,
 					 struct lgfs2_buffer_head *bh);
 extern void fsck_inode_put(struct lgfs2_inode **ip);
 
@@ -164,7 +164,7 @@ static inline int valid_block(struct lgfs2_sbd *sdp, uint64_t blkno)
 	         (lgfs2_get_bitmap(sdp, blkno, NULL) < 0));
 }
 
-static inline int rgrp_contains_block(struct rgrp_tree *rgd, uint64_t blk)
+static inline int rgrp_contains_block(struct lgfs2_rgrp_tree *rgd, uint64_t blk)
 {
 	if (blk < rgd->rt_addr)
 		return 0;
@@ -176,7 +176,7 @@ static inline int rgrp_contains_block(struct rgrp_tree *rgd, uint64_t blk)
 static inline int valid_block_ip(struct lgfs2_inode *ip, uint64_t blk)
 {
 	struct lgfs2_sbd *sdp = ip->i_sbd;
-	struct rgrp_tree *rgd = ip->i_rgd;
+	struct lgfs2_rgrp_tree *rgd = ip->i_rgd;
 
 	if (blk > sdp->fssize)
 		return 0;
gfs2/fsck/initialize.c +9 -9
index 8957ddf9..942a2de8 100644
@@ -132,7 +132,7 @@ static void empty_super_block(struct lgfs2_sbd *sdp)
 static int set_block_ranges(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *n, *next = NULL;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	uint64_t rmax = 0;
 	uint64_t rmin = 0;
 	ssize_t count;
@@ -142,7 +142,7 @@ static int set_block_ranges(struct lgfs2_sbd *sdp)
 
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		if (rgd->rt_data0 + rgd->rt_data &&
 		    rgd->rt_data0 + rgd->rt_data - 1 > rmax)
 			rmax = rgd->rt_data0 + rgd->rt_data - 1;
@@ -185,7 +185,7 @@ static int set_block_ranges(struct lgfs2_sbd *sdp)
 /**
  * check_rgrp_integrity - verify a rgrp free block count against the bitmap
  */
-static void check_rgrp_integrity(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
+static void check_rgrp_integrity(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd,
 				 int *fixit, int *this_rg_fixed,
 				 int *this_rg_bad, int *this_rg_cleaned)
 {
@@ -397,13 +397,13 @@ static void check_rgrps_integrity(struct lgfs2_sbd *sdp)
 	struct osi_node *n, *next = NULL;
 	int rgs_good = 0, rgs_bad = 0, rgs_fixed = 0, rgs_cleaned = 0;
 	int was_bad = 0, was_fixed = 0, was_cleaned = 0;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	int reclaim_unlinked = 0;
 
 	log_info( _("Checking the integrity of all resource groups.\n"));
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		if (fsck_abort)
 			return;
 		check_rgrp_integrity(sdp, rgd, &reclaim_unlinked,
@@ -628,7 +628,7 @@ static void lookup_per_node(struct lgfs2_sbd *sdp, int allow_rebuild)
 static unsigned gfs2_rgrp_reada(struct lgfs2_sbd *sdp, unsigned cur_window,
 				struct osi_node *n)
 {
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	unsigned i;
 	off_t start, len;
 
@@ -637,7 +637,7 @@ static unsigned gfs2_rgrp_reada(struct lgfs2_sbd *sdp, unsigned cur_window,
 			return i;
 		if (i < cur_window)
 			continue;
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		start = rgd->rt_addr * sdp->sd_bsize;
 		len = rgd->rt_length * sdp->sd_bsize;
 		posix_fadvise(sdp->device_fd, start, len, POSIX_FADV_WILLNEED);
@@ -658,7 +658,7 @@ static unsigned gfs2_rgrp_reada(struct lgfs2_sbd *sdp, unsigned cur_window,
  */
 static int read_rgrps(struct lgfs2_sbd *sdp, uint64_t expected)
 {
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	uint64_t count = 0;
 	uint64_t errblock = 0;
 	uint64_t rmax = 0;
@@ -670,7 +670,7 @@ static int read_rgrps(struct lgfs2_sbd *sdp, uint64_t expected)
 
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		/* Readahead resource group headers */
 		if (ra_window < RA_WINDOW/2)
 			ra_window = gfs2_rgrp_reada(sdp, ra_window, n);
gfs2/fsck/main.c +2 -2
index e86ef792..ed61449e 100644
@@ -155,7 +155,7 @@ static void interrupt(int sig)
 static int check_statfs(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *n, *next = NULL;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	struct gfs2_statfs_change sc;
 	uint64_t sc_total;
 	uint64_t sc_free;
@@ -184,7 +184,7 @@ static int check_statfs(struct lgfs2_sbd *sdp)
 
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		sdp->blks_total += rgd->rt_data;
 		sdp->blks_alloced += (rgd->rt_data - rgd->rt_free);
 		sdp->dinodes_alloced += rgd->rt_dinodes;
gfs2/fsck/metawalk.c +3 -3
index 035f0765..cdbeec9d 100644
@@ -29,7 +29,7 @@
    is used to set the latter.  The two must be kept in sync, otherwise
    you'll get bitmap mismatches.  This function checks the status of the
    bitmap whenever the blockmap changes, and fixes it accordingly. */
-int check_n_fix_bitmap(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
+int check_n_fix_bitmap(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd,
 		       uint64_t blk, int error_on_dinode, int new_state)
 {
 	int old_state;
@@ -39,7 +39,7 @@ int check_n_fix_bitmap(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
 		{"free", "data", "unlinked", "inode", "reserved"},
 		/* gfs1 descriptions: */
 		{"free", "data", "free meta", "metadata", "reserved"}};
-	static struct rgrp_tree *prevrgd = NULL;
+	static struct lgfs2_rgrp_tree *prevrgd = NULL;
 
 	if (prevrgd && rgrp_contains_block(prevrgd, blk)) {
 		rgd = prevrgd;
@@ -266,7 +266,7 @@ struct lgfs2_inode *fsck_load_inode(struct lgfs2_sbd *sdp, uint64_t block)
 
 /* fsck_inode_get - same as inode_get() in libgfs2 but system inodes
    get special treatment. */
-struct lgfs2_inode *fsck_inode_get(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
+struct lgfs2_inode *fsck_inode_get(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd,
 				  struct lgfs2_buffer_head *bh)
 {
 	struct lgfs2_inode *sysip;
gfs2/fsck/metawalk.h +1 -1
index f82f24bb..eeff431d 100644
@@ -22,7 +22,7 @@ extern int check_leaf(struct lgfs2_inode *ip, int lindex,
 extern int _fsck_bitmap_set(struct lgfs2_inode *ip, uint64_t bblock,
 			    const char *btype, int mark, int error_on_dinode,
 			    const char *caller, int line);
-extern int check_n_fix_bitmap(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
+extern int check_n_fix_bitmap(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd,
 			      uint64_t blk, int error_on_dinode,
 			      int new_state);
 extern struct duptree *dupfind(uint64_t block);
gfs2/fsck/pass1.c +6 -6
index 578de609..5aaff951 100644
@@ -397,7 +397,7 @@ static int undo_reference(struct lgfs2_inode *ip, uint64_t block, int meta,
 	struct duptree *dt;
 	struct inode_with_dups *id;
 	int old_bitmap_state = 0;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 
 	if (!valid_block_ip(ip, block)) { /* blk outside of FS */
 		fsck_blockmap_set(ip, ip->i_num.in_addr, _("bad block referencing"), GFS2_BLKST_FREE);
@@ -1397,7 +1397,7 @@ static void check_i_goal(struct lgfs2_sbd *sdp, struct lgfs2_inode *ip)
  * handle_di - This is now a wrapper function that takes a lgfs2_buffer_head
  *             and calls handle_ip, which takes an in-code dinode structure.
  */
-static int handle_di(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd,
+static int handle_di(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd,
 		     struct lgfs2_buffer_head *bh)
 {
 	int error = 0;
@@ -1751,7 +1751,7 @@ static int check_system_inodes(struct lgfs2_sbd *sdp)
 	return 0;
 }
 
-static int pass1_process_bitmap(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd, uint64_t *ibuf, unsigned n)
+static int pass1_process_bitmap(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd, uint64_t *ibuf, unsigned n)
 {
 	struct lgfs2_buffer_head *bh;
 	unsigned i;
@@ -1874,7 +1874,7 @@ static int pass1_process_bitmap(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd, ui
 	return 0;
 }
 
-static int pass1_process_rgrp(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
+static int pass1_process_rgrp(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd)
 {
 	unsigned k, n, i;
 	uint64_t *ibuf = malloc(sdp->sd_bsize * GFS2_NBBY * sizeof(uint64_t));
@@ -2002,7 +2002,7 @@ static void enomem(uint64_t addl_mem_needed)
 int pass1(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *n, *next = NULL;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	uint64_t i;
 	uint64_t rg_count = 0;
 	struct timeval timer;
@@ -2054,7 +2054,7 @@ int pass1(struct lgfs2_sbd *sdp)
 		}
 		next = osi_next(n);
 		log_debug("Checking metadata in resource group #%"PRIu64"\n", rg_count);
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 		for (i = 0; i < rgd->rt_length; i++) {
 			log_debug("rgrp block %"PRIu64" (0x%"PRIx64") is now marked as 'rgrp data'\n",
 				   rgd->rt_addr + i, rgd->rt_addr + i);
gfs2/fsck/pass5.c +3 -3
index 302ebaf2..e412a4d0 100644
@@ -113,7 +113,7 @@ static int check_block_status(struct lgfs2_sbd *sdp,  struct gfs2_bmap *bl,
 	return 0;
 }
 
-static void update_rgrp(struct lgfs2_sbd *sdp, struct rgrp_tree *rgp,
+static void update_rgrp(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgp,
 			struct gfs2_bmap *bl, uint32_t *count)
 {
 	uint32_t i;
@@ -197,7 +197,7 @@ static void update_rgrp(struct lgfs2_sbd *sdp, struct rgrp_tree *rgp,
 int pass5(struct lgfs2_sbd *sdp, struct gfs2_bmap *bl)
 {
 	struct osi_node *n, *next = NULL;
-	struct rgrp_tree *rgp = NULL;
+	struct lgfs2_rgrp_tree *rgp = NULL;
 	uint32_t count[5]; /* we need 5 because of GFS1 usedmeta */
 	uint64_t rg_count = 0;
 
@@ -208,7 +208,7 @@ int pass5(struct lgfs2_sbd *sdp, struct gfs2_bmap *bl)
 			return FSCK_OK;
 		log_info(_("Verifying resource group %"PRIu64"\n"), rg_count);
 		memset(count, 0, sizeof(count));
-		rgp = (struct rgrp_tree *)n;
+		rgp = (struct lgfs2_rgrp_tree *)n;
 
 		rg_count++;
 		/* Compare the bitmaps and report the differences */
gfs2/fsck/rgrepair.c +21 -21

144 lines not on this page · raw message

gfs2/fsck/util.c +2 -2
index ba5f1f22..9e5608a3 100644
@@ -538,7 +538,7 @@ void dirtree_delete(struct dir_info *b)
 uint64_t find_free_blk(struct lgfs2_sbd *sdp)
 {
 	struct osi_node *n, *next = NULL;
-	struct rgrp_tree *rl = NULL;
+	struct lgfs2_rgrp_tree *rl = NULL;
 	struct gfs2_rgrp *rg;
 	unsigned int block, bn = 0, x = 0, y = 0;
 	unsigned int state;
@@ -546,7 +546,7 @@ uint64_t find_free_blk(struct lgfs2_sbd *sdp)
 	memset(&rg, 0, sizeof(rg));
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rl = (struct rgrp_tree *)n;
+		rl = (struct lgfs2_rgrp_tree *)n;
 		if (rl->rt_free)
 			break;
 	}
gfs2/fsck/util.h +1 -1
index 84e15e40..daef0b86 100644
@@ -66,7 +66,7 @@ static inline void link1_destroy(struct gfs2_bmap *bmap)
 
 static inline int bitmap_type(struct lgfs2_sbd *sdp, uint64_t bblock)
 {
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 
 	rgd = lgfs2_blk2rgrpd(sdp, bblock);
 	return lgfs2_get_bitmap(sdp, bblock, rgd);
gfs2/libgfs2/fs_bits.c +1 -1
index 7bcd34b9..3d2ccfe5 100644
@@ -174,7 +174,7 @@ int lgfs2_set_bitmap(lgfs2_rgrp_t rgd, uint64_t blkno, int state)
  *
  * Returns: state on success, -1 on error
  */
-int lgfs2_get_bitmap(struct lgfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd)
+int lgfs2_get_bitmap(struct lgfs2_sbd *sdp, uint64_t blkno, struct lgfs2_rgrp_tree *rgd)
 {
 	uint64_t offset;
 	uint32_t i = 0;
gfs2/libgfs2/fs_ops.c +6 -6
index 788509f3..f2d178a1 100644
@@ -107,7 +107,7 @@ void lgfs2_inode_put(struct lgfs2_inode **ip_in)
 	*ip_in = NULL; /* make sure the memory isn't accessed again */
 }
 
-static uint64_t find_free_block(struct rgrp_tree *rgd)
+static uint64_t find_free_block(struct lgfs2_rgrp_tree *rgd)
 {
 	unsigned bm;
 	uint64_t blkno = 0;
@@ -131,7 +131,7 @@ static uint64_t find_free_block(struct rgrp_tree *rgd)
 	return blkno;
 }
 
-static int blk_alloc_in_rg(struct lgfs2_sbd *sdp, unsigned state, struct rgrp_tree *rgd, uint64_t blkno, int dinode)
+static int blk_alloc_in_rg(struct lgfs2_sbd *sdp, unsigned state, struct lgfs2_rgrp_tree *rgd, uint64_t blkno, int dinode)
 {
 	if (blkno == 0)
 		return -1;
@@ -165,12 +165,12 @@ static int block_alloc(struct lgfs2_sbd *sdp, const uint64_t blksreq, int state,
 {
 	int ret;
 	int release = 0;
-	struct rgrp_tree *rgt = NULL;
+	struct lgfs2_rgrp_tree *rgt = NULL;
 	struct osi_node *n = NULL;
 	uint64_t bn = 0;
 
 	for (n = osi_first(&sdp->rgtree); n; n = osi_next(n)) {
-		rgt = (struct rgrp_tree *)n;
+		rgt = (struct lgfs2_rgrp_tree *)n;
 		if (rgt->rt_free >= blksreq)
 			break;
 	}
@@ -1897,7 +1897,7 @@ int lgfs2_lookupi(struct lgfs2_inode *dip, const char *filename, int len,
  */
 void lgfs2_free_block(struct lgfs2_sbd *sdp, uint64_t block)
 {
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 
 	/* Adjust the free space count for the freed block */
 	rgd = lgfs2_blk2rgrpd(sdp, block); /* find the rg for indir block */
@@ -1923,7 +1923,7 @@ int lgfs2_freedi(struct lgfs2_sbd *sdp, uint64_t diblock)
 	struct lgfs2_buffer_head *bh, *nbh;
 	int h, head_size;
 	uint64_t block;
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	uint32_t height;
 	__be64 *ptr;
 	osi_list_t metalist[GFS2_MAX_META_HEIGHT];
gfs2/libgfs2/lang.c +2 -2
index 2ac59796..0570d8d9 100644
@@ -236,7 +236,7 @@ static uint64_t ast_lookup_rgrp(uint64_t rgnum, struct lgfs2_sbd *sbd)
 
 	for (n = osi_first(&sbd->rgtree); n != NULL && i > 0; n = osi_next(n), i--);
 	if (n != NULL && i == 0)
-		return ((struct rgrp_tree *)n)->rt_addr;
+		return ((struct lgfs2_rgrp_tree *)n)->rt_addr;
 	fprintf(stderr, "Resource group number out of range: %"PRIu64"\n", rgnum);
 	return 0;
 }
@@ -365,7 +365,7 @@ static int ast_get_bitstate(uint64_t bn, struct lgfs2_sbd *sbd)
 {
 	int ret = 0;
 	int state = 0;
-	struct rgrp_tree *rgd = lgfs2_blk2rgrpd(sbd, bn);
+	struct lgfs2_rgrp_tree *rgd = lgfs2_blk2rgrpd(sbd, bn);
 	if (rgd == NULL) {
 		fprintf(stderr, "Could not find resource group for block %"PRIu64"\n", bn);
 		return -1;
gfs2/libgfs2/libgfs2.h +10 -10
index 625fc017..fc1b273e 100644
@@ -173,7 +173,7 @@ struct lgfs2_sbd;
 struct lgfs2_inode;
 typedef struct _lgfs2_rgrps *lgfs2_rgrps_t;
 
-struct rgrp_tree {
+struct lgfs2_rgrp_tree {
 	struct osi_node node;
 	struct lgfs2_bitmap *bits;
 	lgfs2_rgrps_t rgrps;
@@ -211,7 +211,7 @@ struct rgrp_tree {
 	};
 };
 
-typedef struct rgrp_tree *lgfs2_rgrp_t;
+typedef struct lgfs2_rgrp_tree *lgfs2_rgrp_t;
 
 extern lgfs2_rgrps_t lgfs2_rgrps_init(struct lgfs2_sbd *sdp, uint64_t align, uint64_t offset);
 extern void lgfs2_rgrps_free(lgfs2_rgrps_t *rgs);
@@ -253,7 +253,7 @@ struct lgfs2_inum {
 struct lgfs2_inode {
 	struct lgfs2_buffer_head *i_bh;
 	struct lgfs2_sbd *i_sbd;
-	struct rgrp_tree *i_rgd; /* performance hint */
+	struct lgfs2_rgrp_tree *i_rgd; /* performance hint */
 	int bh_owned; /* Is this bh owned, iow, should we release it later? */
 
 	/* Native-endian versions of the dinode fields */
@@ -484,7 +484,7 @@ extern unsigned long lgfs2_bitfit(const unsigned char *buffer,
 extern int lgfs2_check_range(struct lgfs2_sbd *sdp, uint64_t blkno);
 
 /* functions with blk #'s that are file system relative */
-extern int lgfs2_get_bitmap(struct lgfs2_sbd *sdp, uint64_t blkno, struct rgrp_tree *rgd);
+extern int lgfs2_get_bitmap(struct lgfs2_sbd *sdp, uint64_t blkno, struct lgfs2_rgrp_tree *rgd);
 extern int lgfs2_set_bitmap(lgfs2_rgrp_t rg, uint64_t blkno, int state);
 
 /* fs_ops.c */
@@ -738,13 +738,13 @@ extern int lgfs2_clean_journal(struct lgfs2_inode *ip, struct lgfs2_log_header *
 /* rgrp.c */
 extern uint32_t lgfs2_rgblocks2bitblocks(const unsigned int bsize, const uint32_t rgblocks,
                                     uint32_t *ri_data) __attribute__((nonnull(3)));
-extern int lgfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd);
-extern struct rgrp_tree *lgfs2_blk2rgrpd(struct lgfs2_sbd *sdp, uint64_t blk);
+extern int lgfs2_compute_bitstructs(const uint32_t bsize, struct lgfs2_rgrp_tree *rgd);
+extern struct lgfs2_rgrp_tree *lgfs2_blk2rgrpd(struct lgfs2_sbd *sdp, uint64_t blk);
 extern int lgfs2_rgrp_crc_check(char *buf);
 extern void lgfs2_rgrp_crc_set(char *buf);
-extern uint64_t lgfs2_rgrp_read(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd);
-extern void lgfs2_rgrp_relse(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd);
-extern struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree,
+extern uint64_t lgfs2_rgrp_read(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd);
+extern void lgfs2_rgrp_relse(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd);
+extern struct lgfs2_rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree,
 				     uint64_t rgblock);
 extern void lgfs2_rgrp_free(struct lgfs2_sbd *sdp, struct osi_root *rgrp_tree);
 
@@ -764,7 +764,7 @@ extern int lgfs2_build_root(struct lgfs2_sbd *sdp);
 extern int lgfs2_init_inum(struct lgfs2_sbd *sdp);
 extern int lgfs2_init_statfs(struct lgfs2_sbd *sdp, struct gfs2_statfs_change *res);
 extern int lgfs2_check_meta(const char *buf, int type);
-extern unsigned lgfs2_bm_scan(struct rgrp_tree *rgd, unsigned idx,
+extern unsigned lgfs2_bm_scan(struct lgfs2_rgrp_tree *rgd, unsigned idx,
 			      uint64_t *buf, uint8_t state);
 extern struct lgfs2_inode *lgfs2_build_inum_range(struct lgfs2_inode *per_node, unsigned int n);
 extern struct lgfs2_inode *lgfs2_build_statfs_change(struct lgfs2_inode *per_node, unsigned int j);
gfs2/libgfs2/rgrp.c +14 -14
index 3ec56f08..56ee571a 100644
@@ -35,7 +35,7 @@ static void compute_bitmaps(lgfs2_rgrp_t rg, const unsigned bsize)
  * rgd: The resource group descriptor
  * Returns: 0 on success, -1 on error
  */
-int lgfs2_compute_bitstructs(const uint32_t bsize, struct rgrp_tree *rgd)
+int lgfs2_compute_bitstructs(const uint32_t bsize, struct lgfs2_rgrp_tree *rgd)
 {
 	uint32_t length = rgd->rt_length;
 	uint32_t bytes_left;
@@ -86,14 +86,14 @@ errbits:
  *
  * Returns: Ths resource group, or NULL if not found
  */
-struct rgrp_tree *lgfs2_blk2rgrpd(struct lgfs2_sbd *sdp, uint64_t blk)
+struct lgfs2_rgrp_tree *lgfs2_blk2rgrpd(struct lgfs2_sbd *sdp, uint64_t blk)
 {
-	struct rgrp_tree *rgd = (struct rgrp_tree *)sdp->rgtree.osi_node;
+	struct lgfs2_rgrp_tree *rgd = (struct lgfs2_rgrp_tree *)sdp->rgtree.osi_node;
 	while (rgd) {
 		if (blk < rgd->rt_addr)
-			rgd = (struct rgrp_tree *)rgd->node.osi_left;
+			rgd = (struct lgfs2_rgrp_tree *)rgd->node.osi_left;
 		else if (blk >= rgd->rt_data0 + rgd->rt_data)
-			rgd = (struct rgrp_tree *)rgd->node.osi_right;
+			rgd = (struct lgfs2_rgrp_tree *)rgd->node.osi_right;
 		else
 			return rgd;
 	}
@@ -187,7 +187,7 @@ void lgfs2_rgrp_crc_set(char *buf)
  * @rgd - resource group structure
  * returns: 0 if no error, otherwise the block number that failed
  */
-uint64_t lgfs2_rgrp_read(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
+uint64_t lgfs2_rgrp_read(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd)
 {
 	unsigned length = rgd->rt_length * sdp->sd_bsize;
 	off_t offset = rgd->rt_addr * sdp->sd_bsize;
@@ -227,7 +227,7 @@ uint64_t lgfs2_rgrp_read(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
 	return 0;
 }
 
-void lgfs2_rgrp_relse(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
+void lgfs2_rgrp_relse(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd)
 {
 	if (rgd->bits == NULL)
 		return;
@@ -250,14 +250,14 @@ void lgfs2_rgrp_relse(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
 		rgd->bits[i].bi_data = NULL;
 }
 
-struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
+struct lgfs2_rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
 {
 	struct osi_node **newn = &rgtree->osi_node, *parent = NULL;
-	struct rgrp_tree *data;
+	struct lgfs2_rgrp_tree *data;
 
 	/* Figure out where to put new node */
 	while (*newn) {
-		struct rgrp_tree *cur = (struct rgrp_tree *)*newn;
+		struct lgfs2_rgrp_tree *cur = (struct lgfs2_rgrp_tree *)*newn;
 
 		parent = *newn;
 		if (rgblock < cur->rt_addr)
@@ -268,7 +268,7 @@ struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
 			return cur;
 	}
 
-	data = calloc(1, sizeof(struct rgrp_tree));
+	data = calloc(1, sizeof(struct lgfs2_rgrp_tree));
 	if (!data)
 		return NULL;
 	/* Add new node and rebalance tree. */
@@ -281,13 +281,13 @@ struct rgrp_tree *lgfs2_rgrp_insert(struct osi_root *rgtree, uint64_t rgblock)
 
 void lgfs2_rgrp_free(struct lgfs2_sbd *sdp, struct osi_root *rgrp_tree)
 {
-	struct rgrp_tree *rgd;
+	struct lgfs2_rgrp_tree *rgd;
 	struct osi_node *n;
 
 	if (OSI_EMPTY_ROOT(rgrp_tree))
 		return;
 	while ((n = osi_first(rgrp_tree))) {
-		rgd = (struct rgrp_tree *)n;
+		rgd = (struct lgfs2_rgrp_tree *)n;
 
 		lgfs2_rgrp_relse(sdp, rgd);
 		free(rgd->bits);
@@ -504,7 +504,7 @@ void lgfs2_rgrps_free(lgfs2_rgrps_t *rgs)
 	lgfs2_rgrp_t rg;
 	struct osi_root *tree = &(*rgs)->root;
 
-	while ((rg = (struct rgrp_tree *)osi_first(tree))) {
+	while ((rg = (struct lgfs2_rgrp_tree *)osi_first(tree))) {
 		int i;
 		free(rg->bits[0].bi_data);
 		for (i = 0; i < rg->rt_length; i++) {
gfs2/libgfs2/structures.c +3 -3
index d13f67a4..5a1b46d4 100644
@@ -371,7 +371,7 @@ struct lgfs2_inode *lgfs2_build_rindex(struct lgfs2_sbd *sdp)
 {
 	struct lgfs2_inode *ip;
 	struct osi_node *n, *next = NULL;
-	struct rgrp_tree *rl;
+	struct lgfs2_rgrp_tree *rl;
 	char buf[sizeof(struct gfs2_rindex)];
 	int count;
 
@@ -385,7 +385,7 @@ struct lgfs2_inode *lgfs2_build_rindex(struct lgfs2_sbd *sdp)
 
 	for (n = osi_first(&sdp->rgtree); n; n = next) {
 		next = osi_next(n);
-		rl = (struct rgrp_tree *)n;
+		rl = (struct lgfs2_rgrp_tree *)n;
 
 		lgfs2_rindex_out(rl, buf);
 
@@ -497,7 +497,7 @@ int lgfs2_check_meta(const char *buf, int type)
 	return 0;
 }
 
-unsigned lgfs2_bm_scan(struct rgrp_tree *rgd, unsigned idx, uint64_t *buf, uint8_t state)
+unsigned lgfs2_bm_scan(struct lgfs2_rgrp_tree *rgd, unsigned idx, uint64_t *buf, uint8_t state)
 {
 	struct lgfs2_bitmap *bi = &rgd->bits[idx];
 	unsigned n = 0;
gfs2/libgfs2/super.c +3 -3
index d42bdb03..5da262c3 100644
@@ -146,7 +146,7 @@ int lgfs2_read_sb(struct lgfs2_sbd *sdp)
  *
  * Returns: 1 if the rgd seems relatively sane
  */
-static int rgd_seems_ok(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
+static int rgd_seems_ok(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd)
 {
 	uint32_t most_bitmaps_possible;
 
@@ -179,7 +179,7 @@ static int rgd_seems_ok(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
  * If not, we count it as not sane, and therefore, the whole rindex is not to
  * be trusted by fsck.gfs2.
  */
-static int good_on_disk(struct lgfs2_sbd *sdp, struct rgrp_tree *rgd)
+static int good_on_disk(struct lgfs2_sbd *sdp, struct lgfs2_rgrp_tree *rgd)
 {
 	struct lgfs2_buffer_head *bh;
 	int is_rgrp;
@@ -202,7 +202,7 @@ int lgfs2_rindex_read(struct lgfs2_sbd *sdp, uint64_t *rgcount, int *ok)
 {
 	unsigned int rg;
 	int error;
-	struct rgrp_tree *rgd = NULL, *prev_rgd = NULL;
+	struct lgfs2_rgrp_tree *rgd = NULL, *prev_rgd = NULL;
 	uint64_t prev_length = 0;
 
 	*ok = 1;
Signature · 1 line
2.34.1