2009-03-04 18:33:41

by Hannes Eder

[permalink] [raw]
Subject: [PATCH 0/3] xfs: fix sparse warnings

The following series fixes a fair amount of the remaining sparse
warnings in fs/xfs with !CONFIG_XFS_DEBUG.

With CONFIG_XFS_DEBUG we still got alot of "Should it be static?"
warnings, but that's a different issue.

---
Hannes Eder (3):
xfs: include header files for prototypes
xfs: make symbols static
xfs: move declaration to header file

fs/xfs/linux-2.6/xfs_ioctl.c | 1 +
fs/xfs/linux-2.6/xfs_super.c | 6 +++---
fs/xfs/support/debug.c | 1 +
fs/xfs/xfs_bmap.c | 2 +-
fs/xfs/xfs_da_btree.h | 1 +
fs/xfs/xfs_dir2.c | 2 --
fs/xfs/xfs_dir2_leaf.c | 2 +-
7 files changed, 8 insertions(+), 7 deletions(-)


2009-03-04 18:34:29

by Hannes Eder

[permalink] [raw]
Subject: [PATCH 2/3] xfs: make symbols static

Instead of the keyword 'static' the macro 'STATIC' is used, so the
symbols are still global with CONFIG_XFS_DEBUG.

Fix this sparse warnings:
fs/xfs/linux-2.6/xfs_super.c:638:1: warning: symbol 'xfs_blkdev_get' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_super.c:655:1: warning: symbol 'xfs_blkdev_put' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_super.c:876:1: warning: symbol 'xfsaild' was not declared. Should it be static?
fs/xfs/xfs_bmap.c:6208:1: warning: symbol 'xfs_check_block' was not declared. Should it be static?
fs/xfs/xfs_dir2_leaf.c:553:1: warning: symbol 'xfs_dir2_leaf_check' was not declared. Should it be static?

Signed-off-by: Hannes Eder <[email protected]>
---
fs/xfs/linux-2.6/xfs_super.c | 6 +++---
fs/xfs/xfs_bmap.c | 2 +-
fs/xfs/xfs_dir2_leaf.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index bc1e647..9633c3c 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -633,7 +633,7 @@ xfs_max_file_offset(
return (((__uint64_t)pagefactor) << bitshift) - 1;
}

-int
+STATIC int
xfs_blkdev_get(
xfs_mount_t *mp,
const char *name,
@@ -650,7 +650,7 @@ xfs_blkdev_get(
return -error;
}

-void
+STATIC void
xfs_blkdev_put(
struct block_device *bdev)
{
@@ -871,7 +871,7 @@ xfsaild_wakeup(
wake_up_process(ailp->xa_task);
}

-int
+STATIC int
xfsaild(
void *data)
{
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index c852cd6..27062d0 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -6204,7 +6204,7 @@ xfs_bmap_get_bp(
return(bp);
}

-void
+STATIC void
xfs_check_block(
struct xfs_btree_block *block,
xfs_mount_t *mp,
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index ef805a3..6427ff1 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -549,7 +549,7 @@ xfs_dir2_leaf_addname(
* Check the internal consistency of a leaf1 block.
* Pop an assert if something is wrong.
*/
-void
+STATIC void
xfs_dir2_leaf_check(
xfs_inode_t *dp, /* incore directory inode */
xfs_dabuf_t *bp) /* leaf's buffer */

2009-03-04 18:34:49

by Hannes Eder

[permalink] [raw]
Subject: [PATCH 3/3] xfs: include header files for prototypes

Fix this sparse warnings:
fs/xfs/linux-2.6/xfs_ioctl.c:72:1: warning: symbol 'xfs_find_handle' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:249:1: warning: symbol 'xfs_open_by_handle' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:361:1: warning: symbol 'xfs_readlink_by_handle' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:496:1: warning: symbol 'xfs_attrmulti_attr_get' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:525:1: warning: symbol 'xfs_attrmulti_attr_set' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:555:1: warning: symbol 'xfs_attrmulti_attr_remove' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:657:1: warning: symbol 'xfs_ioc_space' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:1340:1: warning: symbol 'xfs_file_ioctl' was not declared. Should it be static?
fs/xfs/support/debug.c:65:1: warning: symbol 'xfs_fs_vcmn_err' was not declared. Should it be static?
fs/xfs/support/debug.c:112:1: warning: symbol 'xfs_hex_dump' was not declared. Should it be static?

Signed-off-by: Hannes Eder <[email protected]>
---
fs/xfs/linux-2.6/xfs_ioctl.c | 1 +
fs/xfs/support/debug.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 6f04493..d0b4994 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -34,6 +34,7 @@
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
+#include "xfs_ioctl.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_rtalloc.h"
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
index ae54829..f49cbc1 100644
--- a/fs/xfs/support/debug.c
+++ b/fs/xfs/support/debug.c
@@ -19,6 +19,7 @@
#include "debug.h"

/* xfs_mount.h drags a lot of crap in, sorry.. */
+#include "xfs_error.h"
#include "xfs_sb.h"
#include "xfs_inum.h"
#include "xfs_ag.h"

2009-03-04 18:34:11

by Hannes Eder

[permalink] [raw]
Subject: [PATCH 1/3] xfs: move declaration to header file

Fix this sparse warning:
fs/xfs/xfs_da_btree.c:1550:26: warning: symbol 'xfs_default_nameops' was not declared. Should it be static?

Signed-off-by: Hannes Eder <[email protected]>
---
fs/xfs/xfs_da_btree.h | 1 +
fs/xfs/xfs_dir2.c | 2 --
2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h
index 9d5a7e8..41f27b3 100644
--- a/fs/xfs/xfs_da_btree.h
+++ b/fs/xfs/xfs_da_btree.h
@@ -268,5 +268,6 @@ xfs_daddr_t xfs_da_blkno(xfs_dabuf_t *dabuf);

extern struct kmem_zone *xfs_da_state_zone;
extern struct kmem_zone *xfs_dabuf_zone;
+extern const struct xfs_nameops xfs_default_nameops;

#endif /* __XFS_DA_BTREE_H__ */
diff --git a/fs/xfs/xfs_dir2.c b/fs/xfs/xfs_dir2.c
index 1afb122..c657bec 100644
--- a/fs/xfs/xfs_dir2.c
+++ b/fs/xfs/xfs_dir2.c
@@ -46,8 +46,6 @@

struct xfs_name xfs_name_dotdot = {"..", 2};

-extern const struct xfs_nameops xfs_default_nameops;
-
/*
* ASCII case-insensitive (ie. A-Z) support for directories that was
* used in IRIX.

2009-03-05 13:39:29

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 1/3] xfs: move declaration to header file

On Wed, Mar 04, 2009 at 07:33:48PM +0100, Hannes Eder wrote:
> Fix this sparse warning:
> fs/xfs/xfs_da_btree.c:1550:26: warning: symbol 'xfs_default_nameops' was not declared. Should it be static?
>
> Signed-off-by: Hannes Eder <[email protected]>

Looks good to me.

And for future patches please always send them to the mailinglist
([email protected])

2009-03-05 13:41:57

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 2/3] xfs: make symbols static

On Wed, Mar 04, 2009 at 07:34:10PM +0100, Hannes Eder wrote:
> Instead of the keyword 'static' the macro 'STATIC' is used, so the
> symbols are still global with CONFIG_XFS_DEBUG.

Looks good.

2009-03-05 13:43:56

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 3/3] xfs: include header files for prototypes

looks good, except for a tiny nit-pick:

> +++ b/fs/xfs/support/debug.c
> @@ -19,6 +19,7 @@
> #include "debug.h"
>
> /* xfs_mount.h drags a lot of crap in, sorry.. */
> +#include "xfs_error.h"
> #include "xfs_sb.h"
> #include "xfs_inum.h"
> #include "xfs_ag.h"

as xfs_mount.h doesn't require xfs_error.h it should be included
above that comment.

2009-03-05 14:22:00

by Hannes Eder

[permalink] [raw]
Subject: [PATCH 3/3 v2] xfs: include header files for prototypes

Fix this sparse warnings:
fs/xfs/linux-2.6/xfs_ioctl.c:72:1: warning: symbol 'xfs_find_handle' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:249:1: warning: symbol 'xfs_open_by_handle' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:361:1: warning: symbol 'xfs_readlink_by_handle' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:496:1: warning: symbol 'xfs_attrmulti_attr_get' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:525:1: warning: symbol 'xfs_attrmulti_attr_set' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:555:1: warning: symbol 'xfs_attrmulti_attr_remove' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:657:1: warning: symbol 'xfs_ioc_space' was not declared. Should it be static?
fs/xfs/linux-2.6/xfs_ioctl.c:1340:1: warning: symbol 'xfs_file_ioctl' was not declared. Should it be static?
fs/xfs/support/debug.c:65:1: warning: symbol 'xfs_fs_vcmn_err' was not declared. Should it be static?
fs/xfs/support/debug.c:112:1: warning: symbol 'xfs_hex_dump' was not declared. Should it be static?

Signed-off-by: Hannes Eder <[email protected]>
Acked-by: Christoph Hellwig <[email protected]>
---

On Thu, Mar 5, 2009 at 2:39 PM, Christoph Hellwig <[email protected]> wrote:
> looks good, except for a tiny nit-pick:

I still treat this as a Acked-by: ... Ok?

>> +++ b/fs/xfs/support/debug.c
>> @@ -19,6 +19,7 @@
>> #include "debug.h"
>>
>> /* xfs_mount.h drags a lot of crap in, sorry.. */
>> +#include "xfs_error.h"
>> #include "xfs_sb.h"
>> #include "xfs_inum.h"
>> #include "xfs_ag.h"
>
> as xfs_mount.h doesn't require xfs_error.h it should be included
> above that comment.

hm. but that way it is still included before xfs_mount.h.


fs/xfs/linux-2.6/xfs_ioctl.c | 1 +
fs/xfs/support/debug.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index 6f04493..d0b4994 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -34,6 +34,7 @@
#include "xfs_dir2_sf.h"
#include "xfs_dinode.h"
#include "xfs_inode.h"
+#include "xfs_ioctl.h"
#include "xfs_btree.h"
#include "xfs_ialloc.h"
#include "xfs_rtalloc.h"
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
index ae54829..930bb34 100644
--- a/fs/xfs/support/debug.c
+++ b/fs/xfs/support/debug.c
@@ -17,6 +17,7 @@
*/
#include <xfs.h>
#include "debug.h"
+#include "xfs_error.h"

/* xfs_mount.h drags a lot of crap in, sorry.. */
#include "xfs_sb.h"

2009-03-05 17:43:36

by Felix Blyakher

[permalink] [raw]
Subject: Re: [PATCH 0/3] xfs: fix sparse warnings


On Mar 4, 2009, at 12:33 PM, Hannes Eder wrote:

> The following series fixes a fair amount of the remaining sparse
> warnings in fs/xfs with !CONFIG_XFS_DEBUG.
>
> With CONFIG_XFS_DEBUG we still got alot of "Should it be static?"
> warnings, but that's a different issue.

Looks good to me with the changes Christoph pointed out.
I'll push it in. Thanks.

Reviewed-by: Felix Blyakher <[email protected]>

>
>
> ---
> Hannes Eder (3):
> xfs: include header files for prototypes
> xfs: make symbols static
> xfs: move declaration to header file
>
> fs/xfs/linux-2.6/xfs_ioctl.c | 1 +
> fs/xfs/linux-2.6/xfs_super.c | 6 +++---
> fs/xfs/support/debug.c | 1 +
> fs/xfs/xfs_bmap.c | 2 +-
> fs/xfs/xfs_da_btree.h | 1 +
> fs/xfs/xfs_dir2.c | 2 --
> fs/xfs/xfs_dir2_leaf.c | 2 +-
> 7 files changed, 8 insertions(+), 7 deletions(-)

2009-03-05 21:29:38

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 3/3 v2] xfs: include header files for prototypes

On Thu, Mar 05, 2009 at 03:20:25PM +0100, Hannes Eder wrote:
> I still treat this as a Acked-by: ... Ok?

Should be a review, as far as you can review these sort of patches..

> hm. but that way it is still included before xfs_mount.h.

Sure, but the point is entirely the comment which describes the block
of includes below.