aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-10-17 13:56:42 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-10-23 23:21:34 -0400
commitf7a5cc0b310af887f5391ba886d3d9254ac8920a (patch)
treec764805c79e4e4ff573a999573eb5dfa6965c461 /drivers/target
parente057f53308a5f071556ee80586b99ee755bf07f5 (diff)
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: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_transport.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 4ce205040b1..b5c3daf1216 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -596,9 +596,8 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
596 } 596 }
597} 597}
598 598
599static void transport_add_cmd_to_queue( 599static void transport_add_cmd_to_queue(struct se_cmd *cmd, int t_state,
600 struct se_cmd *cmd, 600 bool at_head)
601 int t_state)
602{ 601{
603 struct se_device *dev = cmd->se_dev; 602 struct se_device *dev = cmd->se_dev;
604 struct se_queue_obj *qobj = &dev->dev_queue_obj; 603 struct se_queue_obj *qobj = &dev->dev_queue_obj;
@@ -619,10 +618,9 @@ static void transport_add_cmd_to_queue(
619 else 618 else
620 atomic_inc(&qobj->queue_cnt); 619 atomic_inc(&qobj->queue_cnt);
621 620
622 if (cmd->se_cmd_flags & SCF_EMULATE_QUEUE_FULL) { 621 if (at_head)
623 cmd->se_cmd_flags &= ~SCF_EMULATE_QUEUE_FULL;
624 list_add(&cmd->se_queue_node, &qobj->qobj_list); 622 list_add(&cmd->se_queue_node, &qobj->qobj_list);
625 } else 623 else
626 list_add_tail(&cmd->se_queue_node, &qobj->qobj_list); 624 list_add_tail(&cmd->se_queue_node, &qobj->qobj_list);
627 atomic_set(&cmd->t_transport_queue_active, 1); 625 atomic_set(&cmd->t_transport_queue_active, 1);
628 spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags); 626 spin_unlock_irqrestore(&qobj->cmd_queue_lock, flags);
@@ -764,7 +762,7 @@ void transport_complete_task(struct se_task *task, int success)
764 t_state = TRANSPORT_COMPLETE_TIMEOUT; 762 t_state = TRANSPORT_COMPLETE_TIMEOUT;
765 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 763 spin_unlock_irqrestore(&cmd->t_state_lock, flags);
766 764
767 transport_add_cmd_to_queue(cmd, t_state); 765 transport_add_cmd_to_queue(cmd, t_state, false);
768 return; 766 return;
769 } 767 }
770 atomic_dec(&cmd->t_task_cdbs_timeout_left); 768 atomic_dec(&cmd->t_task_cdbs_timeout_left);
@@ -796,7 +794,7 @@ void transport_complete_task(struct se_task *task, int success)
796 } 794 }
797 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 795 spin_unlock_irqrestore(&cmd->t_state_lock, flags);
798 796
799 transport_add_cmd_to_queue(cmd, t_state); 797 transport_add_cmd_to_queue(cmd, t_state, false);
800} 798}
801EXPORT_SYMBOL(transport_complete_task); 799EXPORT_SYMBOL(transport_complete_task);
802 800
@@ -971,11 +969,8 @@ static void target_qf_do_work(struct work_struct *work)
971 (cmd->t_state == TRANSPORT_COMPLETE_QF_OK) ? "COMPLETE_OK" : 969 (cmd->t_state == TRANSPORT_COMPLETE_QF_OK) ? "COMPLETE_OK" :
972 (cmd->t_state == TRANSPORT_COMPLETE_QF_WP) ? "WRITE_PENDING" 970 (cmd->t_state == TRANSPORT_COMPLETE_QF_WP) ? "WRITE_PENDING"
973 : "UNKNOWN"); 971 : "UNKNOWN");
974 /* 972
975 * The SCF_EMULATE_QUEUE_FULL flag will be cleared once se_cmd 973 transport_add_cmd_to_queue(cmd, cmd->t_state, true);
976 * has been added to head of queue
977 */
978 transport_add_cmd_to_queue(cmd, cmd->t_state);
979 } 974 }
980} 975}
981 976
@@ -1714,7 +1709,7 @@ int transport_generic_handle_cdb_map(
1714 return -EINVAL; 1709 return -EINVAL;
1715 } 1710 }
1716 1711
1717 transport_add_cmd_to_queue(cmd, TRANSPORT_NEW_CMD_MAP); 1712 transport_add_cmd_to_queue(cmd, TRANSPORT_NEW_CMD_MAP, false);
1718 return 0; 1713 return 0;
1719} 1714}
1720EXPORT_SYMBOL(transport_generic_handle_cdb_map); 1715EXPORT_SYMBOL(transport_generic_handle_cdb_map);
@@ -1744,7 +1739,7 @@ int transport_generic_handle_data(
1744 if (transport_check_aborted_status(cmd, 1) != 0) 1739 if (transport_check_aborted_status(cmd, 1) != 0)
1745 return 0; 1740 return 0;
1746 1741
1747 transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_WRITE); 1742 transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_WRITE, false);
1748 return 0; 1743 return 0;
1749} 1744}
1750EXPORT_SYMBOL(transport_generic_handle_data); 1745EXPORT_SYMBOL(transport_generic_handle_data);
@@ -1756,7 +1751,7 @@ EXPORT_SYMBOL(transport_generic_handle_data);
1756int transport_generic_handle_tmr( 1751int transport_generic_handle_tmr(
1757 struct se_cmd *cmd) 1752 struct se_cmd *cmd)
1758{ 1753{
1759 transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_TMR); 1754 transport_add_cmd_to_queue(cmd, TRANSPORT_PROCESS_TMR, false);
1760 return 0; 1755 return 0;
1761} 1756}
1762EXPORT_SYMBOL(transport_generic_handle_tmr); 1757EXPORT_SYMBOL(transport_generic_handle_tmr);
@@ -1764,7 +1759,7 @@ EXPORT_SYMBOL(transport_generic_handle_tmr);
1764void transport_generic_free_cmd_intr( 1759void transport_generic_free_cmd_intr(
1765 struct se_cmd *cmd) 1760 struct se_cmd *cmd)
1766{ 1761{
1767 transport_add_cmd_to_queue(cmd, TRANSPORT_FREE_CMD_INTR); 1762 transport_add_cmd_to_queue(cmd, TRANSPORT_FREE_CMD_INTR, false);
1768} 1763}
1769EXPORT_SYMBOL(transport_generic_free_cmd_intr); 1764EXPORT_SYMBOL(transport_generic_free_cmd_intr);
1770 1765
@@ -2107,7 +2102,7 @@ static void transport_task_timeout_handler(unsigned long data)
2107 cmd->t_state = TRANSPORT_COMPLETE_FAILURE; 2102 cmd->t_state = TRANSPORT_COMPLETE_FAILURE;
2108 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 2103 spin_unlock_irqrestore(&cmd->t_state_lock, flags);
2109 2104
2110 transport_add_cmd_to_queue(cmd, TRANSPORT_COMPLETE_FAILURE); 2105 transport_add_cmd_to_queue(cmd, TRANSPORT_COMPLETE_FAILURE, false);
2111} 2106}
2112 2107
2113/* 2108/*
@@ -3476,7 +3471,6 @@ static void transport_handle_queue_full(
3476 struct se_device *dev) 3471 struct se_device *dev)
3477{ 3472{
3478 spin_lock_irq(&dev->qf_cmd_lock); 3473 spin_lock_irq(&dev->qf_cmd_lock);
3479 cmd->se_cmd_flags |= SCF_EMULATE_QUEUE_FULL;
3480 list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list); 3474 list_add_tail(&cmd->se_qf_node, &cmd->se_dev->qf_cmd_list);
3481 atomic_inc(&dev->dev_qf_count); 3475 atomic_inc(&dev->dev_qf_count);
3482 smp_mb__after_atomic_inc(); 3476 smp_mb__after_atomic_inc();