aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-09-13 17:08:50 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2011-10-23 23:20:36 -0400
commite6a2573f1f5d66f0456c433afdfc63f33fdf9008 (patch)
tree90b36ed3403ab420521134e86f050e339d270b7b
parent4911e3ccbec047ed1f728e19a70ad87729a3fb01 (diff)
target: remove transport_generic_remove
All callers that never have the session_reinstatement flag set can trivially be converted to transport_put_cmd. Opencode the session reinstatement code in transport_generic_free_cmd, which was the only caller ever asking for it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/target/target_core_transport.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index a650100d997a..4f21b88b85b1 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -86,8 +86,6 @@ static u32 transport_allocate_tasks(struct se_cmd *cmd,
86 enum dma_data_direction data_direction, 86 enum dma_data_direction data_direction,
87 struct scatterlist *sgl, unsigned int nents); 87 struct scatterlist *sgl, unsigned int nents);
88static int transport_generic_get_mem(struct se_cmd *cmd); 88static int transport_generic_get_mem(struct se_cmd *cmd);
89static int transport_generic_remove(struct se_cmd *cmd,
90 int session_reinstatement);
91static bool transport_put_cmd(struct se_cmd *cmd); 89static bool transport_put_cmd(struct se_cmd *cmd);
92static void transport_remove_cmd_from_queue(struct se_cmd *cmd, 90static void transport_remove_cmd_from_queue(struct se_cmd *cmd,
93 struct se_queue_obj *qobj); 91 struct se_queue_obj *qobj);
@@ -599,7 +597,7 @@ void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
599 return; 597 return;
600 if (remove) { 598 if (remove) {
601 transport_remove_cmd_from_queue(cmd, &cmd->se_dev->dev_queue_obj); 599 transport_remove_cmd_from_queue(cmd, &cmd->se_dev->dev_queue_obj);
602 transport_generic_remove(cmd, 0); 600 transport_put_cmd(cmd);
603 } 601 }
604} 602}
605 603
@@ -610,7 +608,7 @@ void transport_cmd_finish_abort_tmr(struct se_cmd *cmd)
610 if (transport_cmd_check_stop_to_fabric(cmd)) 608 if (transport_cmd_check_stop_to_fabric(cmd))
611 return; 609 return;
612 610
613 transport_generic_remove(cmd, 0); 611 transport_put_cmd(cmd);
614} 612}
615 613
616static void transport_add_cmd_to_queue( 614static void transport_add_cmd_to_queue(
@@ -2072,7 +2070,7 @@ static void transport_generic_request_timeout(struct se_cmd *cmd)
2072 unsigned long flags; 2070 unsigned long flags;
2073 2071
2074 /* 2072 /*
2075 * Reset cmd->t_se_count to allow transport_generic_remove() 2073 * Reset cmd->t_se_count to allow transport_put_cmd()
2076 * to allow last call to free memory resources. 2074 * to allow last call to free memory resources.
2077 */ 2075 */
2078 spin_lock_irqsave(&cmd->t_state_lock, flags); 2076 spin_lock_irqsave(&cmd->t_state_lock, flags);
@@ -2083,7 +2081,7 @@ static void transport_generic_request_timeout(struct se_cmd *cmd)
2083 } 2081 }
2084 spin_unlock_irqrestore(&cmd->t_state_lock, flags); 2082 spin_unlock_irqrestore(&cmd->t_state_lock, flags);
2085 2083
2086 transport_generic_remove(cmd, 0); 2084 transport_put_cmd(cmd);
2087} 2085}
2088 2086
2089static inline u32 transport_lba_21(unsigned char *cdb) 2087static inline u32 transport_lba_21(unsigned char *cdb)
@@ -3772,24 +3770,6 @@ out_busy:
3772 return false; 3770 return false;
3773} 3771}
3774 3772
3775static int
3776transport_generic_remove(struct se_cmd *cmd, int session_reinstatement)
3777{
3778 unsigned long flags;
3779
3780 if (!transport_put_cmd(cmd)) {
3781 if (session_reinstatement) {
3782 spin_lock_irqsave(&cmd->t_state_lock, flags);
3783 transport_all_task_dev_remove_state(cmd);
3784 spin_unlock_irqrestore(&cmd->t_state_lock,
3785 flags);
3786 }
3787 return 1;
3788 }
3789
3790 return 0;
3791}
3792
3793/* 3773/*
3794 * transport_generic_map_mem_to_cmd - Use fabric-alloced pages instead of 3774 * transport_generic_map_mem_to_cmd - Use fabric-alloced pages instead of
3795 * allocating in the core. 3775 * allocating in the core.
@@ -4379,7 +4359,13 @@ void transport_generic_free_cmd(
4379 4359
4380 transport_free_dev_tasks(cmd); 4360 transport_free_dev_tasks(cmd);
4381 4361
4382 transport_generic_remove(cmd, session_reinstatement); 4362 if (!transport_put_cmd(cmd) && session_reinstatement) {
4363 unsigned long flags;
4364
4365 spin_lock_irqsave(&cmd->t_state_lock, flags);
4366 transport_all_task_dev_remove_state(cmd);
4367 spin_unlock_irqrestore(&cmd->t_state_lock, flags);
4368 }
4383 } 4369 }
4384} 4370}
4385EXPORT_SYMBOL(transport_generic_free_cmd); 4371EXPORT_SYMBOL(transport_generic_free_cmd);
@@ -5066,7 +5052,7 @@ static void transport_processing_shutdown(struct se_device *dev)
5066 transport_lun_remove_cmd(cmd); 5052 transport_lun_remove_cmd(cmd);
5067 5053
5068 if (transport_cmd_check_stop(cmd, 1, 0)) 5054 if (transport_cmd_check_stop(cmd, 1, 0))
5069 transport_generic_remove(cmd, 0); 5055 transport_put_cmd(cmd);
5070 } 5056 }
5071 5057
5072 spin_lock_irqsave(&dev->execute_task_lock, flags); 5058 spin_lock_irqsave(&dev->execute_task_lock, flags);
@@ -5094,7 +5080,7 @@ static void transport_processing_shutdown(struct se_device *dev)
5094 transport_lun_remove_cmd(cmd); 5080 transport_lun_remove_cmd(cmd);
5095 5081
5096 if (transport_cmd_check_stop(cmd, 1, 0)) 5082 if (transport_cmd_check_stop(cmd, 1, 0))
5097 transport_generic_remove(cmd, 0); 5083 transport_put_cmd(cmd);
5098 } 5084 }
5099 5085
5100 spin_lock_irqsave(&dev->execute_task_lock, flags); 5086 spin_lock_irqsave(&dev->execute_task_lock, flags);
@@ -5117,7 +5103,7 @@ static void transport_processing_shutdown(struct se_device *dev)
5117 } else { 5103 } else {
5118 transport_lun_remove_cmd(cmd); 5104 transport_lun_remove_cmd(cmd);
5119 if (transport_cmd_check_stop(cmd, 1, 0)) 5105 if (transport_cmd_check_stop(cmd, 1, 0))
5120 transport_generic_remove(cmd, 0); 5106 transport_put_cmd(cmd);
5121 } 5107 }
5122 } 5108 }
5123} 5109}
@@ -5192,7 +5178,7 @@ get_cmd:
5192 transport_generic_complete_ok(cmd); 5178 transport_generic_complete_ok(cmd);
5193 break; 5179 break;
5194 case TRANSPORT_REMOVE: 5180 case TRANSPORT_REMOVE:
5195 transport_generic_remove(cmd, 0); 5181 transport_put_cmd(cmd);
5196 break; 5182 break;
5197 case TRANSPORT_FREE_CMD_INTR: 5183 case TRANSPORT_FREE_CMD_INTR:
5198 transport_generic_free_cmd(cmd, 0, 0); 5184 transport_generic_free_cmd(cmd, 0, 0);