public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: RHEL55 - gfs2_edit: Fix rindex read function for gfs1 file systems
@ 2009-08-31 17:56 Bob Peterson
  0 siblings, 0 replies; only message in thread
From: Bob Peterson @ 2009-08-31 17:56 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f20137d6292b03aaa17cb54a3bd512f575fb0038
Commit:        f20137d6292b03aaa17cb54a3bd512f575fb0038
Parent:        12746b95057fadf513bc904c3d3f97fcf823f5b9
Author:        Bob Peterson <bob@ganesha.peterson>
AuthorDate:    Mon Aug 31 11:36:41 2009 -0500
Committer:     Bob Peterson <rpeterso@redhat.com>
CommitterDate: Mon Aug 31 12:58:09 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 8cc4b1c..e1e2258 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -972,27 +972,16 @@ int parse_rindex(struct gfs2_inode *di, 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. */
-		di->i_di.di_size += ((di->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 offset = 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 offset;
 
-			gfs1_adj = (offset / sd_jbsize) *
-				sizeof(struct gfs2_meta_header);
-			gfs1_adj += sizeof(struct gfs2_meta_header);
-		}
+		offset = print_entry_ndx * risize();
 
-		error = gfs2_readi(di, (void *)&buf, offset + gfs1_adj,
-				   risize());
+		if (gfs1)
+			error = gfs1_readi(di, (void *)&buf, offset, risize());
+		else
+			error = gfs2_readi(di, (void *)&buf, offset, risize());
 		if (!error) /* end of file */
 			break;
 		gfs2_rindex_in(&ri, buf);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-08-31 17:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-31 17:56 cluster: RHEL55 - gfs2_edit: Fix rindex read function for gfs1 file systems Bob Peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).