On Wed, 2015-09-30 at 09:08 -0700, Christoph Hellwig wrote:
> Hi all,
> 
> I'd like to propose the following patch intead.  It uses a helper
> to check the conditions for the copied commands, and also fixes another
> place to use it which uses a different and I think buggy check:
> 
> This avoids the usage of scsi_cmnd.SCp which I'd like to get rid of
> mid-term.
> 
> diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
> index add419d..74eac90 100644
> --- a/drivers/scsi/3w-9xxx.c
> +++ b/drivers/scsi/3w-9xxx.c
> @@ -212,6 +212,17 @@ static const struct file_operations twa_fops = {
>       .llseek         = noop_llseek,
>  };
>  
> +/*
> + * The controllers use an inline buffer instead of a mapped SGL for small,
> + * single entry buffers.  Note that we treat a zero-length transfer like
> + * a mapped SGL.
> + */
> +static bool twa_command_mapped(struct scsi_cmnd *cmd)
> +{
> +     return scsi_sg_count(cmd) != 1 ||
> +             scsi_bufflen(cmd) >= TW_MIN_SGL_LENGTH;
> +}

I already thought of this.  Unfortunately, it fails if the internally
posted command is a single sector (the size of TW_MIN_SGL_LENGTH), which
is true for most of them.

James


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

Reply via email to