Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264659
b: refs/heads/master
c: 79a7fef
h: refs/heads/master
i:
  264657: e7cfb29
  264655: 79c62d7
v: v3
  • Loading branch information
Roland Dreier authored and Nicholas Bellinger committed Oct 24, 2011
1 parent ca58f77 commit f80ecce
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 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: 9375b1bfd2555c8bc828d394a4419a212b46ba71
refs/heads/master: 79a7fef26431830e22e282053d050af790117db8
2 changes: 1 addition & 1 deletion trunk/drivers/target/target_core_tmr.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ int core_tmr_lun_reset(

atomic_dec(&cmd->t_transport_queue_active);
atomic_dec(&qobj->queue_cnt);
list_del(&cmd->se_queue_node);
list_del_init(&cmd->se_queue_node);
spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);

pr_debug("LUN_RESET: %s from Device Queue: cmd: %p t_state:"
Expand Down
31 changes: 15 additions & 16 deletions trunk/drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,6 @@ static void transport_add_cmd_to_queue(
struct se_queue_obj *qobj = &dev->dev_queue_obj;
unsigned long flags;

INIT_LIST_HEAD(&cmd->se_queue_node);

if (t_state) {
spin_lock_irqsave(&cmd->t_state_lock, flags);
cmd->t_state = t_state;
Expand All @@ -630,15 +628,21 @@ static void transport_add_cmd_to_queue(
}

spin_lock_irqsave(&qobj->cmd_queue_lock, flags);

/* If the cmd is already on the list, remove it before we add it */
if (!list_empty(&cmd->se_queue_node))
list_del(&cmd->se_queue_node);
else
atomic_inc(&qobj->queue_cnt);

if (cmd->se_cmd_flags & SCF_EMULATE_QUEUE_FULL) {
cmd->se_cmd_flags &= ~SCF_EMULATE_QUEUE_FULL;
list_add(&cmd->se_queue_node, &qobj->qobj_list);
} else
list_add_tail(&cmd->se_queue_node, &qobj->qobj_list);
atomic_inc(&cmd->t_transport_queue_active);
atomic_set(&cmd->t_transport_queue_active, 1);
spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);

atomic_inc(&qobj->queue_cnt);
wake_up_interruptible(&qobj->thread_wq);
}

Expand All @@ -655,9 +659,9 @@ transport_get_cmd_from_queue(struct se_queue_obj *qobj)
}
cmd = list_first_entry(&qobj->qobj_list, struct se_cmd, se_queue_node);

atomic_dec(&cmd->t_transport_queue_active);
atomic_set(&cmd->t_transport_queue_active, 0);

list_del(&cmd->se_queue_node);
list_del_init(&cmd->se_queue_node);
atomic_dec(&qobj->queue_cnt);
spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);

Expand All @@ -667,22 +671,16 @@ transport_get_cmd_from_queue(struct se_queue_obj *qobj)
static void transport_remove_cmd_from_queue(struct se_cmd *cmd,
struct se_queue_obj *qobj)
{
struct se_cmd *t;
unsigned long flags;

spin_lock_irqsave(&qobj->cmd_queue_lock, flags);
if (!atomic_read(&cmd->t_transport_queue_active)) {
spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);
return;
}

list_for_each_entry(t, &qobj->qobj_list, se_queue_node)
if (t == cmd) {
atomic_dec(&cmd->t_transport_queue_active);
atomic_dec(&qobj->queue_cnt);
list_del(&cmd->se_queue_node);
break;
}
atomic_set(&cmd->t_transport_queue_active, 0);
atomic_dec(&qobj->queue_cnt);
list_del_init(&cmd->se_queue_node);
spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);

if (atomic_read(&cmd->t_transport_queue_active)) {
Expand Down Expand Up @@ -1066,7 +1064,7 @@ static void transport_release_all_cmds(struct se_device *dev)
list_for_each_entry_safe(cmd, tcmd, &dev->dev_queue_obj.qobj_list,
se_queue_node) {
t_state = cmd->t_state;
list_del(&cmd->se_queue_node);
list_del_init(&cmd->se_queue_node);
spin_unlock_irqrestore(&dev->dev_queue_obj.cmd_queue_lock,
flags);

Expand Down Expand Up @@ -1597,6 +1595,7 @@ void transport_init_se_cmd(
INIT_LIST_HEAD(&cmd->se_delayed_node);
INIT_LIST_HEAD(&cmd->se_ordered_node);
INIT_LIST_HEAD(&cmd->se_qf_node);
INIT_LIST_HEAD(&cmd->se_queue_node);

INIT_LIST_HEAD(&cmd->t_task_list);
init_completion(&cmd->transport_lun_fe_stop_comp);
Expand Down

0 comments on commit f80ecce

Please sign in to comment.