Re: [PATCH 07/12] qla2xxx: use target_execute_cmd

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

 



On Sun, 2012-07-08 at 15:58 -0400, Christoph Hellwig wrote:
> plain text document attachment (qla2xxx-use-target_execute_cmd)
> Defer the whole tcm_qla2xxx_handle_data call instead of just the error
> path to the qla2xxx-internal workqueue.  Also remove the useless lock around
> the CMD_T_ABORTED check.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> 

Looks good AFAICT.  CCing Roland + Giridhar + Qlogic folks for good
measure on this one..

> ---
>  drivers/scsi/qla2xxx/qla_target.h  |    2 -
>  drivers/scsi/qla2xxx/tcm_qla2xxx.c |   46 ++++++++++++++-----------------------
>  2 files changed, 19 insertions(+), 29 deletions(-)
> 
> Index: lio-core/drivers/scsi/qla2xxx/qla_target.h
> ===================================================================
> --- lio-core.orig/drivers/scsi/qla2xxx/qla_target.h	2012-07-01 14:29:18.324261929 +0200
> +++ lio-core/drivers/scsi/qla2xxx/qla_target.h	2012-07-01 14:29:34.590928498 +0200
> @@ -639,7 +639,7 @@ struct qla_tgt_func_tmpl {
>  
>  	int (*handle_cmd)(struct scsi_qla_host *, struct qla_tgt_cmd *,
>  			unsigned char *, uint32_t, int, int, int);
> -	int (*handle_data)(struct qla_tgt_cmd *);
> +	void (*handle_data)(struct qla_tgt_cmd *);
>  	int (*handle_tmr)(struct qla_tgt_mgmt_cmd *, uint32_t, uint8_t,
>  			uint32_t);
>  	void (*free_cmd)(struct qla_tgt_cmd *);
> Index: lio-core/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> ===================================================================
> --- lio-core.orig/drivers/scsi/qla2xxx/tcm_qla2xxx.c	2012-07-01 14:29:18.324261929 +0200
> +++ lio-core/drivers/scsi/qla2xxx/tcm_qla2xxx.c	2012-07-01 14:29:34.590928498 +0200
> @@ -604,22 +604,10 @@ static int tcm_qla2xxx_handle_cmd(scsi_q
>  	return 0;
>  }
>  
> -static void tcm_qla2xxx_do_rsp(struct work_struct *work)
> +static void tcm_qla2xxx_handle_data_work(struct work_struct *work)
>  {
>  	struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work);
> -	/*
> -	 * Dispatch ->queue_status from workqueue process context
> -	 */
> -	transport_generic_request_failure(&cmd->se_cmd);
> -}
>  
> -/*
> - * Called from qla_target.c:qlt_do_ctio_completion()
> - */
> -static int tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
> -{
> -	struct se_cmd *se_cmd = &cmd->se_cmd;
> -	unsigned long flags;
>  	/*
>  	 * Ensure that the complete FCP WRITE payload has been received.
>  	 * Otherwise return an exception via CHECK_CONDITION status.
> @@ -629,24 +617,26 @@ static int tcm_qla2xxx_handle_data(struc
>  		 * Check if se_cmd has already been aborted via LUN_RESET, and
>  		 * waiting upon completion in tcm_qla2xxx_write_pending_status()
>  		 */
> -		spin_lock_irqsave(&se_cmd->t_state_lock, flags);
> -		if (se_cmd->transport_state & CMD_T_ABORTED) {
> -			spin_unlock_irqrestore(&se_cmd->t_state_lock, flags);
> -			complete(&se_cmd->t_transport_stop_comp);
> -			return 0;
> +		if (cmd->se_cmd.transport_state & CMD_T_ABORTED) {
> +			complete(&cmd->se_cmd.t_transport_stop_comp);
> +			return;
>  		}
> -		spin_unlock_irqrestore(&se_cmd->t_state_lock, flags);
>  
> -		se_cmd->scsi_sense_reason = TCM_CHECK_CONDITION_ABORT_CMD;
> -		INIT_WORK(&cmd->work, tcm_qla2xxx_do_rsp);
> -		queue_work(tcm_qla2xxx_free_wq, &cmd->work);
> -		return 0;
> +		cmd->se_cmd.scsi_sense_reason = TCM_CHECK_CONDITION_ABORT_CMD;
> +		transport_generic_request_failure(&cmd->se_cmd);
> +		return;
>  	}
> -	/*
> -	 * We now tell TCM to queue this WRITE CDB with TRANSPORT_PROCESS_WRITE
> -	 * status to the backstore processing thread.
> -	 */
> -	return transport_generic_handle_data(&cmd->se_cmd);
> +
> +	return target_execute_cmd(&cmd->se_cmd);
> +}
> +
> +/*
> + * Called from qla_target.c:qlt_do_ctio_completion()
> + */
> +static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
> +{
> +	INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work);
> +	queue_work(tcm_qla2xxx_free_wq, &cmd->work);
>  }
>  
>  /*
> 
> --
> 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


--
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