public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: gfs2-utils: master - gfs2_edit: Fix rindex read function for gfs1 file systems
Date: Mon, 31 Aug 2009 17:32:00 -0000	[thread overview]
Message-ID: <20090831173222.113C41201FC@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=dff596f6973d56e873e4de38f56d4dbcd578b5ad
Commit:        dff596f6973d56e873e4de38f56d4dbcd578b5ad
Parent:        fdad1b22f08f2bd24cb1983774d6a513306c4647
Author:        Bob Peterson <bob@ganesha.peterson>
AuthorDate:    Mon Aug 31 11:47:42 2009 -0500
Committer:     Bob Peterson <rpeterso@redhat.com>
CommitterDate: Mon Aug 31 12:32:10 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 de3d4a7..3582a7f 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -963,27 +963,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);


                 reply	other threads:[~2009-08-31 17:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090831173222.113C41201FC@lists.fedorahosted.org \
    --to=rpeterso@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).