Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264699
b: refs/heads/master
c: f7a5cc0
h: refs/heads/master
i:
  264697: 613ed1e
  264695: bb0a76d
v: v3
  • Loading branch information
Christoph Hellwig authored and Nicholas Bellinger committed Oct 24, 2011
1 parent 3e772f9 commit 7a9436d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 21 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: e057f53308a5f071556ee80586b99ee755bf07f5
refs/heads/master: f7a5cc0b310af887f5391ba886d3d9254ac8920a
32 changes: 13 additions & 19 deletions trunk/drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,8 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
}
}

static void transport_add_cmd_to_queue(
struct se_cmd *cmd,
int t_state)
static void transport_add_cmd_to_queue(struct se_cmd *cmd, int t_state,
bool at_head)
{
struct se_device *dev = cmd->se_dev;
struct se_queue_obj *qobj = &dev->dev_queue_obj;
Expand All @@ -619,10 +618,9 @@ static void transport_add_cmd_to_queue(
else
atomic_inc(&qobj->queue_cnt);

if (cmd->se_cmd_flags & SCF_EMULATE_QUEUE_FULL) {
cmd->se_cmd_flags &= ~SCF_EMULATE_QUEUE_FULL;
if (at_head)
list_add(&cmd->se_queue_node, &qobj->qobj_list);
} else
else
list_add_tail(&cmd->se_queue_node, &qobj->qobj_list);
atomic_set(&cmd->t_transport_queue_active, 1);
spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);
Expand Down Expand Up @@ -764,7 +762,7 @@ void transport_complete_task(struct se_task *task, int success)
t_state = TRANSPORT_COMPLETE_TIMEOUT;
spin_unlock_irqrestore(&cmd->t_state_lock, flags);

transport_add_cmd_to_queue(cmd, t_state);
transport_add_cmd_to_queue(cmd, t_state, false);
return;
}
atomic_dec(&cmd->t_task_cdbs_timeout_left);
Expand Down Expand Up @@ -796,7 +794,7 @@ void transport_complete_task(struct se_task *task, int success)
}
spin_unlock_irqrestore(&cmd->t_state_lock, flags);

transport_add_cmd_to_queue(cmd, t_state);
transport_add_cmd_to_queue(cmd, t_state, false);
}
EXPORT_SYMBOL(transport_complete_task);

Expand Down Expand Up @@ -971,11 +969,8 @@ static void target_qf_do_work(struct work_struct *work)
(cmd->t_state == TRANSPORT_COMPLETE_QF_OK) ? "COMPLETE_OK" :
(cmd->t_state == TRANSPORT_COMPLETE_QF_WP) ? "WRITE_PENDING"
: "UNKNOWN");
/*
* The SCF_EMULATE_QUEUE_FULL flag will be cleared once se_cmd
* has been added to head of queue
*/
transport_add_cmd_to_queue(cmd, cmd->t_state);

transport_add_cmd_to_queue(cmd, cmd->t_state, true);
}
}

Expand Down Expand Up @@ -1714,7 +1709,7 @@ int transport_generic_handle_cdb_map(
return -EINVAL;
}

transport_add_cmd_to_queue(cmd, TRANSPORT_NEW_CMD_MAP);
transport_add_cmd_to_queue(cmd, TRANSPORT_NEW_CMD_MAP, false);
return 0;
}
EXPORT_SYMBOL(transport_generic_handle_cdb_map);
Expand Down Expand Up @@ -1744,7 +1739,7 @@ int transport_generic_handle_data(
if (transport_check_aborted_status(cmd, 1) != 0)
return 0;

transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_WRITE);
transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_WRITE, false);
return 0;
}
EXPORT_SYMBOL(transport_generic_handle_data);
Expand All @@ -1756,15 +1751,15 @@ EXPORT_SYMBOL(transport_generic_handle_data);
int transport_generic_handle_tmr(
struct se_cmd *cmd)
{
transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_TMR);
transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_TMR, false);
return 0;
}
EXPORT_SYMBOL(transport_generic_handle_tmr);

void transport_generic_free_cmd_intr(
struct se_cmd *cmd)
{
transport_add_cmd_to_queue(cmd, TRANSPORT_FREE_CMD_INTR);
transport_add_cmd_to_queue(cmd, TRANSPORT_FREE_CMD_INTR, false);
}
EXPORT_SYMBOL(transport_generic_free_cmd_intr);

Expand Down Expand Up @@ -2107,7 +2102,7 @@ static void transport_task_timeout_handler(unsigned long data)
cmd->t_state = TRANSPORT_COMPLETE_FAILURE;
spin_unlock_irqrestore(&cmd->t_state_lock, flags);

transport_add_cmd_to_queue(cmd, TRANSPORT_COMPLETE_FAILURE);
transport_add_cmd_to_queue(cmd, TRANSPORT_COMPLETE_FAILURE, false);
}

/*
Expand Down Expand Up @@ -3476,7 +3471,6 @@ static void transport_handle_queue_full(
struct se_device *dev)
{
spin_lock_irq(&dev->qf_cmd_lock);
cmd->se_cmd_flags |= SCF_EMULATE_QUEUE_FULL;
list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list);
atomic_inc(&dev->dev_qf_count);
smp_mb__after_atomic_inc();
Expand Down
1 change: 0 additions & 1 deletion trunk/include/target/target_core_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ enum se_cmd_flags_table {
SCF_UNUSED = 0x00100000,
SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000,
SCF_EMULATE_CDB_ASYNC = 0x01000000,
SCF_EMULATE_QUEUE_FULL = 0x02000000,
};

/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
Expand Down

0 comments on commit 7a9436d

Please sign in to comment.