cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Abhi Das <adas@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] gfs2_utils: more gfs2_convert i_goal fixes
Date: Wed,  1 Apr 2015 09:55:02 -0500	[thread overview]
Message-ID: <1427900102-58542-2-git-send-email-adas@redhat.com> (raw)
In-Reply-To: <1427900102-58542-1-git-send-email-adas@redhat.com>

The correct goal was only being set on files that are >= meta
height 2. This patch fixes this and sets correct goal values for
stuffed, height 1 and jdata files as well

Resolves: rhbz#1186847
Signed-off-by: Abhi Das <adas@redhat.com>
---
 gfs2/convert/gfs2_convert.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 9a42985..bb4e3a2 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -435,9 +435,9 @@ static void jdata_mp_gfs1_to_gfs2(struct gfs2_sbd *sbp, int gfs1_h, int gfs2_h,
 	}
 }
 
-static void fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
-		  struct blocklist *blk, char *srcptr,
-		  unsigned int size)
+static uint64_t fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
+			      struct blocklist *blk, char *srcptr,
+			      unsigned int size)
 {
 	uint64_t block;
 	struct gfs2_buffer_head *bh;
@@ -499,6 +499,7 @@ static void fix_jdatatree(struct gfs2_sbd *sbp, struct gfs2_inode *ip,
 		amount = size - copied;
 		ptramt = 0;
 	}
+	return block;
 }
 
 static int get_inode_metablocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip, struct blocklist *blocks)
@@ -620,7 +621,7 @@ static int fix_ind_reg_or_dir(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint3
 	blk->height -= di_height - gfs2_hgt;
 	if (len) {
 		fix_metatree(sbp, ip, blk, ptr1, len);
-		ip->i_di.di_goal_data = ip->i_di.di_goal_meta = be64_to_cpu(*ptr2);
+		ip->i_di.di_goal_meta = be64_to_cpu(*ptr2);
 	}
 
 	return 0;
@@ -687,7 +688,8 @@ static int fix_ind_jdata(struct gfs2_sbd *sbp, struct gfs2_inode *ip, uint32_t d
 		memcpy(&newblk->mp, &gfs2mp, sizeof(struct metapath));
 		newblk->height -= di_height - gfs2_hgt;
 		if (len)
-			fix_jdatatree(sbp, ip, newblk, newblk->ptrbuf, len);
+			ip->i_di.di_goal_meta = fix_jdatatree(sbp, ip, newblk,
+							      newblk->ptrbuf, len);
 		free(newblk->ptrbuf);
 		free(newblk);
 	}
@@ -705,12 +707,16 @@ static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip)
 	int isdir = S_ISDIR(ip->i_di.di_mode); /* is always jdata */
 	int isjdata = ((GFS2_DIF_JDATA & ip->i_di.di_flags) && !isdir);
 	int isreg = (!isjdata && !isdir);
+	int issys = (GFS2_DIF_SYSTEM & ip->i_di.di_flags);
 
 	/* regular files and dirs are same upto height=2
 	   jdata files (not dirs) are same only when height=0 */
 	if (((isreg||isdir) && ip->i_di.di_height <= 1) ||
-	    (isjdata && ip->i_di.di_height == 0))
+	    (isjdata && ip->i_di.di_height == 0)) {
+		if (!issys)
+			ip->i_di.di_goal_meta = ip->i_di.di_num.no_addr;
 		return 0; /* nothing to do */
+	}
 
 	osi_list_init(&blocks.list);
 
-- 
1.8.1.4



      reply	other threads:[~2015-04-01 14:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01 14:55 [Cluster-devel] gfs2-utils: more fsck.gfs2 i_goal fixes Abhi Das
2015-04-01 14:55 ` Abhi Das [this message]

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=1427900102-58542-2-git-send-email-adas@redhat.com \
    --to=adas@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 NNTP newsgroup(s).