mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] staging: lustre: selftest: fix various sparse warnings
@ 2014-12-27 20:46 Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 1/5] staging: lustre: selftest: fix "not declared" by declaring in header Jeremiah Mahler
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Jeremiah Mahler @ 2014-12-27 20:46 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: Andreas Dilger, Greg Kroah-Hartman, Peng Tao,
	Peter Zijlstra (Intel),
	Greg Donald, Anton Saraev, Vitaly Osipov, Joe Perches,
	HPDD-discuss, devel, linux-kernel, Jeremiah Mahler

These patches fix most of the "undeclared" and "context imbalance"
sparse warnings for the lustre code in the selftest/ directory.

Jeremiah Mahler (5):
  staging: lustre: selftest: fix "not declared" by declaring in header
  staging: lustre: selftest: fix "not declared" by declaring static
  staging: lustre: selftest: fix sfw_deactivate_session context
    imbalance
  staging: lustre: selftest: fix _post_buffer context imbalance
  staging: lustre: selftest: fix _recycle_buffer context imbalance

 drivers/staging/lustre/lnet/selftest/framework.c |  4 ++--
 drivers/staging/lustre/lnet/selftest/rpc.c       |  4 +++-
 drivers/staging/lustre/lnet/selftest/selftest.h  | 12 ++++++++++++
 drivers/staging/lustre/lnet/selftest/timer.c     |  2 +-
 4 files changed, 18 insertions(+), 4 deletions(-)

-- 
2.1.4


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

* [PATCH 1/5] staging: lustre: selftest: fix "not declared" by declaring in header
  2014-12-27 20:46 [PATCH 0/5] staging: lustre: selftest: fix various sparse warnings Jeremiah Mahler
@ 2014-12-27 20:46 ` Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 2/5] staging: lustre: selftest: fix "not declared" by declaring static Jeremiah Mahler
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeremiah Mahler @ 2014-12-27 20:46 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: Andreas Dilger, Greg Kroah-Hartman, Peng Tao,
	Peter Zijlstra (Intel),
	Greg Donald, Anton Saraev, Vitaly Osipov, Joe Perches,
	HPDD-discuss, devel, linux-kernel, Jeremiah Mahler

Fix several "symbol '...' was not declared" sparse warnings which
are caused by global variables by declaring them in the header file.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
---
 drivers/staging/lustre/lnet/selftest/selftest.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/lustre/lnet/selftest/selftest.h b/drivers/staging/lustre/lnet/selftest/selftest.h
index 9b5c5df..d487018 100644
--- a/drivers/staging/lustre/lnet/selftest/selftest.h
+++ b/drivers/staging/lustre/lnet/selftest/selftest.h
@@ -609,4 +609,16 @@ srpc_wait_service_shutdown(srpc_service_t *sv)
 	}
 }
 
+extern sfw_test_client_ops_t brw_test_client;
+void brw_init_test_client(void);
+
+extern srpc_service_t brw_test_service;
+void brw_init_test_service(void);
+
+extern sfw_test_client_ops_t ping_test_client;
+void ping_init_test_client(void);
+
+extern srpc_service_t ping_test_service;
+void ping_init_test_service(void);
+
 #endif /* __SELFTEST_SELFTEST_H__ */
-- 
2.1.4


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

* [PATCH 2/5] staging: lustre: selftest: fix "not declared" by declaring static
  2014-12-27 20:46 [PATCH 0/5] staging: lustre: selftest: fix various sparse warnings Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 1/5] staging: lustre: selftest: fix "not declared" by declaring in header Jeremiah Mahler
@ 2014-12-27 20:46 ` Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 3/5] staging: lustre: selftest: fix sfw_deactivate_session context imbalance Jeremiah Mahler
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jeremiah Mahler @ 2014-12-27 20:46 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: Andreas Dilger, Greg Kroah-Hartman, Peng Tao,
	Peter Zijlstra (Intel),
	Greg Donald, Anton Saraev, Vitaly Osipov, Joe Perches,
	HPDD-discuss, devel, linux-kernel, Jeremiah Mahler

Fix several "symbol '...' was not declared" sparse warnings
for variables which are only used locally by declaring them static.

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
---
 drivers/staging/lustre/lnet/selftest/framework.c | 2 +-
 drivers/staging/lustre/lnet/selftest/rpc.c       | 2 +-
 drivers/staging/lustre/lnet/selftest/timer.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c
index cc9d182..56b4ef4 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -103,7 +103,7 @@ do {				    \
 #define sfw_test_active(t)      (atomic_read(&(t)->tsi_nactive) != 0)
 #define sfw_batch_active(b)     (atomic_read(&(b)->bat_nactive) != 0)
 
-struct smoketest_framework {
+static struct smoketest_framework {
 	struct list_head	 fw_zombie_rpcs;     /* RPCs to be recycled */
 	struct list_head	 fw_zombie_sessions; /* stopping sessions */
 	struct list_head	 fw_tests;	   /* registered test cases */
diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c
index b602077..bb6aa2e 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -54,7 +54,7 @@ typedef enum {
 	SRPC_STATE_STOPPING,
 } srpc_state_t;
 
-struct smoketest_rpc {
+static struct smoketest_rpc {
 	spinlock_t	 rpc_glock;	/* global lock */
 	srpc_service_t	*rpc_services[SRPC_SERVICE_MAX_ID + 1];
 	lnet_handle_eq_t rpc_lnet_eq;	/* _the_ LNet event queue */
diff --git a/drivers/staging/lustre/lnet/selftest/timer.c b/drivers/staging/lustre/lnet/selftest/timer.c
index f8352c2..441f947 100644
--- a/drivers/staging/lustre/lnet/selftest/timer.c
+++ b/drivers/staging/lustre/lnet/selftest/timer.c
@@ -57,7 +57,7 @@
 #define STTIMER_SLOT(t)	       (&stt_data.stt_hash[(((t) >> STTIMER_MINPOLL) & \
 						    (STTIMER_NSLOTS - 1))])
 
-struct st_timer_data {
+static struct st_timer_data {
 	spinlock_t	 stt_lock;
 	/* start time of the slot processed previously */
 	unsigned long       stt_prev_slot;
-- 
2.1.4


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

* [PATCH 3/5] staging: lustre: selftest: fix sfw_deactivate_session context imbalance
  2014-12-27 20:46 [PATCH 0/5] staging: lustre: selftest: fix various sparse warnings Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 1/5] staging: lustre: selftest: fix "not declared" by declaring in header Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 2/5] staging: lustre: selftest: fix "not declared" by declaring static Jeremiah Mahler
@ 2014-12-27 20:46 ` Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 4/5] staging: lustre: selftest: fix _post_buffer " Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 5/5] staging: lustre: selftest: fix _recycle_buffer " Jeremiah Mahler
  4 siblings, 0 replies; 6+ messages in thread
From: Jeremiah Mahler @ 2014-12-27 20:46 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: Andreas Dilger, Greg Kroah-Hartman, Peng Tao,
	Peter Zijlstra (Intel),
	Greg Donald, Anton Saraev, Vitaly Osipov, Joe Perches,
	HPDD-discuss, devel, linux-kernel, Jeremiah Mahler

Fix the sparse warning about a context imbalance in the
sfw_deactivate_session function by telling sparse that it
should expect the lock to be held on entry and held on exit.

  drivers/staging/lustre/lnet/selftest/framework.c:210:9: warning: context imbalance in 'sfw_deactivate_session' - unexpected unlock

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
---
 drivers/staging/lustre/lnet/selftest/framework.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c
index 56b4ef4..5709148 100644
--- a/drivers/staging/lustre/lnet/selftest/framework.c
+++ b/drivers/staging/lustre/lnet/selftest/framework.c
@@ -194,9 +194,9 @@ sfw_del_session_timer (void)
 	return EBUSY; /* racing with sfw_session_expired() */
 }
 
-/* called with sfw_data.fw_lock held */
 static void
 sfw_deactivate_session (void)
+	__must_hold(&sfw_data.fw_lock)
 {
 	sfw_session_t *sn = sfw_data.fw_session;
 	int	    nactive = 0;
-- 
2.1.4


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

* [PATCH 4/5] staging: lustre: selftest: fix _post_buffer context imbalance
  2014-12-27 20:46 [PATCH 0/5] staging: lustre: selftest: fix various sparse warnings Jeremiah Mahler
                   ` (2 preceding siblings ...)
  2014-12-27 20:46 ` [PATCH 3/5] staging: lustre: selftest: fix sfw_deactivate_session context imbalance Jeremiah Mahler
@ 2014-12-27 20:46 ` Jeremiah Mahler
  2014-12-27 20:46 ` [PATCH 5/5] staging: lustre: selftest: fix _recycle_buffer " Jeremiah Mahler
  4 siblings, 0 replies; 6+ messages in thread
From: Jeremiah Mahler @ 2014-12-27 20:46 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: Andreas Dilger, Greg Kroah-Hartman, Peng Tao,
	Peter Zijlstra (Intel),
	Greg Donald, Anton Saraev, Vitaly Osipov, Joe Perches,
	HPDD-discuss, devel, linux-kernel, Jeremiah Mahler

Fix the sparse warning about a context imbalance in the
srpc_service_post_buffer function by telling sparse that it
should expect the lock to be held on entry and held on exit.

  drivers/staging/lustre/lnet/selftest/rpc.c:508:17: warning: context imbalance in 'srpc_service_post_buffer' - unexpected unlock

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
---
 drivers/staging/lustre/lnet/selftest/rpc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c
index bb6aa2e..2e9094b 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -468,6 +468,7 @@ srpc_post_passive_rqtbuf(int service, int local, void *buf, int len,
 
 static int
 srpc_service_post_buffer(struct srpc_service_cd *scd, struct srpc_buffer *buf)
+	__must_hold(&scd->scd_lock)
 {
 	struct srpc_service	*sv = scd->scd_svc;
 	struct srpc_msg		*msg = &buf->buf_msg;
-- 
2.1.4


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

* [PATCH 5/5] staging: lustre: selftest: fix _recycle_buffer context imbalance
  2014-12-27 20:46 [PATCH 0/5] staging: lustre: selftest: fix various sparse warnings Jeremiah Mahler
                   ` (3 preceding siblings ...)
  2014-12-27 20:46 ` [PATCH 4/5] staging: lustre: selftest: fix _post_buffer " Jeremiah Mahler
@ 2014-12-27 20:46 ` Jeremiah Mahler
  4 siblings, 0 replies; 6+ messages in thread
From: Jeremiah Mahler @ 2014-12-27 20:46 UTC (permalink / raw)
  To: Oleg Drokin
  Cc: Andreas Dilger, Greg Kroah-Hartman, Peng Tao,
	Peter Zijlstra (Intel),
	Greg Donald, Anton Saraev, Vitaly Osipov, Joe Perches,
	HPDD-discuss, devel, linux-kernel, Jeremiah Mahler

Fix the sparse warning about a context imbalance in the
srpc_service_recycle_buffer function by telling sparse that it
should expect the lock to be held on entry and held on exit.

  drivers/staging/lustre/lnet/selftest/rpc.c:725:20: warning: context imbalance in 'srpc_service_recycle_buffer' - unexpected unlock

Signed-off-by: Jeremiah Mahler <jmmahler@gmail.com>
---
 drivers/staging/lustre/lnet/selftest/rpc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c
index 2e9094b..1f7d9a6 100644
--- a/drivers/staging/lustre/lnet/selftest/rpc.c
+++ b/drivers/staging/lustre/lnet/selftest/rpc.c
@@ -698,6 +698,7 @@ srpc_finish_service(struct srpc_service *sv)
 /* called with sv->sv_lock held */
 static void
 srpc_service_recycle_buffer(struct srpc_service_cd *scd, srpc_buffer_t *buf)
+	__must_hold(&scd->scd_lock)
 {
 	if (!scd->scd_svc->sv_shuttingdown && scd->scd_buf_adjust >= 0) {
 		if (srpc_service_post_buffer(scd, buf) != 0) {
-- 
2.1.4


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

end of thread, other threads:[~2014-12-27 20:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-27 20:46 [PATCH 0/5] staging: lustre: selftest: fix various sparse warnings Jeremiah Mahler
2014-12-27 20:46 ` [PATCH 1/5] staging: lustre: selftest: fix "not declared" by declaring in header Jeremiah Mahler
2014-12-27 20:46 ` [PATCH 2/5] staging: lustre: selftest: fix "not declared" by declaring static Jeremiah Mahler
2014-12-27 20:46 ` [PATCH 3/5] staging: lustre: selftest: fix sfw_deactivate_session context imbalance Jeremiah Mahler
2014-12-27 20:46 ` [PATCH 4/5] staging: lustre: selftest: fix _post_buffer " Jeremiah Mahler
2014-12-27 20:46 ` [PATCH 5/5] staging: lustre: selftest: fix _recycle_buffer " Jeremiah Mahler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®