cluster: STABLE3 - gfs2_edit: Fix rindex read function for gfs1 file systems

Bob Peterson rpeterso@fedoraproject.org
Mon Aug 31 17:34:00 GMT 2009


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=e3d5be1efbc63c7c5809633be8411ae302974dab
Commit:        e3d5be1efbc63c7c5809633be8411ae302974dab
Parent:        a3dadcedb804eabfc014b31ba5258d46175828a0
Author:        Bob Peterson <bob@ganesha.peterson>
AuthorDate:    Mon Aug 31 11:47:42 2009 -0500
Committer:     Bob Peterson <bob@ganesha.peterson>
CommitterDate: Mon Aug 31 11:47:42 2009 -0500

gfs2_edit: Fix rindex read function for gfs1 file systems

The gfs2_edit program was written before libgfs2 had
support for GFS1 data structures, therefore, the reading
of rindex was horribly kludged.  This switches to the new
standard way of reading rindex for GFS1.

rhbz#503529
---
 gfs2/edit/hexedit.c |   25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 35fce6e..5a01b1f 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -961,27 +961,16 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex)
 	eol(0);
 	lines_per_row[dmode] = 6;
 	memset(highlighted_addr, 0, sizeof(highlighted_addr));
-	if (gfs1) {
-		/* gfs1 rindex files have the meta_header which is not
-		   accounted for in gfs2's dinode size.  Therefore, adjust. */
-		dip->i_di.di_size += ((dip->i_di.di_size / sbd.bsize) + 1) *
-			sizeof(struct gfs2_meta_header);
-	}
-	for (print_entry_ndx=0; ; print_entry_ndx++) {
-		uint64_t gfs1_adj = 0;
-		uint64_t roffset = print_entry_ndx * risize();
 
-		if (gfs1) {
-			uint64_t sd_jbsize =
-				(sbd.bsize - sizeof(struct gfs2_meta_header));
+	for (print_entry_ndx=0; ; print_entry_ndx++) {
+		uint64_t roff;
 
-			gfs1_adj = (roffset / sd_jbsize) *
-				sizeof(struct gfs2_meta_header);
-			gfs1_adj += sizeof(struct gfs2_meta_header);
-		}
+		roff = print_entry_ndx * risize();
 
-		error = gfs2_readi(dip, (void *)&rbuf, roffset + gfs1_adj,
-				   risize());
+		if (gfs1)
+			error = gfs1_readi(dip, (void *)&rbuf, roff, risize());
+		else
+			error = gfs2_readi(dip, (void *)&rbuf, roff, risize());
 		if (!error) /* end of file */
 			break;
 		gfs2_rindex_in(&ri, rbuf);



More information about the Cluster-cvs mailing list