staging: lustre: selftest: fix various sparse warnings
cover staging: lustre: selftest: fix various sparse warnings
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(-)
Signature · 1 line
2.1.4
PATCH 1/5 staging: lustre: selftest: fix "not declared" by declaring in header
Fix several "symbol '...' was not declared" sparse warnings which are caused by global variables by declaring them in the header file.
--- drivers/staging/lustre/lnet/selftest/selftest.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/staging/lustre/lnet/selftest/selftest.h +12 -0
@@ -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__ */
Signature · 1 line
2.1.4
PATCH 2/5 staging: lustre: selftest: fix "not declared" by declaring static
In reply to Jeremiah MahlerFix several "symbol '...' was not declared" sparse warnings for variables which are only used locally by declaring them static.
--- 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(-)
drivers/staging/lustre/lnet/selftest/framework.c +1 -1
@@ -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 */
drivers/staging/lustre/lnet/selftest/rpc.c +1 -1
@@ -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 */
drivers/staging/lustre/lnet/selftest/timer.c +1 -1
@@ -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;
Signature · 1 line
2.1.4
PATCH 3/5 staging: lustre: selftest: fix sfw_deactivate_session context imbalance
In reply to Jeremiah MahlerFix 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
--- drivers/staging/lustre/lnet/selftest/framework.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/selftest/framework.c +1 -1
@@ -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 ;
Signature · 1 line
2.1.4
PATCH 4/5 staging: lustre: selftest: fix _post_buffer context imbalance
In reply to Jeremiah MahlerFix 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
--- drivers/staging/lustre/lnet/selftest/rpc.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lnet/selftest/rpc.c +1 -0
@@ -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;
Signature · 1 line
2.1.4
PATCH 5/5 staging: lustre: selftest: fix _recycle_buffer context imbalance
In reply to Jeremiah MahlerFix 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
--- drivers/staging/lustre/lnet/selftest/rpc.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lnet/selftest/rpc.c +1 -0
@@ -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 ) {
Signature · 1 line
2.1.4