Re: [PATCH 20/29] target: Rename generic_allocate_tasks to generic_setup_cmd_from_cdb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-04-03 at 15:51 -0700, Andy Grover wrote:
> Fix a horribly misnamed function. allocate_tasks() doesn't allocate tasks,
> generic_new_cmd() does!
> 

This is rename is too long, and should be using the target_* prefix
instead..

Changing this patch to use target_setup_cmd_from_cdb() instead.

--nab

> Signed-off-by: Andy Grover <agrover@xxxxxxxxxx>
> ---
>  drivers/scsi/ibmvscsi/ibmvscsis.c           |    2 +-
>  drivers/target/iscsi/iscsi_target.c         |    9 ++-------
>  drivers/target/loopback/tcm_loop.c          |    4 ++--
>  drivers/target/target_core_transport.c      |   10 +++++-----
>  drivers/target/tcm_vhost/tcm_vhost_fabric.c |    2 +-
>  drivers/target/tcm_vhost/tcm_vhost_scsi.c   |    2 +-
>  drivers/target/usb-gadget/fabric.c          |    2 +-
>  include/target/target_core_fabric.h         |    2 +-
>  8 files changed, 14 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/scsi/ibmvscsi/ibmvscsis.c b/drivers/scsi/ibmvscsi/ibmvscsis.c
> index 20a0412..f846349 100644
> --- a/drivers/scsi/ibmvscsi/ibmvscsis.c
> +++ b/drivers/scsi/ibmvscsi/ibmvscsis.c
> @@ -870,7 +870,7 @@ static int tcm_queuecommand(struct ibmvscsis_adapter *adapter,
>  	/*
>  	 * Allocate the necessary tasks to complete the received CDB+data
>  	 */
> -	ret = transport_generic_allocate_tasks(se_cmd, scmd->cdb);
> +	ret = transport_generic_setup_cmd_from_cdb(se_cmd, scmd->cdb);
>  	if (ret == -ENOMEM) {
>  		transport_send_check_condition_and_sense(se_cmd,
>  				TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index d654415..e5624f0 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -1015,13 +1015,8 @@ done:
>  		send_check_condition = 1;
>  		goto attach_cmd;
>  	}
> -	/*
> -	 * The Initiator Node has access to the LUN (the addressing method
> -	 * is handled inside of iscsit_get_lun_for_cmd()).  Now it's time to
> -	 * allocate 1->N transport tasks (depending on sector count and
> -	 * maximum request size the physical HBA(s) can handle.
> -	 */
> -	transport_ret = transport_generic_allocate_tasks(&cmd->se_cmd, hdr->cdb);
> +
> +	transport_ret = transport_generic_setup_cmd_from_cdb(&cmd->se_cmd, hdr->cdb);
>  	if (transport_ret == -ENOMEM) {
>  		return iscsit_add_reject_from_cmd(
>  				ISCSI_REASON_BOOKMARK_NO_RESOURCES,
> diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
> index 484a253..b134221 100644
> --- a/drivers/target/loopback/tcm_loop.c
> +++ b/drivers/target/loopback/tcm_loop.c
> @@ -213,7 +213,7 @@ static void tcm_loop_submission_work(struct work_struct *work)
>  	 * associated read buffers, go ahead and do that here for type
>  	 * SCF_SCSI_CONTROL_SG_IO_CDB.  Also note that this is currently
>  	 * guaranteed to be a single SGL for SCF_SCSI_CONTROL_SG_IO_CDB
> -	 * by target core in transport_generic_allocate_tasks() ->
> +	 * by target core in transport_generic_setup_cmd_from_cdb() ->
>  	 * transport_generic_cmd_sequencer().
>  	 */
>  	if (se_cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB &&
> @@ -227,7 +227,7 @@ static void tcm_loop_submission_work(struct work_struct *work)
>  		}
>  	}
>  
> -	ret = transport_generic_allocate_tasks(se_cmd, sc->cmnd);
> +	ret = transport_generic_setup_cmd_from_cdb(se_cmd, sc->cmnd);
>  	if (ret == -ENOMEM) {
>  		transport_send_check_condition_and_sense(se_cmd,
>  				TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE, 0);
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index 9e2524a..a679b7a 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -1553,11 +1553,11 @@ static int transport_check_alloc_task_attr(struct se_cmd *cmd)
>  	return 0;
>  }
>  
> -/*	transport_generic_allocate_tasks():
> +/*	transport_generic_setup_cmd_from_cdb():
>   *
>   *	Called from fabric RX Thread.
>   */
> -int transport_generic_allocate_tasks(
> +int transport_generic_setup_cmd_from_cdb(
>  	struct se_cmd *cmd,
>  	unsigned char *cdb)
>  {
> @@ -1623,7 +1623,7 @@ int transport_generic_allocate_tasks(
>  	spin_unlock(&cmd->se_lun->lun_sep_lock);
>  	return 0;
>  }
> -EXPORT_SYMBOL(transport_generic_allocate_tasks);
> +EXPORT_SYMBOL(transport_generic_setup_cmd_from_cdb);
>  
>  /*
>   * Used by fabric module frontends to queue tasks directly.
> @@ -1731,7 +1731,7 @@ void target_submit_cmd(struct se_cmd *se_cmd, struct se_session *se_sess,
>  	 * Sanitize CDBs via transport_generic_cmd_sequencer() and
>  	 * allocate the necessary tasks to complete the received CDB+data
>  	 */
> -	rc = transport_generic_allocate_tasks(se_cmd, cdb);
> +	rc = transport_generic_setup_cmd_from_cdb(se_cmd, cdb);
>  	if (rc != 0) {
>  		transport_generic_request_failure(se_cmd);
>  		return;
> @@ -2586,7 +2586,7 @@ static int target_check_write_same_discard(unsigned char *flags, struct se_devic
>   *	Generic Command Sequencer that should work for most DAS transport
>   *	drivers.
>   *
> - *	Called from transport_generic_allocate_tasks() in the $FABRIC_MOD
> + *	Called from transport_generic_setup_cmd_from_cdb() in the $FABRIC_MOD
>   *	RX Thread.
>   *
>   *	FIXME: Need to support other SCSI OPCODES where as well.
> diff --git a/drivers/target/tcm_vhost/tcm_vhost_fabric.c b/drivers/target/tcm_vhost/tcm_vhost_fabric.c
> index f7ab6a6..2259aaf 100644
> --- a/drivers/target/tcm_vhost/tcm_vhost_fabric.c
> +++ b/drivers/target/tcm_vhost/tcm_vhost_fabric.c
> @@ -235,7 +235,7 @@ int tcm_vhost_new_cmd_map(struct se_cmd *se_cmd)
>  	/*
>  	 * Allocate the necessary tasks to complete the received CDB+data
>  	 */
> -	ret = transport_generic_allocate_tasks(se_cmd, tv_cmd->tvc_cdb);
> +	ret = transport_generic_setup_cmd_from_cdb(se_cmd, tv_cmd->tvc_cdb);
>  	if (ret != 0)
>  		return ret;
>  	/*
> diff --git a/drivers/target/tcm_vhost/tcm_vhost_scsi.c b/drivers/target/tcm_vhost/tcm_vhost_scsi.c
> index f887ed5..c876681 100644
> --- a/drivers/target/tcm_vhost/tcm_vhost_scsi.c
> +++ b/drivers/target/tcm_vhost/tcm_vhost_scsi.c
> @@ -371,7 +371,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs)
>  		/*
>  		 * Copy in the recieved CDB descriptor into tv_cmd->tvc_cdb
>  		 * that will be used by tcm_vhost_new_cmd_map() and down into
> -		 * transport_generic_allocate_tasks()
> +		 * transport_generic_setup_cmd_from_cdb()
>  		 */
>  		ret = __copy_from_user(tv_cmd->tvc_cdb, vq->iov[1].iov_base,
>  					vq->iov[1].iov_len);
> diff --git a/drivers/target/usb-gadget/fabric.c b/drivers/target/usb-gadget/fabric.c
> index e28d9db..81ddfe0 100644
> --- a/drivers/target/usb-gadget/fabric.c
> +++ b/drivers/target/usb-gadget/fabric.c
> @@ -531,7 +531,7 @@ int usbg_new_cmd(struct se_cmd *se_cmd)
>  			se_cmd);
>  	int ret;
>  
> -	ret = transport_generic_allocate_tasks(se_cmd, cmd->cmd_buf);
> +	ret = transport_generic_setup_cmd_from_cdb(se_cmd, cmd->cmd_buf);
>  	if (ret)
>  		return ret;
>  
> diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
> index cc64a94..b438f7a 100644
> --- a/include/target/target_core_fabric.h
> +++ b/include/target/target_core_fabric.h
> @@ -106,7 +106,7 @@ void	transport_deregister_session(struct se_session *);
>  void	transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
>  		struct se_session *, u32, int, int, unsigned char *);
>  int	transport_lookup_cmd_lun(struct se_cmd *, u32);
> -int	transport_generic_allocate_tasks(struct se_cmd *, unsigned char *);
> +int	transport_generic_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
>  int	transport_handle_cdb_direct(struct se_cmd *);
>  void	target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
>  		unsigned char *, u32, u32, int, int, int);


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


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux