target: Remove legacy t_fe_count + avoid t_state_lock access in transport_put_cmd
authorNicholas Bellinger <nab@linux-iscsi.org>
Thu, 6 Jun 2013 09:00:06 +0000 (02:00 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Thu, 20 Jun 2013 21:10:41 +0000 (14:10 -0700)
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>
drivers/target/target_core_tmr.c
drivers/target/target_core_transport.c
include/target/target_core_base.h

index d0b4dd95b91e96628999a362b409543caee5578f..0d7cacb911078929ae99d94abbb249e0c7c699b5 100644 (file)
@@ -85,13 +85,8 @@ void core_tmr_release_req(
 static void core_tmr_handle_tas_abort(
        struct se_node_acl *tmr_nacl,
        struct se_cmd *cmd,
-       int tas,
-       int fe_count)
+       int tas)
 {
-       if (!fe_count) {
-               transport_cmd_finish_abort(cmd, 1);
-               return;
-       }
        /*
         * TASK ABORTED status (TAS) bit support
        */
@@ -253,7 +248,6 @@ static void core_tmr_drain_state_list(
        LIST_HEAD(drain_task_list);
        struct se_cmd *cmd, *next;
        unsigned long flags;
-       int fe_count;
 
        /*
         * Complete outstanding commands with TASK_ABORTED SAM status.
@@ -329,12 +323,10 @@ static void core_tmr_drain_state_list(
                spin_lock_irqsave(&cmd->t_state_lock, flags);
                target_stop_cmd(cmd, &flags);
 
-               fe_count = atomic_read(&cmd->t_fe_count);
-
                cmd->transport_state |= CMD_T_ABORTED;
                spin_unlock_irqrestore(&cmd->t_state_lock, flags);
 
-               core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count);
+               core_tmr_handle_tas_abort(tmr_nacl, cmd, tas);
        }
 }
 
index bc37666bc94187795fc72ab103aa5a939e9c7d0c..01cdee47f75e2b13ad32d9c18c0aad06f89dd6b3 100644 (file)
@@ -1968,21 +1968,6 @@ static int transport_release_cmd(struct se_cmd *cmd)
  */
 static int transport_put_cmd(struct se_cmd *cmd)
 {
-       unsigned long flags;
-
-       spin_lock_irqsave(&cmd->t_state_lock, flags);
-       if (atomic_read(&cmd->t_fe_count) &&
-           !atomic_dec_and_test(&cmd->t_fe_count)) {
-               spin_unlock_irqrestore(&cmd->t_state_lock, flags);
-               return 0;
-       }
-
-       if (cmd->transport_state & CMD_T_DEV_ACTIVE) {
-               cmd->transport_state &= ~CMD_T_DEV_ACTIVE;
-               target_remove_from_state_list(cmd);
-       }
-       spin_unlock_irqrestore(&cmd->t_state_lock, flags);
-
        transport_free_pages(cmd);
        return transport_release_cmd(cmd);
 }
@@ -2100,9 +2085,6 @@ transport_generic_new_cmd(struct se_cmd *cmd)
                if (ret < 0)
                        return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
        }
-
-       atomic_inc(&cmd->t_fe_count);
-
        /*
         * If this command is not a write we can execute it right here,
         * for write buffers we need to notify the fabric driver first
index 8952ee9f7cef4a37585f5db57a6b095699014cc1..891ea1f81832b2535bf2f517d8da0f52f485e7d2 100644 (file)
@@ -454,7 +454,6 @@ struct se_cmd {
        unsigned char           *t_task_cdb;
        unsigned char           __t_task_cdb[TCM_MAX_COMMAND_SIZE];
        unsigned long long      t_task_lba;
-       atomic_t                t_fe_count;
        unsigned int            transport_state;
 #define CMD_T_ABORTED          (1 << 0)
 #define CMD_T_ACTIVE           (1 << 1)