diff options
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tq.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/drivers/target/iscsi/iscsi_target_tq.c b/drivers/target/iscsi/iscsi_target_tq.c index 18e1971b54f8..26aa50996473 100644 --- a/drivers/target/iscsi/iscsi_target_tq.c +++ b/drivers/target/iscsi/iscsi_target_tq.c | |||
@@ -24,36 +24,22 @@ | |||
24 | #include "iscsi_target_tq.h" | 24 | #include "iscsi_target_tq.h" |
25 | #include "iscsi_target.h" | 25 | #include "iscsi_target.h" |
26 | 26 | ||
27 | static LIST_HEAD(active_ts_list); | ||
28 | static LIST_HEAD(inactive_ts_list); | 27 | static LIST_HEAD(inactive_ts_list); |
29 | static DEFINE_SPINLOCK(active_ts_lock); | ||
30 | static DEFINE_SPINLOCK(inactive_ts_lock); | 28 | static DEFINE_SPINLOCK(inactive_ts_lock); |
31 | static DEFINE_SPINLOCK(ts_bitmap_lock); | 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 | static void iscsi_add_ts_to_inactive_list(struct iscsi_thread_set *ts) | 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 | spin_lock(&inactive_ts_lock); | 37 | spin_lock(&inactive_ts_lock); |
44 | list_add_tail(&ts->ts_list, &inactive_ts_list); | 38 | list_add_tail(&ts->ts_list, &inactive_ts_list); |
45 | iscsit_global->inactive_ts++; | 39 | iscsit_global->inactive_ts++; |
46 | spin_unlock(&inactive_ts_lock); | 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 | static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) | 43 | static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void) |
58 | { | 44 | { |
59 | struct iscsi_thread_set *ts; | 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 | ts = list_first_entry(&inactive_ts_list, struct iscsi_thread_set, ts_list); | 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 | iscsit_global->inactive_ts--; | 56 | iscsit_global->inactive_ts--; |
71 | spin_unlock(&inactive_ts_lock); | 57 | spin_unlock(&inactive_ts_lock); |
72 | 58 | ||
@@ -204,8 +190,6 @@ static void iscsi_deallocate_extra_thread_sets(void) | |||
204 | 190 | ||
205 | void iscsi_activate_thread_set(struct iscsi_conn *conn, struct iscsi_thread_set *ts) | 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 | spin_lock_bh(&ts->ts_state_lock); | 193 | spin_lock_bh(&ts->ts_state_lock); |
210 | conn->thread_set = ts; | 194 | conn->thread_set = ts; |
211 | ts->conn = conn; | 195 | ts->conn = conn; |
@@ -397,7 +381,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts) | |||
397 | 381 | ||
398 | if (ts->delay_inactive && (--ts->thread_count == 0)) { | 382 | if (ts->delay_inactive && (--ts->thread_count == 0)) { |
399 | spin_unlock_bh(&ts->ts_state_lock); | 383 | spin_unlock_bh(&ts->ts_state_lock); |
400 | iscsi_del_ts_from_active_list(ts); | ||
401 | 384 | ||
402 | if (!iscsit_global->in_shutdown) | 385 | if (!iscsit_global->in_shutdown) |
403 | iscsi_deallocate_extra_thread_sets(); | 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 | if (ts->delay_inactive && (--ts->thread_count == 0)) { | 436 | if (ts->delay_inactive && (--ts->thread_count == 0)) { |
454 | spin_unlock_bh(&ts->ts_state_lock); | 437 | spin_unlock_bh(&ts->ts_state_lock); |
455 | iscsi_del_ts_from_active_list(ts); | ||
456 | 438 | ||
457 | if (!iscsit_global->in_shutdown) | 439 | if (!iscsit_global->in_shutdown) |
458 | iscsi_deallocate_extra_thread_sets(); | 440 | iscsi_deallocate_extra_thread_sets(); |