[Cluster-devel] [PATCH] gfs2-utils: quieten some new build warnings

Andrew Price anprice at redhat.com
Tue May 31 15:46:58 UTC 2011


With Fedora 15 came new versions of autoconf and gcc which brought with
them some handy new warnings.  The new version of autoconf also wants
inline C source to be wrapped in AC_LANG_SOURCE(). This patch silences
the new warnings, mostly by removing variables which are declared but
unused. It also adds gfs2/tune/tunegfs2 to .gitignore.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 .gitignore                       |    1 +
 configure.ac                     |    2 +-
 gfs2/convert/gfs2_convert.c      |   20 +++++++++-----------
 gfs2/edit/extended.c             |    3 +--
 gfs2/fsck/metawalk.c             |    4 ----
 gfs2/fsck/pass1.c                |    4 ----
 group/gfs_controld/member_cman.c |    2 +-
 7 files changed, 13 insertions(+), 23 deletions(-)

diff --git a/.gitignore b/.gitignore
index cbda6f6..62e4ac6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,5 +34,6 @@ gfs2/mkfs/mkfs.gfs2
 gfs2/mount/mount.gfs2
 gfs2/quota/gfs2_quota
 gfs2/tool/gfs2_tool
+gfs2/tune/tunegfs2
 group/gfs_control/gfs_control
 group/gfs_controld/gfs_controld
diff --git a/configure.ac b/configure.ac
index 3fc02d0..5ebff8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ AC_PROG_MAKE_SET
 cc_supports_flag() {
 	local CFLAGS="$@"
 	AC_MSG_CHECKING([whether $CC supports "$@"])
-	AC_COMPILE_IFELSE([int main(){return 0;}] ,
+	AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(){return 0;}])],
 			  [RC=0; AC_MSG_RESULT([yes])],
 			  [RC=1; AC_MSG_RESULT([no])])
 	return $RC
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 55d020c..f376e91 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -22,6 +22,7 @@
 #include <time.h>
 #include <sys/time.h>
 #include <errno.h>
+#include <ctype.h>
 
 #include <linux/types.h>
 #include <linux/gfs2_ondisk.h>
@@ -531,7 +532,7 @@ static int get_inode_metablocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip, str
 	struct gfs2_buffer_head *bh, *dibh = ip->i_bh;
 	osi_list_t *tmp;
 	uint64_t *ptr1, block;
-	int h, header_size, ptrnum;
+	int h, ptrnum;
 	int bufsize = sbp->bsize - sizeof(struct gfs_indirect);
 
 	/* Add dinode block to the list */
@@ -564,8 +565,6 @@ static int get_inode_metablocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip, str
 
 		if (blk->height >= ip->i_di.di_height - 1)
 			continue;
-		header_size = (blk->height > 0 ? sizeof(struct gfs_indirect) :
-			       sizeof(struct gfs_dinode));
 		for (ptr1 = (uint64_t *)blk->ptrbuf, ptrnum = 0;
 		     ptrnum < sbp->sd_inptrs; ptr1++, ptrnum++) {
 			if (!*ptr1)
@@ -1028,6 +1027,9 @@ static int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr, osi_li
 				/* Skip the rindex and jindex inodes for now. */
 				if (block != rindex_addr && block != jindex_addr)
 					error = adjust_inode(sbp, bh);
+					if (error) {
+						return error;
+					}
 			} else { /* It's metadata, but not an inode, so fix the bitmap. */
 				int blk, buf_offset;
 				int bitmap_byte; /* byte within the bitmap to fix */
@@ -1297,7 +1299,7 @@ static int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dir_to_fix)
 {
 	osi_list_t *tmp, *fix;
 	struct inode_block *dir_iblk;
-	uint64_t offset, dirblock;
+	uint64_t dirblock;
 	uint32_t gfs1_inptrs = sbp->sd_inptrs;
 	/* Directory inodes have been converted to gfs2, use gfs2 inptrs */
 	sbp->sd_inptrs = (sbp->bsize - sizeof(struct gfs2_meta_header))
@@ -1309,7 +1311,6 @@ static int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dir_to_fix)
 	seconds = tv.tv_sec;
 	log_notice("\nFixing file and directory information.\n");
 	fflush(stdout);
-	offset = 0;
 	tmp = NULL;
 	/* for every directory in the list */
 	for (fix = dir_to_fix->next; fix != dir_to_fix; fix = fix->next) {
@@ -1927,13 +1928,12 @@ static int conv_build_jindex(struct gfs2_sbd *sdp)
 static unsigned int total_file_blocks(struct gfs2_sbd *sdp, 
 				      uint64_t filesize, int journaled)
 {
-	unsigned int data_blks = 0, meta_blks = 0, total_blks;
+	unsigned int data_blks = 0, meta_blks = 0;
 	unsigned int max, height, bsize;
 	uint64_t *arr;
 
 	/* Now find the total meta blocks required for data_blks */
 	if (filesize <= sdp->bsize - sizeof(struct gfs2_dinode)) {
-		total_blks = 1; /* stuffed inode */
 		goto out;
 	}
 
@@ -1952,12 +1952,10 @@ static unsigned int total_file_blocks(struct gfs2_sbd *sdp,
 		if (arr[height] >= filesize)
 			break;
 	if (height == 1) {
-		total_blks = data_blks + 1; /* dinode has direct ptrs to data blocks */
 		goto out;
 	}
 
 	meta_blks = DIV_RU(data_blks, sdp->sd_inptrs);
-	total_blks = data_blks + meta_blks;
 out:
 	return data_blks + meta_blks;
 }
@@ -2052,8 +2050,8 @@ static void copy_quotas(struct gfs2_sbd *sdp)
 	inode_put(&oq_ip);
 }
 
-static int gfs2_query(int *setonabort, struct gfs2_options *opts,
-		      const char *format, ...)
+static int __attribute__((format(printf, 3, 4))) gfs2_query(int *setonabort,
+                           struct gfs2_options *opts, const char *format, ...) 
 {
 	va_list args;
 	char response;
diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c
index 1e710fa..3cf6f8b 100644
--- a/gfs2/edit/extended.c
+++ b/gfs2/edit/extended.c
@@ -134,7 +134,7 @@ static uint64_t metapath_to_lblock(struct metapath *mp, int hgt)
 static int display_indirect(struct iinfo *ind, int indblocks, int level,
 			    uint64_t startoff)
 {
-	int start_line, total_dirents;
+	int start_line;
 	int cur_height = -1, pndx;
 
 	last_entry_onscreen[dmode] = 0;
@@ -152,7 +152,6 @@ static int display_indirect(struct iinfo *ind, int indblocks, int level,
 			print_gfs2("This indirect block contains %d indirect blocks",
 				   indblocks);
 	}
-	total_dirents = 0;
 	if (dinode_valid() && !S_ISDIR(di.di_mode)) {
 		/* See if we are on an inode or have one in history. */
 		if (level)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 3e7e653..5d48fbe 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -277,13 +277,11 @@ static void dirblk_truncate(struct gfs2_inode *ip, struct gfs2_dirent *fixb,
 {
 	char *bh_end;
 	struct gfs2_dirent de;
-	uint16_t old_rec_len;
 
 	bh_end = bh->b_data + ip->i_sbd->sd_sb.sb_bsize;
 	/* truncate the block to save the most dentries.  To do this we
 	   have to patch the previous dent. */
 	gfs2_dirent_in(&de, (char *)fixb);
-	old_rec_len = de.de_rec_len;
 	de.de_rec_len = bh_end - (char *)fixb;
 	gfs2_dirent_out(&de, (char *)fixb);
 	bmodified(bh);
@@ -304,7 +302,6 @@ static void dirblk_truncate(struct gfs2_inode *ip, struct gfs2_dirent *fixb,
 static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 		  int type, uint16_t *count, struct metawalk_fxns *pass)
 {
-	struct gfs2_leaf *leaf = NULL;
 	struct gfs2_dirent *dent;
 	struct gfs2_dirent de, *prev;
 	int error = 0;
@@ -319,7 +316,6 @@ static int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
 	}
 	else if (type == DIR_EXHASH) {
 		dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_leaf));
-		leaf = (struct gfs2_leaf *)bh->b_data;
 		log_debug( _("Checking leaf %llu (0x%llu)\n"),
 			  (unsigned long long)bh->b_blocknr,
 			  (unsigned long long)bh->b_blocknr);
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 002a781..6649ec8 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1391,8 +1391,6 @@ int pass1(struct gfs2_sbd *sbp)
 	struct rgrp_list *rgd;
 	int first;
 	uint64_t i;
-	uint64_t blk_count;
-	uint64_t offset;
 	uint64_t rg_count = 0;
 
 	/* FIXME: In the gfs fsck, we had to mark things like the
@@ -1433,8 +1431,6 @@ int pass1(struct gfs2_sbd *sbp)
 			gfs2_meta_rgrp);*/
 		}
 
-		offset = sizeof(struct gfs2_rgrp);
-		blk_count = 1;
 		first = 1;
 
 		while (1) {
diff --git a/group/gfs_controld/member_cman.c b/group/gfs_controld/member_cman.c
index 1c377f8..4e482b7 100644
--- a/group/gfs_controld/member_cman.c
+++ b/group/gfs_controld/member_cman.c
@@ -27,7 +27,7 @@ static int is_old_member(uint32_t nodeid)
 	return is_member(old_nodes, old_node_count, nodeid);
 }
 
-int is_cluster_member(uint32_t nodeid)
+static int is_cluster_member(uint32_t nodeid)
 {
 	return is_member(quorum_nodes, quorum_node_count, nodeid);
 }
-- 
1.7.5.2




More information about the Cluster-devel mailing list