Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 9383e745e23602bc45f9c92184feea59 > files > 68

gfs2-utils-0.1.62-28.el5.src.rpm

commit bbd213cf02b9f427342d75e4c05d4cf95d80d8ef
Author: Bob Peterson <bob@ganesha.peterson>
Date:   Thu Feb 25 13:27:22 2010 -0600

    gfs2: fix regressions from performance fixes
    
    This patch fixes regressions recently introduced by the performance
    enhancements for fsck.gfs2 and libgfs2.
    
    rhbz#455300

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 643fdb5..2394eac 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -2549,7 +2549,7 @@ static void process_field(const char *field, uint64_t *newval, int print_field)
 	struct gfs2_rgrp rg;
 
 	fblock = blockstack[blockhist % BLOCK_STACK_SIZE].block;
-	rbh = bread(&sbd, block);
+	rbh = bread(&sbd, fblock);
 	type = get_block_type(rbh);
 
 	switch (type) {
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 1b5c2c1..d47b283 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -290,6 +290,7 @@ static void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
 		if (height != hgt) { /* If not at max height */
 			nbh = bread(&sbd, indir_block);
 			osi_list_add_prev(&nbh->b_altlist, cur_list);
+			brelse(nbh);
 		}
 	} /* for all data on the indirect block */
 }
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 4969ad5..aed34c6 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -674,14 +674,10 @@ struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn,
 		bmodified(ip->i_bh);
 		ip->i_di.di_size = (lbn + 1) << sdp->sd_sb.sb_bsize_shift;
 	}
-	if (new)
-		return bget(sdp, dbn);
-	else {
-		if (dbn == ip->i_di.di_num.no_addr)
-			return ip->i_bh;
-		else
-			return bread(sdp, dbn);
-	}
+	if (dbn == ip->i_di.di_num.no_addr)
+		return ip->i_bh;
+	else
+		return bread(sdp, dbn);
 }
 
 int gfs2_dirent_first(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 5e176a9..ea0ca6a 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -118,6 +118,7 @@ void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
 		if (!bh)
 			die("write_journal\n");
 
+		memset(bh->b_data, 0, sdp->bsize);
 		lh.lh_sequence = seq;
 		lh.lh_blkno = x;
 		gfs2_log_header_out(&lh, bh);
@@ -216,6 +217,8 @@ build_quota_change(struct gfs2_inode *per_node, unsigned int j)
 	struct gfs2_inode *ip;
 	unsigned int blocks = sdp->qcsize << (20 - sdp->sd_sb.sb_bsize_shift);
 	unsigned int x;
+	unsigned int hgt;
+	struct gfs2_buffer_head *bh;
 
 	memset(&mh, 0, sizeof(struct gfs2_meta_header));
 	mh.mh_magic = GFS2_MAGIC;
@@ -223,16 +226,18 @@ build_quota_change(struct gfs2_inode *per_node, unsigned int j)
 	mh.mh_format = GFS2_FORMAT_QC;
 
 	sprintf(name, "quota_change%u", j);
-	ip = createi(per_node, name, S_IFREG | 0600,
-		     GFS2_DIF_SYSTEM);
+	ip = createi(per_node, name, S_IFREG | 0600, GFS2_DIF_SYSTEM);
+
+	hgt = calc_tree_height(ip, (blocks + 1) * sdp->bsize);
+	build_height(ip, hgt);
 
 	for (x = 0; x < blocks; x++) {
-		struct gfs2_buffer_head *bh = get_file_buf(ip, ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift, FALSE);
+		bh = get_file_buf(ip, x, FALSE);
 		if (!bh)
 			die("build_quota_change\n");
 
+		memset(bh->b_data, 0, sdp->bsize);
 		gfs2_meta_header_out(&mh, bh);
-
 		brelse(bh);
 	}
 
@@ -313,8 +318,7 @@ build_rindex(struct gfs2_sbd *sdp)
 	ip->i_di.di_payload_format = GFS2_FORMAT_RI;
 	bmodified(ip->i_bh);
 
-	for (head = &sdp->rglist, tmp = head->next;
-	     tmp != head;
+	for (head = &sdp->rglist, tmp = head->next; tmp != head;
 	     tmp = tmp->next) {
 		rl = osi_list_entry(tmp, struct rgrp_list, list);
 
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
index a8e2f66..a6fac0a 100644
--- a/gfs2/mkfs/main_grow.c
+++ b/gfs2/mkfs/main_grow.c
@@ -216,6 +216,8 @@ static void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
 		gfs2_rindex_out(&rl->ri, bufptr);
 		bufptr += sizeof(struct gfs2_rindex);
 	}
+	gfs2_rgrp_free(&sdp->rglist);
+	fsync(sdp->device_fd);
 	if (!test) {
 		/* Now write the new RGs to the end of the rindex */
 		lseek(rindex_fd, 0, SEEK_END);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 31ef735..3dc3337 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -505,6 +505,7 @@ main_mkfs(int argc, char *argv[])
 	inode_put(&sdp->md.inum);
 	inode_put(&sdp->md.statfs);
 
+	gfs2_rgrp_free(&sdp->rglist);
 	error = fsync(sdp->device_fd);
 	if (error)
 		die( _("can't fsync device (%d): %s\n"),
diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
index 064c813..e79757d 100644
--- a/gfs2/quota/gfs2_quota.h
+++ b/gfs2/quota/gfs2_quota.h
@@ -73,8 +73,6 @@ struct commandline {
 };
 typedef struct commandline commandline_t;
 
-extern char *prog_name;
-
 /*  main.c  */
 
 void do_get_super(int fd, struct gfs2_sb *sb);