Commit f7a5cc0b authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nicholas Bellinger

target: remove SCF_EMULATE_QUEUE_FULL

Add a new boolean at_head parameter to transport_add_cmd_to_queue and thus
obsolete the SCF_EMULATE_QUEUE_FULL flag.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent e057f533
...@@ -596,9 +596,8 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) ...@@ -596,9 +596,8 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
} }
} }
static void transport_add_cmd_to_queue( static void transport_add_cmd_to_queue(struct se_cmd *cmd, int t_state,
struct se_cmd *cmd, bool at_head)
int t_state)
{ {
struct se_device *dev = cmd->se_dev; struct se_device *dev = cmd->se_dev;
struct se_queue_obj *qobj = &dev->dev_queue_obj; struct se_queue_obj *qobj = &dev->dev_queue_obj;
...@@ -619,10 +618,9 @@ static void transport_add_cmd_to_queue( ...@@ -619,10 +618,9 @@ static void transport_add_cmd_to_queue(
else else
atomic_inc(&qobj->queue_cnt); atomic_inc(&qobj->queue_cnt);
if (cmd->se_cmd_flags & SCF_EMULATE_QUEUE_FULL) { if (at_head)
cmd->se_cmd_flags &= ~SCF_EMULATE_QUEUE_FULL;
list_add(&cmd->se_queue_node, &qobj->qobj_list); list_add(&cmd->se_queue_node, &qobj->qobj_list);
} else else
list_add_tail(&cmd->se_queue_node, &qobj->qobj_list); list_add_tail(&cmd->se_queue_node, &qobj->qobj_list);
atomic_set(&cmd->t_transport_queue_active, 1); atomic_set(&cmd->t_transport_queue_active, 1);
spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);
...@@ -764,7 +762,7 @@ void transport_complete_task(struct se_task *task, int success) ...@@ -764,7 +762,7 @@ void transport_complete_task(struct se_task *task, int success)
t_state = TRANSPORT_COMPLETE_TIMEOUT; t_state = TRANSPORT_COMPLETE_TIMEOUT;
spin_unlock_irqrestore(&cmd->t_state_lock, flags); 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; return;
} }
atomic_dec(&cmd->t_task_cdbs_timeout_left); atomic_dec(&cmd->t_task_cdbs_timeout_left);
...@@ -796,7 +794,7 @@ void transport_complete_task(struct se_task *task, int success) ...@@ -796,7 +794,7 @@ void transport_complete_task(struct se_task *task, int success)
} }
spin_unlock_irqrestore(&cmd->t_state_lock, flags); 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); EXPORT_SYMBOL(transport_complete_task);
...@@ -971,11 +969,8 @@ static void target_qf_do_work(struct work_struct *work) ...@@ -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_OK) ? "COMPLETE_OK" :
(cmd->t_state == TRANSPORT_COMPLETE_QF_WP) ? "WRITE_PENDING" (cmd->t_state == TRANSPORT_COMPLETE_QF_WP) ? "WRITE_PENDING"
: "UNKNOWN"); : "UNKNOWN");
/*
* The SCF_EMULATE_QUEUE_FULL flag will be cleared once se_cmd transport_add_cmd_to_queue(cmd, cmd->t_state, true);
* has been added to head of queue
*/
transport_add_cmd_to_queue(cmd, cmd->t_state);
} }
} }
...@@ -1714,7 +1709,7 @@ int transport_generic_handle_cdb_map( ...@@ -1714,7 +1709,7 @@ int transport_generic_handle_cdb_map(
return -EINVAL; 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; return 0;
} }
EXPORT_SYMBOL(transport_generic_handle_cdb_map); EXPORT_SYMBOL(transport_generic_handle_cdb_map);
...@@ -1744,7 +1739,7 @@ int transport_generic_handle_data( ...@@ -1744,7 +1739,7 @@ int transport_generic_handle_data(
if (transport_check_aborted_status(cmd, 1) != 0) if (transport_check_aborted_status(cmd, 1) != 0)
return 0; return 0;
transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_WRITE); transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_WRITE, false);
return 0; return 0;
} }
EXPORT_SYMBOL(transport_generic_handle_data); EXPORT_SYMBOL(transport_generic_handle_data);
...@@ -1756,7 +1751,7 @@ EXPORT_SYMBOL(transport_generic_handle_data); ...@@ -1756,7 +1751,7 @@ EXPORT_SYMBOL(transport_generic_handle_data);
int transport_generic_handle_tmr( int transport_generic_handle_tmr(
struct se_cmd *cmd) 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; return 0;
} }
EXPORT_SYMBOL(transport_generic_handle_tmr); EXPORT_SYMBOL(transport_generic_handle_tmr);
...@@ -1764,7 +1759,7 @@ EXPORT_SYMBOL(transport_generic_handle_tmr); ...@@ -1764,7 +1759,7 @@ EXPORT_SYMBOL(transport_generic_handle_tmr);
void transport_generic_free_cmd_intr( void transport_generic_free_cmd_intr(
struct se_cmd *cmd) 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); EXPORT_SYMBOL(transport_generic_free_cmd_intr);
...@@ -2107,7 +2102,7 @@ static void transport_task_timeout_handler(unsigned long data) ...@@ -2107,7 +2102,7 @@ static void transport_task_timeout_handler(unsigned long data)
cmd->t_state = TRANSPORT_COMPLETE_FAILURE; cmd->t_state = TRANSPORT_COMPLETE_FAILURE;
spin_unlock_irqrestore(&cmd->t_state_lock, flags); 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);
} }
/* /*
...@@ -3476,7 +3471,6 @@ static void transport_handle_queue_full( ...@@ -3476,7 +3471,6 @@ static void transport_handle_queue_full(
struct se_device *dev) struct se_device *dev)
{ {
spin_lock_irq(&dev->qf_cmd_lock); 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); list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list);
atomic_inc(&dev->dev_qf_count); atomic_inc(&dev->dev_qf_count);
smp_mb__after_atomic_inc(); smp_mb__after_atomic_inc();
......
...@@ -127,7 +127,6 @@ enum se_cmd_flags_table { ...@@ -127,7 +127,6 @@ enum se_cmd_flags_table {
SCF_UNUSED = 0x00100000, SCF_UNUSED = 0x00100000,
SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000, SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC = 0x00400000,
SCF_EMULATE_CDB_ASYNC = 0x01000000, SCF_EMULATE_CDB_ASYNC = 0x01000000,
SCF_EMULATE_QUEUE_FULL = 0x02000000,
}; };
/* struct se_dev_entry->lun_flags and struct se_lun->lun_access */ /* struct se_dev_entry->lun_flags and struct se_lun->lun_access */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment