24
24
#include "iscsi_target_tq.h"
25
25
#include "iscsi_target.h"
26
26
27
- static LIST_HEAD (active_ts_list );
28
27
static LIST_HEAD (inactive_ts_list );
29
- static DEFINE_SPINLOCK (active_ts_lock );
30
28
static DEFINE_SPINLOCK (inactive_ts_lock );
31
29
static DEFINE_SPINLOCK (ts_bitmap_lock );
32
30
33
- static void iscsi_add_ts_to_active_list (struct iscsi_thread_set * ts )
34
- {
35
- spin_lock (& active_ts_lock );
36
- list_add_tail (& ts -> ts_list , & active_ts_list );
37
- iscsit_global -> active_ts ++ ;
38
- spin_unlock (& active_ts_lock );
39
- }
40
-
41
31
static void iscsi_add_ts_to_inactive_list (struct iscsi_thread_set * ts )
42
32
{
33
+ if (!list_empty (& ts -> ts_list )) {
34
+ WARN_ON (1 );
35
+ return ;
36
+ }
43
37
spin_lock (& inactive_ts_lock );
44
38
list_add_tail (& ts -> ts_list , & inactive_ts_list );
45
39
iscsit_global -> inactive_ts ++ ;
46
40
spin_unlock (& inactive_ts_lock );
47
41
}
48
42
49
- static void iscsi_del_ts_from_active_list (struct iscsi_thread_set * ts )
50
- {
51
- spin_lock (& active_ts_lock );
52
- list_del (& ts -> ts_list );
53
- iscsit_global -> active_ts -- ;
54
- spin_unlock (& active_ts_lock );
55
- }
56
-
57
43
static struct iscsi_thread_set * iscsi_get_ts_from_inactive_list (void )
58
44
{
59
45
struct iscsi_thread_set * ts ;
@@ -66,7 +52,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
66
52
67
53
ts = list_first_entry (& inactive_ts_list , struct iscsi_thread_set , ts_list );
68
54
69
- list_del (& ts -> ts_list );
55
+ list_del_init (& ts -> ts_list );
70
56
iscsit_global -> inactive_ts -- ;
71
57
spin_unlock (& inactive_ts_lock );
72
58
@@ -204,8 +190,6 @@ static void iscsi_deallocate_extra_thread_sets(void)
204
190
205
191
void iscsi_activate_thread_set (struct iscsi_conn * conn , struct iscsi_thread_set * ts )
206
192
{
207
- iscsi_add_ts_to_active_list (ts );
208
-
209
193
spin_lock_bh (& ts -> ts_state_lock );
210
194
conn -> thread_set = ts ;
211
195
ts -> conn = conn ;
@@ -397,7 +381,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts)
397
381
398
382
if (ts -> delay_inactive && (-- ts -> thread_count == 0 )) {
399
383
spin_unlock_bh (& ts -> ts_state_lock );
400
- iscsi_del_ts_from_active_list (ts );
401
384
402
385
if (!iscsit_global -> in_shutdown )
403
386
iscsi_deallocate_extra_thread_sets ();
@@ -452,7 +435,6 @@ struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *ts)
452
435
453
436
if (ts -> delay_inactive && (-- ts -> thread_count == 0 )) {
454
437
spin_unlock_bh (& ts -> ts_state_lock );
455
- iscsi_del_ts_from_active_list (ts );
456
438
457
439
if (!iscsit_global -> in_shutdown )
458
440
iscsi_deallocate_extra_thread_sets ();
0 commit comments