* sparse fixes
@ 2017-11-06 14:34 Christoph Hellwig
2017-11-06 14:34 ` [PATCH 1/8] xfs: always define STATIC to static noinline Christoph Hellwig
` (7 more replies)
0 siblings, 8 replies; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
Hi all,
the first patch changes how STATIC is defined for debug builds to
make sparse checks for debug builds work without a lot of noise.
The rest fixes up various trivial sparse warnings. After that we
have 5 warnings left, out of one which is in the new scrube code
and looks serious. I'll try to find some time to look into it.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/8] xfs: always define STATIC to static noinline
2017-11-06 14:34 sparse fixes Christoph Hellwig
@ 2017-11-06 14:34 ` Christoph Hellwig
2017-11-06 20:15 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 2/8] xfs: trivial sparse fixes for the new scrub code Christoph Hellwig
` (6 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
Ever since we added the noinline tag there is no good reason to define
away the static for debug builds - we'll get just as good debug
information with our without it, so don't mess up sparse and other
checkers due to it.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs.h | 1 -
fs/xfs/xfs_linux.h | 14 ++------------
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h
index 80cd0fd86783..5ff7f228d616 100644
--- a/fs/xfs/xfs.h
+++ b/fs/xfs/xfs.h
@@ -19,7 +19,6 @@
#define __XFS_H__
#ifdef CONFIG_XFS_DEBUG
-#define STATIC
#define DEBUG 1
#define XFS_BUF_LOCK_TRACKING 1
#endif
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 00a5efeec496..6282bfc1afa9 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -250,10 +250,6 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y)
#define ASSERT(expr) \
(likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
-#ifndef STATIC
-# define STATIC noinline
-#endif
-
#else /* !DEBUG */
#ifdef XFS_WARN
@@ -261,21 +257,15 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y)
#define ASSERT(expr) \
(likely(expr) ? (void)0 : asswarn(#expr, __FILE__, __LINE__))
-#ifndef STATIC
-# define STATIC static noinline
-#endif
-
#else /* !DEBUG && !XFS_WARN */
#define ASSERT(expr) ((void)0)
-#ifndef STATIC
-# define STATIC static noinline
-#endif
-
#endif /* XFS_WARN */
#endif /* DEBUG */
+#define STATIC static noinline
+
#ifdef CONFIG_XFS_RT
/*
--
2.14.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/8] xfs: trivial sparse fixes for the new scrub code
2017-11-06 14:34 sparse fixes Christoph Hellwig
2017-11-06 14:34 ` [PATCH 1/8] xfs: always define STATIC to static noinline Christoph Hellwig
@ 2017-11-06 14:34 ` Christoph Hellwig
2017-11-06 20:10 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 3/8] xfs: mark xfs_errortag_ktype static Christoph Hellwig
` (5 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/scrub/attr.c | 4 ++--
fs/xfs/scrub/bmap.c | 2 +-
fs/xfs/scrub/btree.c | 2 +-
fs/xfs/scrub/dir.c | 2 +-
fs/xfs/scrub/scrub.c | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index 51a553337dc4..99992dd8a5c3 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -91,7 +91,7 @@ xfs_scrub_xattr_listent(
int valuelen)
{
struct xfs_scrub_xattr *sx;
- struct xfs_da_args args = {0};
+ struct xfs_da_args args = { NULL };
int error = 0;
sx = container_of(context, struct xfs_scrub_xattr, context);
@@ -420,7 +420,7 @@ int
xfs_scrub_xattr(
struct xfs_scrub_context *sc)
{
- struct xfs_scrub_xattr sx = { 0 };
+ struct xfs_scrub_xattr sx = { { NULL } };
struct attrlist_cursor_kern cursor = { 0 };
xfs_dablk_t last_checked = -1U;
int error = 0;
diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
index 39fb2a537aea..42fec0bcd9e1 100644
--- a/fs/xfs/scrub/bmap.c
+++ b/fs/xfs/scrub/bmap.c
@@ -229,7 +229,7 @@ xfs_scrub_bmap(
int whichfork)
{
struct xfs_bmbt_irec irec;
- struct xfs_scrub_bmap_info info = {0};
+ struct xfs_scrub_bmap_info info = { NULL };
struct xfs_mount *mp = sc->mp;
struct xfs_inode *ip = sc->ip;
struct xfs_ifork *ifp;
diff --git a/fs/xfs/scrub/btree.c b/fs/xfs/scrub/btree.c
index 9e8b67a07baf..a81440496e7b 100644
--- a/fs/xfs/scrub/btree.c
+++ b/fs/xfs/scrub/btree.c
@@ -414,7 +414,7 @@ xfs_scrub_btree(
struct xfs_owner_info *oinfo,
void *private)
{
- struct xfs_scrub_btree bs = {0};
+ struct xfs_scrub_btree bs = { NULL };
union xfs_btree_ptr ptr;
union xfs_btree_ptr *pp;
union xfs_btree_rec *recp;
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c
index 73ac795aa6a5..d4cd7661633d 100644
--- a/fs/xfs/scrub/dir.c
+++ b/fs/xfs/scrub/dir.c
@@ -560,7 +560,7 @@ xfs_scrub_directory_free_bestfree(
struct xfs_buf *dbp;
struct xfs_buf *bp;
__be16 *bestp;
- __be16 best;
+ __u16 best;
unsigned int stale = 0;
int i;
int error;
diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c
index 8c8b52523fbc..9c42c4efd01e 100644
--- a/fs/xfs/scrub/scrub.c
+++ b/fs/xfs/scrub/scrub.c
@@ -123,7 +123,7 @@
* structure state to decide (in broad terms) if scrub/repair are
* supported by the running kernel.
*/
-int
+static int
xfs_scrub_probe(
struct xfs_scrub_context *sc)
{
--
2.14.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 3/8] xfs: mark xfs_errortag_ktype static
2017-11-06 14:34 sparse fixes Christoph Hellwig
2017-11-06 14:34 ` [PATCH 1/8] xfs: always define STATIC to static noinline Christoph Hellwig
2017-11-06 14:34 ` [PATCH 2/8] xfs: trivial sparse fixes for the new scrub code Christoph Hellwig
@ 2017-11-06 14:34 ` Christoph Hellwig
2017-11-06 20:15 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 4/8] xfs: remove unused debug counts for xfs_lock_inodes Christoph Hellwig
` (4 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_error.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
index 92396d5eb259..4c9f35d983b2 100644
--- a/fs/xfs/xfs_error.c
+++ b/fs/xfs/xfs_error.c
@@ -203,7 +203,7 @@ static struct attribute *xfs_errortag_attrs[] = {
NULL,
};
-struct kobj_type xfs_errortag_ktype = {
+static struct kobj_type xfs_errortag_ktype = {
.release = xfs_sysfs_release,
.sysfs_ops = &xfs_errortag_sysfs_ops,
.default_attrs = xfs_errortag_attrs,
--
2.14.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 4/8] xfs: remove unused debug counts for xfs_lock_inodes
2017-11-06 14:34 sparse fixes Christoph Hellwig
` (2 preceding siblings ...)
2017-11-06 14:34 ` [PATCH 3/8] xfs: mark xfs_errortag_ktype static Christoph Hellwig
@ 2017-11-06 14:34 ` Christoph Hellwig
2017-11-06 20:17 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 5/8] xfs: remove unreachable error injection code in xfs_qm_dqget Christoph Hellwig
` (3 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_inode.c | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index edd98353fbeb..d8226f7a5dde 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -385,14 +385,6 @@ xfs_isilocked(
}
#endif
-#ifdef DEBUG
-int xfs_locked_n;
-int xfs_small_retries;
-int xfs_middle_retries;
-int xfs_lots_retries;
-int xfs_lock_delays;
-#endif
-
/*
* xfs_lockdep_subclass_ok() is only used in an ASSERT, so is only called when
* DEBUG or XFS_WARN is set. And MAX_LOCKDEP_SUBCLASSES is then only defined
@@ -545,24 +537,11 @@ xfs_lock_inodes(
if ((attempts % 5) == 0) {
delay(1); /* Don't just spin the CPU */
-#ifdef DEBUG
- xfs_lock_delays++;
-#endif
}
i = 0;
try_lock = 0;
goto again;
}
-
-#ifdef DEBUG
- if (attempts) {
- if (attempts < 5) xfs_small_retries++;
- else if (attempts < 100) xfs_middle_retries++;
- else xfs_lots_retries++;
- } else {
- xfs_locked_n++;
- }
-#endif
}
/*
--
2.14.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 5/8] xfs: remove unreachable error injection code in xfs_qm_dqget
2017-11-06 14:34 sparse fixes Christoph Hellwig
` (3 preceding siblings ...)
2017-11-06 14:34 ` [PATCH 4/8] xfs: remove unused debug counts for xfs_lock_inodes Christoph Hellwig
@ 2017-11-06 14:34 ` Christoph Hellwig
2017-11-06 20:17 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 6/8] xfs: mark xfs_btree_check_lblock and xfs_btree_check_ptr static Christoph Hellwig
` (2 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_dquot.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 8338b894d54f..d57c2db64e59 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -53,13 +53,6 @@
* otherwise by the lowest id first, see xfs_dqlock2.
*/
-#ifdef DEBUG
-xfs_buftarg_t *xfs_dqerror_target;
-int xfs_do_dqerror;
-int xfs_dqreq_num;
-int xfs_dqerror_mod = 33;
-#endif
-
struct kmem_zone *xfs_qm_dqtrxzone;
static struct kmem_zone *xfs_qm_dqzone;
@@ -770,15 +763,6 @@ xfs_qm_dqget(
return -ESRCH;
}
-#ifdef DEBUG
- if (xfs_do_dqerror) {
- if ((xfs_dqerror_target == mp->m_ddev_targp) &&
- (xfs_dqreq_num++ % xfs_dqerror_mod) == 0) {
- xfs_debug(mp, "Returning error in dqget");
- return -EIO;
- }
- }
-
ASSERT(type == XFS_DQ_USER ||
type == XFS_DQ_PROJ ||
type == XFS_DQ_GROUP);
@@ -786,7 +770,6 @@ xfs_qm_dqget(
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
ASSERT(xfs_inode_dquot(ip, type) == NULL);
}
-#endif
restart:
mutex_lock(&qi->qi_tree_lock);
--
2.14.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 6/8] xfs: mark xfs_btree_check_lblock and xfs_btree_check_ptr static
2017-11-06 14:34 sparse fixes Christoph Hellwig
` (4 preceding siblings ...)
2017-11-06 14:34 ` [PATCH 5/8] xfs: remove unreachable error injection code in xfs_qm_dqget Christoph Hellwig
@ 2017-11-06 14:34 ` Christoph Hellwig
2017-11-06 20:18 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 7/8] xfs: mark xlog_recover_check_summary STATIC Christoph Hellwig
2017-11-06 14:34 ` [PATCH 8/8] xfs: mark xlog_verify_dest_ptr STATIC Christoph Hellwig
7 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/libxfs/xfs_btree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 994fc1c8c7c6..5f33adf8eecb 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -109,7 +109,7 @@ __xfs_btree_check_lblock(
}
/* Check a long btree block header. */
-int
+static int
xfs_btree_check_lblock(
struct xfs_btree_cur *cur,
struct xfs_btree_block *block,
@@ -239,7 +239,7 @@ xfs_btree_check_sptr(
* Check that a given (indexed) btree pointer at a certain level of a
* btree is valid and doesn't point past where it should.
*/
-int
+static int
xfs_btree_check_ptr(
struct xfs_btree_cur *cur,
union xfs_btree_ptr *ptr,
--
2.14.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 7/8] xfs: mark xlog_recover_check_summary STATIC
2017-11-06 14:34 sparse fixes Christoph Hellwig
` (5 preceding siblings ...)
2017-11-06 14:34 ` [PATCH 6/8] xfs: mark xfs_btree_check_lblock and xfs_btree_check_ptr static Christoph Hellwig
@ 2017-11-06 14:34 ` Christoph Hellwig
2017-11-06 20:19 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 8/8] xfs: mark xlog_verify_dest_ptr STATIC Christoph Hellwig
7 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
We already did it in the forward declaration, but not for the function
body itself.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log_recover.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 6e0e38b5b7ad..87b1c331f9eb 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -5825,7 +5825,7 @@ xlog_recover_cancel(
* Read all of the agf and agi counters and check that they
* are consistent with the superblock counters.
*/
-void
+STATIC void
xlog_recover_check_summary(
struct xlog *log)
{
--
2.14.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 8/8] xfs: mark xlog_verify_dest_ptr STATIC
2017-11-06 14:34 sparse fixes Christoph Hellwig
` (6 preceding siblings ...)
2017-11-06 14:34 ` [PATCH 7/8] xfs: mark xlog_recover_check_summary STATIC Christoph Hellwig
@ 2017-11-06 14:34 ` Christoph Hellwig
2017-11-06 20:19 ` Darrick J. Wong
7 siblings, 1 reply; 21+ messages in thread
From: Christoph Hellwig @ 2017-11-06 14:34 UTC (permalink / raw)
To: linux-xfs
We already did it in the forward declaration, but not for the function
body itself.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/xfs/xfs_log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 3ce44e6d6639..38d4227895ae 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -3763,7 +3763,7 @@ xlog_ticket_alloc(
* one of the iclogs. This uses backup pointers stored in a different
* part of the log in case we trash the log structure.
*/
-void
+STATIC void
xlog_verify_dest_ptr(
struct xlog *log,
void *ptr)
--
2.14.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 2/8] xfs: trivial sparse fixes for the new scrub code
2017-11-06 14:34 ` [PATCH 2/8] xfs: trivial sparse fixes for the new scrub code Christoph Hellwig
@ 2017-11-06 20:10 ` Darrick J. Wong
0 siblings, 0 replies; 21+ messages in thread
From: Darrick J. Wong @ 2017-11-06 20:10 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Mon, Nov 06, 2017 at 03:34:50PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/scrub/attr.c | 4 ++--
> fs/xfs/scrub/bmap.c | 2 +-
> fs/xfs/scrub/btree.c | 2 +-
> fs/xfs/scrub/dir.c | 2 +-
> fs/xfs/scrub/scrub.c | 2 +-
> 5 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
> index 51a553337dc4..99992dd8a5c3 100644
> --- a/fs/xfs/scrub/attr.c
> +++ b/fs/xfs/scrub/attr.c
> @@ -91,7 +91,7 @@ xfs_scrub_xattr_listent(
> int valuelen)
> {
> struct xfs_scrub_xattr *sx;
> - struct xfs_da_args args = {0};
> + struct xfs_da_args args = { NULL };
> int error = 0;
>
> sx = container_of(context, struct xfs_scrub_xattr, context);
> @@ -420,7 +420,7 @@ int
> xfs_scrub_xattr(
> struct xfs_scrub_context *sc)
> {
> - struct xfs_scrub_xattr sx = { 0 };
> + struct xfs_scrub_xattr sx = { { NULL } };
gcc 5.4 (Ubuntu 16.04) complains about a missing initializer for sx.sc
here. Seeing as we memset it immediately afterwards, I'll just remove
the whole init thing.
--D
> struct attrlist_cursor_kern cursor = { 0 };
> xfs_dablk_t last_checked = -1U;
> int error = 0;
> diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
> index 39fb2a537aea..42fec0bcd9e1 100644
> --- a/fs/xfs/scrub/bmap.c
> +++ b/fs/xfs/scrub/bmap.c
> @@ -229,7 +229,7 @@ xfs_scrub_bmap(
> int whichfork)
> {
> struct xfs_bmbt_irec irec;
> - struct xfs_scrub_bmap_info info = {0};
> + struct xfs_scrub_bmap_info info = { NULL };
> struct xfs_mount *mp = sc->mp;
> struct xfs_inode *ip = sc->ip;
> struct xfs_ifork *ifp;
> diff --git a/fs/xfs/scrub/btree.c b/fs/xfs/scrub/btree.c
> index 9e8b67a07baf..a81440496e7b 100644
> --- a/fs/xfs/scrub/btree.c
> +++ b/fs/xfs/scrub/btree.c
> @@ -414,7 +414,7 @@ xfs_scrub_btree(
> struct xfs_owner_info *oinfo,
> void *private)
> {
> - struct xfs_scrub_btree bs = {0};
> + struct xfs_scrub_btree bs = { NULL };
> union xfs_btree_ptr ptr;
> union xfs_btree_ptr *pp;
> union xfs_btree_rec *recp;
> diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c
> index 73ac795aa6a5..d4cd7661633d 100644
> --- a/fs/xfs/scrub/dir.c
> +++ b/fs/xfs/scrub/dir.c
> @@ -560,7 +560,7 @@ xfs_scrub_directory_free_bestfree(
> struct xfs_buf *dbp;
> struct xfs_buf *bp;
> __be16 *bestp;
> - __be16 best;
> + __u16 best;
> unsigned int stale = 0;
> int i;
> int error;
> diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c
> index 8c8b52523fbc..9c42c4efd01e 100644
> --- a/fs/xfs/scrub/scrub.c
> +++ b/fs/xfs/scrub/scrub.c
> @@ -123,7 +123,7 @@
> * structure state to decide (in broad terms) if scrub/repair are
> * supported by the running kernel.
> */
> -int
> +static int
> xfs_scrub_probe(
> struct xfs_scrub_context *sc)
> {
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 1/8] xfs: always define STATIC to static noinline
2017-11-06 14:34 ` [PATCH 1/8] xfs: always define STATIC to static noinline Christoph Hellwig
@ 2017-11-06 20:15 ` Darrick J. Wong
0 siblings, 0 replies; 21+ messages in thread
From: Darrick J. Wong @ 2017-11-06 20:15 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Mon, Nov 06, 2017 at 03:34:49PM +0100, Christoph Hellwig wrote:
> Ever since we added the noinline tag there is no good reason to define
> away the static for debug builds - we'll get just as good debug
> information with our without it, so don't mess up sparse and other
> checkers due to it.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs.h | 1 -
> fs/xfs/xfs_linux.h | 14 ++------------
> 2 files changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/fs/xfs/xfs.h b/fs/xfs/xfs.h
> index 80cd0fd86783..5ff7f228d616 100644
> --- a/fs/xfs/xfs.h
> +++ b/fs/xfs/xfs.h
> @@ -19,7 +19,6 @@
> #define __XFS_H__
>
> #ifdef CONFIG_XFS_DEBUG
> -#define STATIC
> #define DEBUG 1
> #define XFS_BUF_LOCK_TRACKING 1
> #endif
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 00a5efeec496..6282bfc1afa9 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -250,10 +250,6 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y)
> #define ASSERT(expr) \
> (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
>
> -#ifndef STATIC
> -# define STATIC noinline
> -#endif
> -
> #else /* !DEBUG */
>
> #ifdef XFS_WARN
> @@ -261,21 +257,15 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y)
> #define ASSERT(expr) \
> (likely(expr) ? (void)0 : asswarn(#expr, __FILE__, __LINE__))
>
> -#ifndef STATIC
> -# define STATIC static noinline
> -#endif
> -
> #else /* !DEBUG && !XFS_WARN */
>
> #define ASSERT(expr) ((void)0)
>
> -#ifndef STATIC
> -# define STATIC static noinline
> -#endif
> -
> #endif /* XFS_WARN */
> #endif /* DEBUG */
>
> +#define STATIC static noinline
> +
> #ifdef CONFIG_XFS_RT
>
> /*
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/8] xfs: mark xfs_errortag_ktype static
2017-11-06 14:34 ` [PATCH 3/8] xfs: mark xfs_errortag_ktype static Christoph Hellwig
@ 2017-11-06 20:15 ` Darrick J. Wong
0 siblings, 0 replies; 21+ messages in thread
From: Darrick J. Wong @ 2017-11-06 20:15 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Mon, Nov 06, 2017 at 03:34:51PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_error.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c
> index 92396d5eb259..4c9f35d983b2 100644
> --- a/fs/xfs/xfs_error.c
> +++ b/fs/xfs/xfs_error.c
> @@ -203,7 +203,7 @@ static struct attribute *xfs_errortag_attrs[] = {
> NULL,
> };
>
> -struct kobj_type xfs_errortag_ktype = {
> +static struct kobj_type xfs_errortag_ktype = {
> .release = xfs_sysfs_release,
> .sysfs_ops = &xfs_errortag_sysfs_ops,
> .default_attrs = xfs_errortag_attrs,
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 4/8] xfs: remove unused debug counts for xfs_lock_inodes
2017-11-06 14:34 ` [PATCH 4/8] xfs: remove unused debug counts for xfs_lock_inodes Christoph Hellwig
@ 2017-11-06 20:17 ` Darrick J. Wong
0 siblings, 0 replies; 21+ messages in thread
From: Darrick J. Wong @ 2017-11-06 20:17 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Mon, Nov 06, 2017 at 03:34:52PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_inode.c | 21 ---------------------
> 1 file changed, 21 deletions(-)
>
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index edd98353fbeb..d8226f7a5dde 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -385,14 +385,6 @@ xfs_isilocked(
> }
> #endif
>
> -#ifdef DEBUG
> -int xfs_locked_n;
> -int xfs_small_retries;
> -int xfs_middle_retries;
> -int xfs_lots_retries;
> -int xfs_lock_delays;
> -#endif
> -
> /*
> * xfs_lockdep_subclass_ok() is only used in an ASSERT, so is only called when
> * DEBUG or XFS_WARN is set. And MAX_LOCKDEP_SUBCLASSES is then only defined
> @@ -545,24 +537,11 @@ xfs_lock_inodes(
>
> if ((attempts % 5) == 0) {
> delay(1); /* Don't just spin the CPU */
> -#ifdef DEBUG
> - xfs_lock_delays++;
> -#endif
> }
> i = 0;
> try_lock = 0;
> goto again;
> }
> -
> -#ifdef DEBUG
> - if (attempts) {
> - if (attempts < 5) xfs_small_retries++;
> - else if (attempts < 100) xfs_middle_retries++;
> - else xfs_lots_retries++;
> - } else {
> - xfs_locked_n++;
> - }
> -#endif
> }
>
> /*
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 5/8] xfs: remove unreachable error injection code in xfs_qm_dqget
2017-11-06 14:34 ` [PATCH 5/8] xfs: remove unreachable error injection code in xfs_qm_dqget Christoph Hellwig
@ 2017-11-06 20:17 ` Darrick J. Wong
0 siblings, 0 replies; 21+ messages in thread
From: Darrick J. Wong @ 2017-11-06 20:17 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Mon, Nov 06, 2017 at 03:34:53PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_dquot.c | 17 -----------------
> 1 file changed, 17 deletions(-)
>
> diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
> index 8338b894d54f..d57c2db64e59 100644
> --- a/fs/xfs/xfs_dquot.c
> +++ b/fs/xfs/xfs_dquot.c
> @@ -53,13 +53,6 @@
> * otherwise by the lowest id first, see xfs_dqlock2.
> */
>
> -#ifdef DEBUG
> -xfs_buftarg_t *xfs_dqerror_target;
> -int xfs_do_dqerror;
> -int xfs_dqreq_num;
> -int xfs_dqerror_mod = 33;
> -#endif
> -
> struct kmem_zone *xfs_qm_dqtrxzone;
> static struct kmem_zone *xfs_qm_dqzone;
>
> @@ -770,15 +763,6 @@ xfs_qm_dqget(
> return -ESRCH;
> }
>
> -#ifdef DEBUG
> - if (xfs_do_dqerror) {
> - if ((xfs_dqerror_target == mp->m_ddev_targp) &&
> - (xfs_dqreq_num++ % xfs_dqerror_mod) == 0) {
> - xfs_debug(mp, "Returning error in dqget");
> - return -EIO;
> - }
> - }
> -
> ASSERT(type == XFS_DQ_USER ||
> type == XFS_DQ_PROJ ||
> type == XFS_DQ_GROUP);
> @@ -786,7 +770,6 @@ xfs_qm_dqget(
> ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> ASSERT(xfs_inode_dquot(ip, type) == NULL);
> }
> -#endif
>
> restart:
> mutex_lock(&qi->qi_tree_lock);
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 6/8] xfs: mark xfs_btree_check_lblock and xfs_btree_check_ptr static
2017-11-06 14:34 ` [PATCH 6/8] xfs: mark xfs_btree_check_lblock and xfs_btree_check_ptr static Christoph Hellwig
@ 2017-11-06 20:18 ` Darrick J. Wong
0 siblings, 0 replies; 21+ messages in thread
From: Darrick J. Wong @ 2017-11-06 20:18 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Mon, Nov 06, 2017 at 03:34:54PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_btree.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
> index 994fc1c8c7c6..5f33adf8eecb 100644
> --- a/fs/xfs/libxfs/xfs_btree.c
> +++ b/fs/xfs/libxfs/xfs_btree.c
> @@ -109,7 +109,7 @@ __xfs_btree_check_lblock(
> }
>
> /* Check a long btree block header. */
> -int
> +static int
> xfs_btree_check_lblock(
> struct xfs_btree_cur *cur,
> struct xfs_btree_block *block,
> @@ -239,7 +239,7 @@ xfs_btree_check_sptr(
> * Check that a given (indexed) btree pointer at a certain level of a
> * btree is valid and doesn't point past where it should.
> */
> -int
> +static int
> xfs_btree_check_ptr(
> struct xfs_btree_cur *cur,
> union xfs_btree_ptr *ptr,
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 7/8] xfs: mark xlog_recover_check_summary STATIC
2017-11-06 14:34 ` [PATCH 7/8] xfs: mark xlog_recover_check_summary STATIC Christoph Hellwig
@ 2017-11-06 20:19 ` Darrick J. Wong
0 siblings, 0 replies; 21+ messages in thread
From: Darrick J. Wong @ 2017-11-06 20:19 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Mon, Nov 06, 2017 at 03:34:55PM +0100, Christoph Hellwig wrote:
> We already did it in the forward declaration, but not for the function
> body itself.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_log_recover.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 6e0e38b5b7ad..87b1c331f9eb 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -5825,7 +5825,7 @@ xlog_recover_cancel(
> * Read all of the agf and agi counters and check that they
> * are consistent with the superblock counters.
> */
> -void
> +STATIC void
> xlog_recover_check_summary(
> struct xlog *log)
> {
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 8/8] xfs: mark xlog_verify_dest_ptr STATIC
2017-11-06 14:34 ` [PATCH 8/8] xfs: mark xlog_verify_dest_ptr STATIC Christoph Hellwig
@ 2017-11-06 20:19 ` Darrick J. Wong
0 siblings, 0 replies; 21+ messages in thread
From: Darrick J. Wong @ 2017-11-06 20:19 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs
On Mon, Nov 06, 2017 at 03:34:56PM +0100, Christoph Hellwig wrote:
> We already did it in the forward declaration, but not for the function
> body itself.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_log.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 3ce44e6d6639..38d4227895ae 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -3763,7 +3763,7 @@ xlog_ticket_alloc(
> * one of the iclogs. This uses backup pointers stored in a different
> * part of the log in case we trash the log structure.
> */
> -void
> +STATIC void
> xlog_verify_dest_ptr(
> struct xlog *log,
> void *ptr)
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* sparse fixes
@ 2018-12-13 8:51 Christoph Hellwig
0 siblings, 0 replies; 21+ messages in thread
From: Christoph Hellwig @ 2018-12-13 8:51 UTC (permalink / raw)
Mostly endianess annoations in the new TCP code, but
nvme_poll_irqdisable didn't make sparse happy, so a small fix there
as well.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Sparse fixes
2014-08-15 16:55 Sparse fixes Lucas Tanure
2014-08-15 17:08 ` Robin Schroer
@ 2014-08-15 17:09 ` Aruna Hewapathirane
1 sibling, 0 replies; 21+ messages in thread
From: Aruna Hewapathirane @ 2014-08-15 17:09 UTC (permalink / raw)
To: kernelnewbies
Hi Lucas,
Not certain if this what your referring to but hope it helps:
http://kernelnewbies.org/Sparse and this:
http://en.wikipedia.org/wiki/Sparse
Good luck - Aruna
On Fri, Aug 15, 2014 at 12:55 PM, Lucas Tanure <tanure@linux.com> wrote:
> Hi, If I do :
>
> $ cat drivers/staging/android/TODO
> TODO:
> - checkpatch.pl cleanups
> - *sparse fixes*
> - rename files to be not so "generic"
> - make sure things build as modules properly
> - add proper arch dependencies as needed
> - audit userspace interfaces to make sure they are sane
>
> Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc:
> Brian Swetland <swetland@google.com>
>
>
> *What are sparse fixes ? *
> *It's a tool to run in the kernel code ? *
>
> Thanks
>
> --
> Lucas Tanure
> +55 (19) 988176559
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140815/f1d0128f/attachment.html
^ permalink raw reply [flat|nested] 21+ messages in thread
* Sparse fixes
2014-08-15 16:55 Sparse fixes Lucas Tanure
@ 2014-08-15 17:08 ` Robin Schroer
2014-08-15 17:09 ` Aruna Hewapathirane
1 sibling, 0 replies; 21+ messages in thread
From: Robin Schroer @ 2014-08-15 17:08 UTC (permalink / raw)
To: kernelnewbies
On Fri, Aug 15, 2014 at 01:55:26PM -0300, Lucas Tanure wrote:
> Hi, If I do :
>
> $ cat drivers/staging/android/TODO
> TODO:
> - checkpatch.pl cleanups
> - *sparse fixes*
> - rename files to be not so "generic"
> - make sure things build as modules properly
> - add proper arch dependencies as needed
> - audit userspace interfaces to make sure they are sane
>
> Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc:
> Brian Swetland <swetland@google.com>
>
>
> *What are sparse fixes ? *
> *It's a tool to run in the kernel code ? *
>
Yes, it is a code analysis tool that tries to detect logical errors the
compiler won't complain about. See http://kernelnewbies.org/Sparse for
more info.
--
Robin Schroer
^ permalink raw reply [flat|nested] 21+ messages in thread
* Sparse fixes
@ 2014-08-15 16:55 Lucas Tanure
2014-08-15 17:08 ` Robin Schroer
2014-08-15 17:09 ` Aruna Hewapathirane
0 siblings, 2 replies; 21+ messages in thread
From: Lucas Tanure @ 2014-08-15 16:55 UTC (permalink / raw)
To: kernelnewbies
Hi, If I do :
$ cat drivers/staging/android/TODO
TODO:
- checkpatch.pl cleanups
- *sparse fixes*
- rename files to be not so "generic"
- make sure things build as modules properly
- add proper arch dependencies as needed
- audit userspace interfaces to make sure they are sane
Please send patches to Greg Kroah-Hartman <greg@kroah.com> and Cc:
Brian Swetland <swetland@google.com>
*What are sparse fixes ? *
*It's a tool to run in the kernel code ? *
Thanks
--
Lucas Tanure
+55 (19) 988176559
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140815/0e7ff9f1/attachment.html
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2018-12-13 8:51 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 14:34 sparse fixes Christoph Hellwig
2017-11-06 14:34 ` [PATCH 1/8] xfs: always define STATIC to static noinline Christoph Hellwig
2017-11-06 20:15 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 2/8] xfs: trivial sparse fixes for the new scrub code Christoph Hellwig
2017-11-06 20:10 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 3/8] xfs: mark xfs_errortag_ktype static Christoph Hellwig
2017-11-06 20:15 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 4/8] xfs: remove unused debug counts for xfs_lock_inodes Christoph Hellwig
2017-11-06 20:17 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 5/8] xfs: remove unreachable error injection code in xfs_qm_dqget Christoph Hellwig
2017-11-06 20:17 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 6/8] xfs: mark xfs_btree_check_lblock and xfs_btree_check_ptr static Christoph Hellwig
2017-11-06 20:18 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 7/8] xfs: mark xlog_recover_check_summary STATIC Christoph Hellwig
2017-11-06 20:19 ` Darrick J. Wong
2017-11-06 14:34 ` [PATCH 8/8] xfs: mark xlog_verify_dest_ptr STATIC Christoph Hellwig
2017-11-06 20:19 ` Darrick J. Wong
-- strict thread matches above, loose matches on Subject: below --
2018-12-13 8:51 sparse fixes Christoph Hellwig
2014-08-15 16:55 Sparse fixes Lucas Tanure
2014-08-15 17:08 ` Robin Schroer
2014-08-15 17:09 ` Aruna Hewapathirane
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.