Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264671
b: refs/heads/master
c: e6a2573
h: refs/heads/master
i:
  264669: f582f06
  264667: 6dffc2d
  264663: c9a12c7
  264655: 79c62d7
  264639: 6e1a253
v: v3
  • Loading branch information
Christoph Hellwig authored and Nicholas Bellinger committed Oct 24, 2011
1 parent 2ea1394 commit 8f76ba5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4911e3ccbec047ed1f728e19a70ad87729a3fb01
refs/heads/master: e6a2573f1f5d66f0456c433afdfc63f33fdf9008
44 changes: 15 additions & 29 deletions trunk/drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ static u32 transport_allocate_tasks(struct se_cmd *cmd,
enum dma_data_direction data_direction,
struct scatterlist *sgl, unsigned int nents);
static int transport_generic_get_mem(struct se_cmd *cmd);
static int transport_generic_remove(struct se_cmd *cmd,
int session_reinstatement);
static bool transport_put_cmd(struct se_cmd *cmd);
static void transport_remove_cmd_from_queue(struct se_cmd *cmd,
struct se_queue_obj *qobj);
Expand Down Expand Up @@ -599,7 +597,7 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
return;
if (remove) {
transport_remove_cmd_from_queue(cmd, &cmd->se_dev->dev_queue_obj);
transport_generic_remove(cmd, 0);
transport_put_cmd(cmd);
}
}

Expand All @@ -610,7 +608,7 @@ void transport_cmd_finish_abort_tmr(struct se_cmd *cmd)
if (transport_cmd_check_stop_to_fabric(cmd))
return;

transport_generic_remove(cmd, 0);
transport_put_cmd(cmd);
}

static void transport_add_cmd_to_queue(
Expand Down Expand Up @@ -2072,7 +2070,7 @@ static void transport_generic_request_timeout(struct se_cmd *cmd)
unsigned long flags;

/*
* Reset cmd->t_se_count to allow transport_generic_remove()
* Reset cmd->t_se_count to allow transport_put_cmd()
* to allow last call to free memory resources.
*/
spin_lock_irqsave(&cmd->t_state_lock, flags);
Expand All @@ -2083,7 +2081,7 @@ static void transport_generic_request_timeout(struct se_cmd *cmd)
}
spin_unlock_irqrestore(&cmd->t_state_lock, flags);

transport_generic_remove(cmd, 0);
transport_put_cmd(cmd);
}

static inline u32 transport_lba_21(unsigned char *cdb)
Expand Down Expand Up @@ -3772,24 +3770,6 @@ static bool transport_put_cmd(struct se_cmd *cmd)
return false;
}

static int
transport_generic_remove(struct se_cmd *cmd, int session_reinstatement)
{
unsigned long flags;

if (!transport_put_cmd(cmd)) {
if (session_reinstatement) {
spin_lock_irqsave(&cmd->t_state_lock, flags);
transport_all_task_dev_remove_state(cmd);
spin_unlock_irqrestore(&cmd->t_state_lock,
flags);
}
return 1;
}

return 0;
}

/*
* transport_generic_map_mem_to_cmd - Use fabric-alloced pages instead of
* allocating in the core.
Expand Down Expand Up @@ -4379,7 +4359,13 @@ void transport_generic_free_cmd(

transport_free_dev_tasks(cmd);

transport_generic_remove(cmd, session_reinstatement);
if (!transport_put_cmd(cmd) && session_reinstatement) {
unsigned long flags;

spin_lock_irqsave(&cmd->t_state_lock, flags);
transport_all_task_dev_remove_state(cmd);
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
}
}
}
EXPORT_SYMBOL(transport_generic_free_cmd);
Expand Down Expand Up @@ -5066,7 +5052,7 @@ static void transport_processing_shutdown(struct se_device *dev)
transport_lun_remove_cmd(cmd);

if (transport_cmd_check_stop(cmd, 1, 0))
transport_generic_remove(cmd, 0);
transport_put_cmd(cmd);
}

spin_lock_irqsave(&dev->execute_task_lock, flags);
Expand Down Expand Up @@ -5094,7 +5080,7 @@ static void transport_processing_shutdown(struct se_device *dev)
transport_lun_remove_cmd(cmd);

if (transport_cmd_check_stop(cmd, 1, 0))
transport_generic_remove(cmd, 0);
transport_put_cmd(cmd);
}

spin_lock_irqsave(&dev->execute_task_lock, flags);
Expand All @@ -5117,7 +5103,7 @@ static void transport_processing_shutdown(struct se_device *dev)
} else {
transport_lun_remove_cmd(cmd);
if (transport_cmd_check_stop(cmd, 1, 0))
transport_generic_remove(cmd, 0);
transport_put_cmd(cmd);
}
}
}
Expand Down Expand Up @@ -5192,7 +5178,7 @@ static int transport_processing_thread(void *param)
transport_generic_complete_ok(cmd);
break;
case TRANSPORT_REMOVE:
transport_generic_remove(cmd, 0);
transport_put_cmd(cmd);
break;
case TRANSPORT_FREE_CMD_INTR:
transport_generic_free_cmd(cmd, 0, 0);
Expand Down

0 comments on commit 8f76ba5

Please sign in to comment.