diff options
author | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-06-06 05:00:06 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-06-20 17:10:41 -0400 |
commit | c1c35d52251b0941a72b0cdb862e85f0eba6b1bb (patch) | |
tree | 941167898cf8425a95dafb4c6e6f35e248150aa9 | |
parent | 0b66818ac6de67a6125ae203272fb76e79b3a20f (diff) |
target: Remove legacy t_fe_count + avoid t_state_lock access in transport_put_cmd
This patch removes legacy se_cmd->t_fe_count usage in order to avoid
se_cmd->t_state_lock access within transport_put_cmd() during normal
fast path se_cmd descriptor release.
Also drop the left-over parameter usage within core_tmr_handle_tas_abort()
Cc: Christoph Hellwig <hch@lst.de>
Cc: Roland Dreier <roland@kernel.org>
Cc: Kent Overstreet <koverstreet@google.com>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Moussa Ba <moussaba@micron.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_tmr.c | 12 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 18 | ||||
-rw-r--r-- | include/target/target_core_base.h | 1 |
3 files changed, 2 insertions, 29 deletions
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index d0b4dd95b91e..0d7cacb91107 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -85,13 +85,8 @@ void core_tmr_release_req( | |||
85 | static void core_tmr_handle_tas_abort( | 85 | static void core_tmr_handle_tas_abort( |
86 | struct se_node_acl *tmr_nacl, | 86 | struct se_node_acl *tmr_nacl, |
87 | struct se_cmd *cmd, | 87 | struct se_cmd *cmd, |
88 | int tas, | 88 | int tas) |
89 | int fe_count) | ||
90 | { | 89 | { |
91 | if (!fe_count) { | ||
92 | transport_cmd_finish_abort(cmd, 1); | ||
93 | return; | ||
94 | } | ||
95 | /* | 90 | /* |
96 | * TASK ABORTED status (TAS) bit support | 91 | * TASK ABORTED status (TAS) bit support |
97 | */ | 92 | */ |
@@ -253,7 +248,6 @@ static void core_tmr_drain_state_list( | |||
253 | LIST_HEAD(drain_task_list); | 248 | LIST_HEAD(drain_task_list); |
254 | struct se_cmd *cmd, *next; | 249 | struct se_cmd *cmd, *next; |
255 | unsigned long flags; | 250 | unsigned long flags; |
256 | int fe_count; | ||
257 | 251 | ||
258 | /* | 252 | /* |
259 | * Complete outstanding commands with TASK_ABORTED SAM status. | 253 | * Complete outstanding commands with TASK_ABORTED SAM status. |
@@ -329,12 +323,10 @@ static void core_tmr_drain_state_list( | |||
329 | spin_lock_irqsave(&cmd->t_state_lock, flags); | 323 | spin_lock_irqsave(&cmd->t_state_lock, flags); |
330 | target_stop_cmd(cmd, &flags); | 324 | target_stop_cmd(cmd, &flags); |
331 | 325 | ||
332 | fe_count = atomic_read(&cmd->t_fe_count); | ||
333 | |||
334 | cmd->transport_state |= CMD_T_ABORTED; | 326 | cmd->transport_state |= CMD_T_ABORTED; |
335 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | 327 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); |
336 | 328 | ||
337 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); | 329 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas); |
338 | } | 330 | } |
339 | } | 331 | } |
340 | 332 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index bc37666bc941..01cdee47f75e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1968,21 +1968,6 @@ static int transport_release_cmd(struct se_cmd *cmd) | |||
1968 | */ | 1968 | */ |
1969 | static int transport_put_cmd(struct se_cmd *cmd) | 1969 | static int transport_put_cmd(struct se_cmd *cmd) |
1970 | { | 1970 | { |
1971 | unsigned long flags; | ||
1972 | |||
1973 | spin_lock_irqsave(&cmd->t_state_lock, flags); | ||
1974 | if (atomic_read(&cmd->t_fe_count) && | ||
1975 | !atomic_dec_and_test(&cmd->t_fe_count)) { | ||
1976 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
1977 | return 0; | ||
1978 | } | ||
1979 | |||
1980 | if (cmd->transport_state & CMD_T_DEV_ACTIVE) { | ||
1981 | cmd->transport_state &= ~CMD_T_DEV_ACTIVE; | ||
1982 | target_remove_from_state_list(cmd); | ||
1983 | } | ||
1984 | spin_unlock_irqrestore(&cmd->t_state_lock, flags); | ||
1985 | |||
1986 | transport_free_pages(cmd); | 1971 | transport_free_pages(cmd); |
1987 | return transport_release_cmd(cmd); | 1972 | return transport_release_cmd(cmd); |
1988 | } | 1973 | } |
@@ -2100,9 +2085,6 @@ transport_generic_new_cmd(struct se_cmd *cmd) | |||
2100 | if (ret < 0) | 2085 | if (ret < 0) |
2101 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 2086 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
2102 | } | 2087 | } |
2103 | |||
2104 | atomic_inc(&cmd->t_fe_count); | ||
2105 | |||
2106 | /* | 2088 | /* |
2107 | * If this command is not a write we can execute it right here, | 2089 | * If this command is not a write we can execute it right here, |
2108 | * for write buffers we need to notify the fabric driver first | 2090 | * for write buffers we need to notify the fabric driver first |
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 8952ee9f7cef..891ea1f81832 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h | |||
@@ -454,7 +454,6 @@ struct se_cmd { | |||
454 | unsigned char *t_task_cdb; | 454 | unsigned char *t_task_cdb; |
455 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; | 455 | unsigned char __t_task_cdb[TCM_MAX_COMMAND_SIZE]; |
456 | unsigned long long t_task_lba; | 456 | unsigned long long t_task_lba; |
457 | atomic_t t_fe_count; | ||
458 | unsigned int transport_state; | 457 | unsigned int transport_state; |
459 | #define CMD_T_ABORTED (1 << 0) | 458 | #define CMD_T_ABORTED (1 << 0) |
460 | #define CMD_T_ACTIVE (1 << 1) | 459 | #define CMD_T_ACTIVE (1 << 1) |