cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 0/4] gfs2_utils: Trivial patches
@ 2009-08-19  8:24 Andrew Price
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 1/4] libgfs2: Fix 'dubious one-bit signed bitfield' sparse errors Andrew Price
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Andrew Price @ 2009-08-19  8:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

Here are some patches I forgot I had. They were written while I was playing
with code analysis tools (sparse and clang --analyze) and I left them in a
branch. No semantic changes here, just code cleanup stuff. OK to commit?

Andrew Price (4):
  libgfs2: Fix 'dubious one-bit signed bitfield' sparse errors
  gfs2_quota: Fix sparse error
  libgfs2: Fix "Value stored is never read" warnings
  fsck.gfs2: Make block_mounters static

 gfs2/fsck/initialize.c     |    2 +-
 gfs2/libgfs2/fs_geometry.c |    1 -
 gfs2/libgfs2/gfs1.c        |    3 ---
 gfs2/libgfs2/libgfs2.h     |    6 +++---
 gfs2/libgfs2/misc.c        |    6 +++---
 gfs2/quota/gfs2_quota.h    |    4 +---
 gfs2/quota/main.c          |    4 ++--
 7 files changed, 10 insertions(+), 16 deletions(-)



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Cluster-devel] [PATCH 1/4] libgfs2: Fix 'dubious one-bit signed bitfield' sparse errors
  2009-08-19  8:24 [Cluster-devel] [PATCH 0/4] gfs2_utils: Trivial patches Andrew Price
@ 2009-08-19  8:24 ` Andrew Price
  2009-08-19 12:34   ` Bob Peterson
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 2/4] gfs2_quota: Fix sparse error Andrew Price
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Andrew Price @ 2009-08-19  8:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Fix these sparse errors:

libgfs2.h:575:11: error: dubious one-bit signed bitfield
libgfs2.h:576:10: error: dubious one-bit signed bitfield
libgfs2.h:577:13: error: dubious one-bit signed bitfield

Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
---
 gfs2/libgfs2/libgfs2.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 558283d..b3c9483 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -572,9 +572,9 @@ extern struct gfs2_inode *gfs_inode_get(struct gfs2_sbd *sdp,
 /* gfs2_log.c */
 struct gfs2_options {
 	char *device;
-	int yes:1;
-	int no:1;
-	int query:1;
+	unsigned int yes:1;
+	unsigned int no:1;
+	unsigned int query:1;
 };
 
 #define MSG_DEBUG       7
-- 
1.6.3.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Cluster-devel] [PATCH 2/4] gfs2_quota: Fix sparse error
  2009-08-19  8:24 [Cluster-devel] [PATCH 0/4] gfs2_utils: Trivial patches Andrew Price
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 1/4] libgfs2: Fix 'dubious one-bit signed bitfield' sparse errors Andrew Price
@ 2009-08-19  8:24 ` Andrew Price
  2009-08-19 12:35   ` Bob Peterson
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 3/4] libgfs2: Fix "Value stored is never read" warnings Andrew Price
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 4/4] fsck.gfs2: Make block_mounters static Andrew Price
  3 siblings, 1 reply; 9+ messages in thread
From: Andrew Price @ 2009-08-19  8:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Fix sparse error "marked inline, but without a definition" and make
write_quota_internal static as it's only used in main.c

Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
---
 gfs2/quota/gfs2_quota.h |    4 +---
 gfs2/quota/main.c       |    4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
index 462246f..f15c25b 100644
--- a/gfs2/quota/gfs2_quota.h
+++ b/gfs2/quota/gfs2_quota.h
@@ -66,10 +66,8 @@ void cleanup(void);
 void read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp);
 void get_last_quota_id(int fd, uint32_t *max_id);
 int is_valid_quota_list(int fd);
-inline void read_quota_internal(int fd, unsigned int id, int id_type, 
+void read_quota_internal(int fd, unsigned int id, int id_type,
 				struct gfs2_quota *q);
-inline void write_quota_internal(int fd, unsigned int id, int id_type, 
-				 struct gfs2_quota *q);
 void print_quota_list_warning(void);
 
 /*  check.c  */
diff --git a/gfs2/quota/main.c b/gfs2/quota/main.c
index 16692dd..f80313d 100644
--- a/gfs2/quota/main.c
+++ b/gfs2/quota/main.c
@@ -308,7 +308,7 @@ read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp)
 	close(fd);
 }
 
-inline void 
+void
 read_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
 {
 	/* seek to the appropriate offset in the quota file and read the 
@@ -331,7 +331,7 @@ read_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
 	gfs2_quota_in(q, buf);
 }
 
-inline void 
+static inline void
 write_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
 {
 	/* seek to the appropriate offset in the quota file and read the
-- 
1.6.3.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Cluster-devel] [PATCH 3/4] libgfs2: Fix "Value stored is never read" warnings
  2009-08-19  8:24 [Cluster-devel] [PATCH 0/4] gfs2_utils: Trivial patches Andrew Price
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 1/4] libgfs2: Fix 'dubious one-bit signed bitfield' sparse errors Andrew Price
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 2/4] gfs2_quota: Fix sparse error Andrew Price
@ 2009-08-19  8:24 ` Andrew Price
  2009-08-19 12:47   ` Bob Peterson
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 4/4] fsck.gfs2: Make block_mounters static Andrew Price
  3 siblings, 1 reply; 9+ messages in thread
From: Andrew Price @ 2009-08-19  8:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Building with CC="clang --analyze" gave the following warnings:

- misc.c:126:8: warning: Although the value stored to 'ret' is used in
  the enclosing expression, the value is never actually read from 'ret'
- fs_geometry.c:82:3: warning: Value stored to 'rgsize_specified' is
  never read
- gfs1.c:308:3: warning: Value stored to 'f' is never read

This patch makes them go away.

Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
---
 gfs2/libgfs2/fs_geometry.c |    1 -
 gfs2/libgfs2/gfs1.c        |    3 ---
 gfs2/libgfs2/misc.c        |    6 +++---
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
index e02cc22..1f7b293 100644
--- a/gfs2/libgfs2/fs_geometry.c
+++ b/gfs2/libgfs2/fs_geometry.c
@@ -79,7 +79,6 @@ void compute_rgrp_layout(struct gfs2_sbd *sdp, int rgsize_specified)
 		uint64_t old_length, new_chunk;
 
 		log_info("Existing resource groups:\n");
-		rgsize_specified = TRUE; /* consistently use existing size */
 		for (rgrp = 0, tmp = head->next; tmp != head;
 		     tmp = tmp->next, rgrp++) {
 			rl = osi_list_entry(tmp, struct rgrp_list, list);
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
index b87e895..5cca91d 100644
--- a/gfs2/libgfs2/gfs1.c
+++ b/gfs2/libgfs2/gfs1.c
@@ -303,9 +303,6 @@ int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount)
 	if (gfs1_rindex_read(sdp, fd, &count1))
 	    goto fail;
 	for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next) {
-		enum update_flags f;
-
-		f = not_updated;
 		rgd = osi_list_entry(tmp, struct rgrp_list, list);
 		errblock = gfs2_rgrp_read(sdp, rgd);
 		if (errblock)
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 87e1e30..40e256d 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -123,9 +123,9 @@ int check_for_gfs2(struct gfs2_sbd *sdp)
 		if (strstr(buffer, "0") == 0)
 			continue;
 
-		if ((ret = sscanf(buffer, "%s %s %s %s %d %d",
-				  sdp->device_name, fspath, 
-				  fstype, fsoptions, &fsdump, &fspass)) != 6) 
+		ret = sscanf(buffer, "%s %s %s %s %d %d", sdp->device_name,
+				fspath, fstype, fsoptions, &fsdump, &fspass);
+		if (6 != ret)
 			continue;
 
 		if (strcmp(fstype, "gfs2") != 0)
-- 
1.6.3.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Cluster-devel] [PATCH 4/4] fsck.gfs2: Make block_mounters static
  2009-08-19  8:24 [Cluster-devel] [PATCH 0/4] gfs2_utils: Trivial patches Andrew Price
                   ` (2 preceding siblings ...)
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 3/4] libgfs2: Fix "Value stored is never read" warnings Andrew Price
@ 2009-08-19  8:24 ` Andrew Price
  2009-08-19 12:49   ` Bob Peterson
  3 siblings, 1 reply; 9+ messages in thread
From: Andrew Price @ 2009-08-19  8:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Make block_mounters static - it's only used in initialize.c

Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
---
 gfs2/fsck/initialize.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 8bf5782..789895e 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -31,7 +31,7 @@
  * Change the lock protocol so nobody can mount the fs
  *
  */
-int block_mounters(struct gfs2_sbd *sbp, int block_em)
+static int block_mounters(struct gfs2_sbd *sbp, int block_em)
 {
 	if(block_em) {
 		/* verify it starts with lock_ */
-- 
1.6.3.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Cluster-devel] [PATCH 1/4] libgfs2: Fix 'dubious one-bit signed bitfield' sparse errors
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 1/4] libgfs2: Fix 'dubious one-bit signed bitfield' sparse errors Andrew Price
@ 2009-08-19 12:34   ` Bob Peterson
  0 siblings, 0 replies; 9+ messages in thread
From: Bob Peterson @ 2009-08-19 12:34 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- "Andrew Price" <andy@andrewprice.me.uk> wrote:
| Fix these sparse errors:
| 
| libgfs2.h:575:11: error: dubious one-bit signed bitfield
| libgfs2.h:576:10: error: dubious one-bit signed bitfield
| libgfs2.h:577:13: error: dubious one-bit signed bitfield
| 
| Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
| ---
|  gfs2/libgfs2/libgfs2.h |    6 +++---
|  1 files changed, 3 insertions(+), 3 deletions(-)
| 
| diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
| index 558283d..b3c9483 100644
| --- a/gfs2/libgfs2/libgfs2.h
| +++ b/gfs2/libgfs2/libgfs2.h
| @@ -572,9 +572,9 @@ extern struct gfs2_inode *gfs_inode_get(struct
| gfs2_sbd *sdp,
|  /* gfs2_log.c */
|  struct gfs2_options {
|  	char *device;
| -	int yes:1;
| -	int no:1;
| -	int query:1;
| +	unsigned int yes:1;
| +	unsigned int no:1;
| +	unsigned int query:1;
|  };
|  
|  #define MSG_DEBUG       7
| -- 
| 1.6.3.3
Hi,

ACKed by Bob Peterson <rpeterso@redhat.com>

Regards,

Bob Peterson
Red Hat File Systems



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Cluster-devel] [PATCH 2/4] gfs2_quota: Fix sparse error
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 2/4] gfs2_quota: Fix sparse error Andrew Price
@ 2009-08-19 12:35   ` Bob Peterson
  0 siblings, 0 replies; 9+ messages in thread
From: Bob Peterson @ 2009-08-19 12:35 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- "Andrew Price" <andy@andrewprice.me.uk> wrote:
| Fix sparse error "marked inline, but without a definition" and make
| write_quota_internal static as it's only used in main.c
| 
| Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
| ---
|  gfs2/quota/gfs2_quota.h |    4 +---
|  gfs2/quota/main.c       |    4 ++--
|  2 files changed, 3 insertions(+), 5 deletions(-)
| 
| diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
| index 462246f..f15c25b 100644
| --- a/gfs2/quota/gfs2_quota.h
| +++ b/gfs2/quota/gfs2_quota.h
| @@ -66,10 +66,8 @@ void cleanup(void);
|  void read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp);
|  void get_last_quota_id(int fd, uint32_t *max_id);
|  int is_valid_quota_list(int fd);
| -inline void read_quota_internal(int fd, unsigned int id, int id_type,
| 
| +void read_quota_internal(int fd, unsigned int id, int id_type,
|  				struct gfs2_quota *q);
| -inline void write_quota_internal(int fd, unsigned int id, int
| id_type, 
| -				 struct gfs2_quota *q);
|  void print_quota_list_warning(void);
|  
|  /*  check.c  */
| diff --git a/gfs2/quota/main.c b/gfs2/quota/main.c
| index 16692dd..f80313d 100644
| --- a/gfs2/quota/main.c
| +++ b/gfs2/quota/main.c
| @@ -308,7 +308,7 @@ read_superblock(struct gfs2_sb *sb, struct
| gfs2_sbd *sdp)
|  	close(fd);
|  }
|  
| -inline void 
| +void
|  read_quota_internal(int fd, uint32_t id, int id_type, struct
| gfs2_quota *q)
|  {
|  	/* seek to the appropriate offset in the quota file and read the 
| @@ -331,7 +331,7 @@ read_quota_internal(int fd, uint32_t id, int
| id_type, struct gfs2_quota *q)
|  	gfs2_quota_in(q, buf);
|  }
|  
| -inline void 
| +static inline void
|  write_quota_internal(int fd, uint32_t id, int id_type, struct
| gfs2_quota *q)
|  {
|  	/* seek to the appropriate offset in the quota file and read the
| -- 
| 1.6.3.3
Hi,

ACKed by Bob Peterson <rpeterso@redhat.com>

Regards,

Bob Peterson
Red Hat File Systems



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Cluster-devel] [PATCH 3/4] libgfs2: Fix "Value stored is never read" warnings
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 3/4] libgfs2: Fix "Value stored is never read" warnings Andrew Price
@ 2009-08-19 12:47   ` Bob Peterson
  0 siblings, 0 replies; 9+ messages in thread
From: Bob Peterson @ 2009-08-19 12:47 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- "Andrew Price" <andy@andrewprice.me.uk> wrote:
| Building with CC="clang --analyze" gave the following warnings:
| 
| - misc.c:126:8: warning: Although the value stored to 'ret' is used
| in
|   the enclosing expression, the value is never actually read from
| 'ret'
| - fs_geometry.c:82:3: warning: Value stored to 'rgsize_specified' is
|   never read
| - gfs1.c:308:3: warning: Value stored to 'f' is never read
| 
| This patch makes them go away.
| 
| Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
| ---
(snip)
| +		if (6 != ret)
Hi,

I prefer the form "if (ret != 6)" but this will work.
ACKed by Bob Peterson <rpeterso@redhat.com>

Regards,

Bob Peterson
Red Hat File Systems



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Cluster-devel] [PATCH 4/4] fsck.gfs2: Make block_mounters static
  2009-08-19  8:24 ` [Cluster-devel] [PATCH 4/4] fsck.gfs2: Make block_mounters static Andrew Price
@ 2009-08-19 12:49   ` Bob Peterson
  0 siblings, 0 replies; 9+ messages in thread
From: Bob Peterson @ 2009-08-19 12:49 UTC (permalink / raw)
  To: cluster-devel.redhat.com

----- "Andrew Price" <andy@andrewprice.me.uk> wrote:
| Make block_mounters static - it's only used in initialize.c
| 
| Signed-off-by: Andrew Price <andy@andrewprice.me.uk>
| ---
|  gfs2/fsck/initialize.c |    2 +-
|  1 files changed, 1 insertions(+), 1 deletions(-)
| 
| diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
| index 8bf5782..789895e 100644
| --- a/gfs2/fsck/initialize.c
| +++ b/gfs2/fsck/initialize.c
| @@ -31,7 +31,7 @@
|   * Change the lock protocol so nobody can mount the fs
|   *
|   */
| -int block_mounters(struct gfs2_sbd *sbp, int block_em)
| +static int block_mounters(struct gfs2_sbd *sbp, int block_em)
|  {
|  	if(block_em) {
|  		/* verify it starts with lock_ */
| -- 
| 1.6.3.3
Hi,

ACKed by Bob Peterson <rpeterso@redhat.com>

Regards,

Bob Peterson
Red Hat File Systems



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-08-19 12:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-19  8:24 [Cluster-devel] [PATCH 0/4] gfs2_utils: Trivial patches Andrew Price
2009-08-19  8:24 ` [Cluster-devel] [PATCH 1/4] libgfs2: Fix 'dubious one-bit signed bitfield' sparse errors Andrew Price
2009-08-19 12:34   ` Bob Peterson
2009-08-19  8:24 ` [Cluster-devel] [PATCH 2/4] gfs2_quota: Fix sparse error Andrew Price
2009-08-19 12:35   ` Bob Peterson
2009-08-19  8:24 ` [Cluster-devel] [PATCH 3/4] libgfs2: Fix "Value stored is never read" warnings Andrew Price
2009-08-19 12:47   ` Bob Peterson
2009-08-19  8:24 ` [Cluster-devel] [PATCH 4/4] fsck.gfs2: Make block_mounters static Andrew Price
2009-08-19 12:49   ` 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 NNTP newsgroup(s).