diff mbox

[v4,32/37] target: Inline transport_put_cmd()

Message ID 20170208222507.25715-33-bart.vanassche@sandisk.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche Feb. 8, 2017, 10:25 p.m. UTC
The transport_put_cmd() function consists of two lines of code.
Due to previous patches only two callers are left. Hence
inline this function.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
---
 drivers/target/target_core_transport.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

Comments

Nicholas A. Bellinger Feb. 9, 2017, 11:18 a.m. UTC | #1
On Wed, 2017-02-08 at 14:25 -0800, Bart Van Assche wrote:
> The transport_put_cmd() function consists of two lines of code.
> Due to previous patches only two callers are left. Hence
> inline this function.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Reviewed-by: Hannes Reinecke <hare@suse.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Andy Grover <agrover@redhat.com>
> Cc: David Disseldorp <ddiss@suse.de>
> ---
>  drivers/target/target_core_transport.c | 22 +++-------------------
>  1 file changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index fdd06ecacd52..8df03987bdb8 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -66,7 +66,6 @@ struct kmem_cache *t10_alua_lba_map_mem_cache;
>  static void transport_complete_task_attr(struct se_cmd *cmd);
>  static void transport_handle_queue_full(struct se_cmd *cmd,
>  		struct se_device *dev);
> -static int transport_put_cmd(struct se_cmd *cmd);
>  static void target_complete_ok_work(struct work_struct *work);
>  
>  int init_se_kmem_caches(void)
> @@ -697,7 +696,7 @@ static void transport_handle_abort(struct se_cmd *cmd)
>  		 * commands" in SAM.
>  		 */
>  		if (transport_cmd_check_stop_to_fabric(cmd) == 0 && ack_kref)
> -			transport_put_cmd(cmd);
> +			target_put_sess_cmd(cmd);
>  	}
>  }
>  
> @@ -2256,22 +2255,6 @@ static inline void transport_free_pages(struct se_cmd *cmd)
>  	cmd->t_bidi_data_nents = 0;
>  }
>  
> -/**
> - * transport_put_cmd - release a reference to a command
> - * @cmd:       command to release
> - *
> - * This routine releases our reference to the command and frees it if possible.
> - */
> -static int transport_put_cmd(struct se_cmd *cmd)
> -{
> -	BUG_ON(!cmd->se_tfo);
> -	/*
> -	 * If this cmd has been setup with target_get_sess_cmd(), drop
> -	 * the kref and call ->release_cmd() in kref callback.
> -	 */
> -	return target_put_sess_cmd(cmd);
> -}
> -
>  void *transport_kmap_data_sg(struct se_cmd *cmd)
>  {
>  	struct scatterlist *sg = cmd->t_data_sg;
> @@ -2528,7 +2511,8 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
>  		pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag);
>  		wait_for_completion(&cmd->complete);
>  	}
> -	return transport_put_cmd(cmd);
> +	BUG_ON(!cmd->se_tfo);
> +	return target_put_sess_cmd(cmd);
>  }
>  EXPORT_SYMBOL(transport_generic_free_cmd);
>  

This patch depends on a number of previous ones.

Ignoring for now.


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index fdd06ecacd52..8df03987bdb8 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -66,7 +66,6 @@  struct kmem_cache *t10_alua_lba_map_mem_cache;
 static void transport_complete_task_attr(struct se_cmd *cmd);
 static void transport_handle_queue_full(struct se_cmd *cmd,
 		struct se_device *dev);
-static int transport_put_cmd(struct se_cmd *cmd);
 static void target_complete_ok_work(struct work_struct *work);
 
 int init_se_kmem_caches(void)
@@ -697,7 +696,7 @@  static void transport_handle_abort(struct se_cmd *cmd)
 		 * commands" in SAM.
 		 */
 		if (transport_cmd_check_stop_to_fabric(cmd) == 0 && ack_kref)
-			transport_put_cmd(cmd);
+			target_put_sess_cmd(cmd);
 	}
 }
 
@@ -2256,22 +2255,6 @@  static inline void transport_free_pages(struct se_cmd *cmd)
 	cmd->t_bidi_data_nents = 0;
 }
 
-/**
- * transport_put_cmd - release a reference to a command
- * @cmd:       command to release
- *
- * This routine releases our reference to the command and frees it if possible.
- */
-static int transport_put_cmd(struct se_cmd *cmd)
-{
-	BUG_ON(!cmd->se_tfo);
-	/*
-	 * If this cmd has been setup with target_get_sess_cmd(), drop
-	 * the kref and call ->release_cmd() in kref callback.
-	 */
-	return target_put_sess_cmd(cmd);
-}
-
 void *transport_kmap_data_sg(struct se_cmd *cmd)
 {
 	struct scatterlist *sg = cmd->t_data_sg;
@@ -2528,7 +2511,8 @@  int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
 		pr_debug("Detected CMD_T_ABORTED for ITT: %llu\n", cmd->tag);
 		wait_for_completion(&cmd->complete);
 	}
-	return transport_put_cmd(cmd);
+	BUG_ON(!cmd->se_tfo);
+	return target_put_sess_cmd(cmd);
 }
 EXPORT_SYMBOL(transport_generic_free_cmd);