aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-10-17 13:56:49 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-10-23 23:21:46 -0400
commit4499dda85890e6726def812febaab5dc064cc920 (patch)
tree3b97ab6a88f58aa162a38f1e052e6655588553d0 /drivers/target
parentcc5d0f0f61645ca43d9a7320ec2f268bad5016c5 (diff)
target: move depth_left manipulation out of transport_generic_request_failure
We only need to decrement dev->depth_left if failing a command from __transport_execute_tasks. Instead of doing it first thing in transport_generic_request_failure and requiring a pseudo-flag argument for it just opencode the decrement in the two callers (which should be factored into a single one anyway) 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.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 19ea1c38d70a..53d332c87dcf 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1646,8 +1646,8 @@ int transport_generic_allocate_tasks(
1646} 1646}
1647EXPORT_SYMBOL(transport_generic_allocate_tasks); 1647EXPORT_SYMBOL(transport_generic_allocate_tasks);
1648 1648
1649static void transport_generic_request_failure(struct se_cmd *, 1649static void transport_generic_request_failure(struct se_cmd *, int, int);
1650 struct se_device *, int, int); 1650
1651/* 1651/*
1652 * Used by fabric module frontends to queue tasks directly. 1652 * Used by fabric module frontends to queue tasks directly.
1653 * Many only be used from process context only 1653 * Many only be used from process context only
@@ -1689,7 +1689,7 @@ int transport_handle_cdb_direct(
1689 return 0; 1689 return 0;
1690 else if (ret < 0) { 1690 else if (ret < 0) {
1691 cmd->transport_error_status = ret; 1691 cmd->transport_error_status = ret;
1692 transport_generic_request_failure(cmd, NULL, 0, 1692 transport_generic_request_failure(cmd, 0,
1693 (cmd->data_direction != DMA_TO_DEVICE)); 1693 (cmd->data_direction != DMA_TO_DEVICE));
1694 } 1694 }
1695 return 0; 1695 return 0;
@@ -1837,7 +1837,6 @@ static int transport_stop_tasks_for_cmd(struct se_cmd *cmd)
1837 */ 1837 */
1838static void transport_generic_request_failure( 1838static void transport_generic_request_failure(
1839 struct se_cmd *cmd, 1839 struct se_cmd *cmd,
1840 struct se_device *dev,
1841 int complete, 1840 int complete,
1842 int sc) 1841 int sc)
1843{ 1842{
@@ -1862,8 +1861,6 @@ static void transport_generic_request_failure(
1862 atomic_read(&cmd->t_transport_stop), 1861 atomic_read(&cmd->t_transport_stop),
1863 atomic_read(&cmd->t_transport_sent)); 1862 atomic_read(&cmd->t_transport_sent));
1864 1863
1865 if (dev)
1866 atomic_inc(&dev->depth_left);
1867 /* 1864 /*
1868 * For SAM Task Attribute emulation for failed struct se_cmd 1865 * For SAM Task Attribute emulation for failed struct se_cmd
1869 */ 1866 */
@@ -2230,7 +2227,7 @@ static int transport_execute_tasks(struct se_cmd *cmd)
2230 2227
2231 if (se_dev_check_online(cmd->se_orig_obj_ptr) != 0) { 2228 if (se_dev_check_online(cmd->se_orig_obj_ptr) != 0) {
2232 cmd->transport_error_status = PYX_TRANSPORT_LU_COMM_FAILURE; 2229 cmd->transport_error_status = PYX_TRANSPORT_LU_COMM_FAILURE;
2233 transport_generic_request_failure(cmd, NULL, 0, 1); 2230 transport_generic_request_failure(cmd, 0, 1);
2234 return 0; 2231 return 0;
2235 } 2232 }
2236 2233
@@ -2325,7 +2322,8 @@ check_depth:
2325 del_timer_sync(&task->task_timer); 2322 del_timer_sync(&task->task_timer);
2326 atomic_set(&cmd->transport_sent, 0); 2323 atomic_set(&cmd->transport_sent, 0);
2327 transport_stop_tasks_for_cmd(cmd); 2324 transport_stop_tasks_for_cmd(cmd);
2328 transport_generic_request_failure(cmd, dev, 0, 1); 2325 atomic_inc(&dev->depth_left);
2326 transport_generic_request_failure(cmd, 0, 1);
2329 goto check_depth; 2327 goto check_depth;
2330 } 2328 }
2331 /* 2329 /*
@@ -2364,7 +2362,8 @@ check_depth:
2364 del_timer_sync(&task->task_timer); 2362 del_timer_sync(&task->task_timer);
2365 atomic_set(&cmd->transport_sent, 0); 2363 atomic_set(&cmd->transport_sent, 0);
2366 transport_stop_tasks_for_cmd(cmd); 2364 transport_stop_tasks_for_cmd(cmd);
2367 transport_generic_request_failure(cmd, dev, 0, 1); 2365 atomic_inc(&dev->depth_left);
2366 transport_generic_request_failure(cmd, 0, 1);
2368 } 2367 }
2369 } 2368 }
2370 2369
@@ -4767,7 +4766,7 @@ get_cmd:
4767 ret = cmd->se_tfo->new_cmd_map(cmd); 4766 ret = cmd->se_tfo->new_cmd_map(cmd);
4768 if (ret < 0) { 4767 if (ret < 0) {
4769 cmd->transport_error_status = ret; 4768 cmd->transport_error_status = ret;
4770 transport_generic_request_failure(cmd, NULL, 4769 transport_generic_request_failure(cmd,
4771 0, (cmd->data_direction != 4770 0, (cmd->data_direction !=
4772 DMA_TO_DEVICE)); 4771 DMA_TO_DEVICE));
4773 break; 4772 break;
@@ -4777,7 +4776,7 @@ get_cmd:
4777 break; 4776 break;
4778 else if (ret < 0) { 4777 else if (ret < 0) {
4779 cmd->transport_error_status = ret; 4778 cmd->transport_error_status = ret;
4780 transport_generic_request_failure(cmd, NULL, 4779 transport_generic_request_failure(cmd,
4781 0, (cmd->data_direction != 4780 0, (cmd->data_direction !=
4782 DMA_TO_DEVICE)); 4781 DMA_TO_DEVICE));
4783 } 4782 }
@@ -4798,7 +4797,7 @@ get_cmd:
4798 transport_generic_do_tmr(cmd); 4797 transport_generic_do_tmr(cmd);
4799 break; 4798 break;
4800 case TRANSPORT_COMPLETE_FAILURE: 4799 case TRANSPORT_COMPLETE_FAILURE:
4801 transport_generic_request_failure(cmd, NULL, 1, 1); 4800 transport_generic_request_failure(cmd, 1, 1);
4802 break; 4801 break;
4803 case TRANSPORT_COMPLETE_TIMEOUT: 4802 case TRANSPORT_COMPLETE_TIMEOUT:
4804 transport_generic_request_timeout(cmd); 4803 transport_generic_request_timeout(cmd);