Re: What does scsi_level mean?

2007-07-22 Thread jidong xiao

Any one can kindly explain this?

Thanks
Jason Xiao

On 7/21/07, jidong xiao <[EMAIL PROTECTED]> wrote:

I noticed that there is a char scsi_level in the struct scsi_device,
what does scsi_level mean?

struct scsi_device {
...
   char scsi_level;
...
}

Is it SCSI revision?
If the answer is true, then I am quite curious, from the code I have
read, SCSI_2 is something special, see following function:
picked up from drivers/scsi/scsi_sysfs.c:
int scsi_sysfs_target_initialize(struct scsi_device *sdev){
   /*
* If there wasn't another lun already configured at
* this target, then default this device to SCSI_2
* until we know better
*/
   sdev->scsi_level = SCSI_2;
}

Why SCSI_2 could be the default value, why not SCSI_1, why not SCSI_3,
and etc.Seems SCSI_2 is distinguished from other levels,any reason for
this?

Thanks
Jason Xiao


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


Re: [PATCH 4/9] qla2xxx: Validate mid-layer 'underflow' during check-condition handling.

2007-07-22 Thread Boaz Harrosh
Andrew Vasquez wrote:
> From: Shyam Sundar <[EMAIL PROTECTED]>
> 
> Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
> ---
>  drivers/scsi/qla2xxx/qla_isr.c |   19 +++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index fa21cd8..4a50b93 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -1062,6 +1062,25 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
>   cp->device->id, cp->device->lun, cp,
>   cp->serial_number));
>  
> + /*
> +  * In case of a Underrun condition, set both the lscsi
> +  * status and the completion status to appropriate
> +  * values.
> +  */
> + if (resid &&
> + ((unsigned)(cp->request_bufflen - resid) <
> +  cp->underflow)) {
> + DEBUG2(qla_printk(KERN_INFO, ha,
> + "scsi(%ld:%d:%d:%d): Mid-layer underflow "
> + "detected (%x of %x bytes)...returning "
> + "error status.\n", ha->host_no,
> + cp->device->channel, cp->device->id,
> + cp->device->lun, resid,
> + cp->request_bufflen));
> +
> + cp->result = DID_ERROR << 16 | lscsi_status;
> + }
> +
>   if (sense_len)
>   DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
>   CMD_ACTUAL_SNSLEN(cp)));
NACK. Breaks data buffers accessors patch. 
(385d70b4e2659ae525a00e46a9f97146949cfc14)
should be:

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index fa21cd8..4a50b93 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1062,6 +1062,25 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
cp->device->id, cp->device->lun, cp,
cp->serial_number));
 
+   /*
+* In case of a Underrun condition, set both the lscsi
+* status and the completion status to appropriate
+* values.
+*/
+   if (resid &&
+   ((unsigned)(scsi_bufflen(cp) - resid) <
+cp->underflow)) {
+   DEBUG2(qla_printk(KERN_INFO, ha,
+   "scsi(%ld:%d:%d:%d): Mid-layer underflow "
+   "detected (%x of %x bytes)...returning "
+   "error status.\n", ha->host_no,
+   cp->device->channel, cp->device->id,
+   cp->device->lun, resid,
+   scsi_bufflen(cp)));
+
+   cp->result = DID_ERROR << 16 | lscsi_status;
+   }
+
if (sense_len)
DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
CMD_ACTUAL_SNSLEN(cp)));

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


Re: [PATCH 4/9] qla2xxx: Validate mid-layer 'underflow' during check-condition handling.

2007-07-22 Thread James Bottomley
On Sun, 2007-07-22 at 13:50 +0300, Boaz Harrosh wrote:
> NACK. Breaks data buffers accessors patch. 
> (385d70b4e2659ae525a00e46a9f97146949cfc14)
> should be:

This isn't bad enough to eject the entire qla enhancement from the tree
on the day the merge window closes to force a rewrite.

> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index fa21cd8..4a50b93 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -1062,6 +1062,25 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
>   cp->device->id, cp->device->lun, cp,
>   cp->serial_number));
>  
> + /*
> +  * In case of a Underrun condition, set both the lscsi
> +  * status and the completion status to appropriate
> +  * values.
> +  */
> + if (resid &&
> + ((unsigned)(scsi_bufflen(cp) - resid) <
> +  cp->underflow)) {
> + DEBUG2(qla_printk(KERN_INFO, ha,
> + "scsi(%ld:%d:%d:%d): Mid-layer underflow "
> + "detected (%x of %x bytes)...returning "
> + "error status.\n", ha->host_no,
> + cp->device->channel, cp->device->id,
> + cp->device->lun, resid,
> + scsi_bufflen(cp)));
> +
> + cp->result = DID_ERROR << 16 | lscsi_status;
> + }
> +
>   if (sense_len)
>   DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
>   CMD_ACTUAL_SNSLEN(cp)));

Could you respin an update against scsi-misc for -rc1?

Thanks,

James


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


drivers/scsi/sym53c416.c - address of 'sym53c416*' will always evaluate as 'true' , warnings

2007-07-22 Thread Gabriel C
Hi,

I got this warnings on current git with gcc 4.2.1 :


...

drivers/scsi/sym53c416.c: In function 'sym53c416_detect':
drivers/scsi/sym53c416.c:638: warning: the address of 'sym53c416' will always 
evaluate as 'true'
drivers/scsi/sym53c416.c:644: warning: the address of 'sym53c416_1' will always 
evaluate as 'true'
drivers/scsi/sym53c416.c:650: warning: the address of 'sym53c416_2' will always 
evaluate as 'true'
drivers/scsi/sym53c416.c:656: warning: the address of 'sym53c416_3' will always 
evaluate as 'true'

...


Regards,

Gabriel C
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/9] qla2xxx: Validate mid-layer 'underflow' during check-condition handling.

2007-07-22 Thread Boaz Harrosh
James Bottomley wrote:
> On Sun, 2007-07-22 at 13:50 +0300, Boaz Harrosh wrote:
>> NACK. Breaks data buffers accessors patch. 
>> (385d70b4e2659ae525a00e46a9f97146949cfc14)
>> should be:
> 
> This isn't bad enough to eject the entire qla enhancement from the tree
> on the day the merge window closes to force a rewrite.
> 
Sorry I did not realize this was for the 2.6.23 merge window
I assumed it is already for the next kernel. You are absolutely
right I'm just nit picking here.

> 
> Could you respin an update against scsi-misc for -rc1?
> 
> Thanks,
> 
> James
> 
> 

You bet:

From: Boaz Harrosh <[EMAIL PROTECTED]>
Date: Sun, 22 Jul 2007 17:24:18 +0300
Subject: [PATCH] qla2xxx: Data accessors Cleanup of last merge

- Left overs from last code merges of qla2xxx

Sign-off-by: Boaz Harrosh <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_isr.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index b8f226a..50539da 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1068,7 +1068,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
 * values.
 */
if (resid &&
-   ((unsigned)(cp->request_bufflen - resid) <
+   ((unsigned)(scsi_bufflen(cp) - resid) <
 cp->underflow)) {
DEBUG2(qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d:%d): Mid-layer underflow "
@@ -1076,7 +1076,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
"error status.\n", ha->host_no,
cp->device->channel, cp->device->id,
cp->device->lun, resid,
-   cp->request_bufflen));
+   scsi_bufflen(cp)));
 
cp->result = DID_ERROR << 16 | lscsi_status;
}
-- 
1.5.2.2.249.g45fd

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


[PATCH] drivers/scsi/g_NCR5380.c - "NCR53C400_PSEUDO_DMA" is not defined

2007-07-22 Thread Gabriel C
Hi,

got this warning with current git :

...

In file included from drivers/scsi/g_NCR5380_mmio.c:9:
drivers/scsi/g_NCR5380.c:559:5: warning: "NCR53C400_PSEUDO_DMA" is not defined

...

Signed-off-by: Gabriel Craciunescu <[EMAIL PROTECTED]>
---

diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index 880f70d..607336f 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -556,7 +556,7 @@ generic_NCR5380_biosparam(struct scsi_device *sdev, struct 
block_device *bdev,
 }
 #endif
 
-#if NCR53C400_PSEUDO_DMA
+#ifdef NCR53C400_PSEUDO_DMA
 
 /**
  * NCR5380_pread   -   pseudo DMA read
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


drivers/scsi/ultrastor.c - matching constraint does not allow a register , warnings

2007-07-22 Thread Gabriel C
Hi,

I got this warnings on current git with gcc 4.2.1 :

...

drivers/scsi/ultrastor.c: In function 'find_and_clear_bit_16':
drivers/scsi/ultrastor.c:303: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:302: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c: At top level:
drivers/scsi/ultrastor.c:1201: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:1201: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c: In function 'ultrastor_queuecommand':
drivers/scsi/ultrastor.c:698: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:698: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:698: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:698: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:698: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:698: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:698: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:698: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:302: warning: matching constraint does not allow a 
register
drivers/scsi/ultrastor.c:302: warning: matching constraint does not allow a 
register

...


Regards,

Gabriel C
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: drivers/scsi/sym53c416.c - address of 'sym53c416*' will always evaluate as 'true' , warnings

2007-07-22 Thread Matthew Wilcox
On Sun, Jul 22, 2007 at 03:52:21PM +0200, Gabriel C wrote:
> drivers/scsi/sym53c416.c: In function 'sym53c416_detect':
> drivers/scsi/sym53c416.c:638: warning: the address of 'sym53c416' will always 
> evaluate as 'true'
> drivers/scsi/sym53c416.c:644: warning: the address of 'sym53c416_1' will 
> always evaluate as 'true'
> drivers/scsi/sym53c416.c:650: warning: the address of 'sym53c416_2' will 
> always evaluate as 'true'
> drivers/scsi/sym53c416.c:656: warning: the address of 'sym53c416_3' will 
> always evaluate as 'true'

These warnings certainly indicate a problem; I've looked through the
driver and it's a bit of a mess.  Do you have one of these cards?  I can
write and send you some patches to test on Monday or Tuesday, after I'm
done with the advansys driver.

-- 
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: drivers/scsi/sym53c416.c - address of 'sym53c416*' will always evaluate as 'true' , warnings

2007-07-22 Thread Gabriel C
Matthew Wilcox wrote:
> On Sun, Jul 22, 2007 at 03:52:21PM +0200, Gabriel C wrote:
>> drivers/scsi/sym53c416.c: In function 'sym53c416_detect':
>> drivers/scsi/sym53c416.c:638: warning: the address of 'sym53c416' will 
>> always evaluate as 'true'
>> drivers/scsi/sym53c416.c:644: warning: the address of 'sym53c416_1' will 
>> always evaluate as 'true'
>> drivers/scsi/sym53c416.c:650: warning: the address of 'sym53c416_2' will 
>> always evaluate as 'true'
>> drivers/scsi/sym53c416.c:656: warning: the address of 'sym53c416_3' will 
>> always evaluate as 'true'
> 
> These warnings certainly indicate a problem; I've looked through the
> driver and it's a bit of a mess.  Do you have one of these cards?  I can
> write and send you some patches to test on Monday or Tuesday, after I'm
> done with the advansys driver.
> 

Sorry , I don't have these cards :/


Regards,

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


[PATCH] Fix drivers/scsi/fdomain.c , CONFIG_PCI=n warnings

2007-07-22 Thread Gabriel C
Hi,

I get this warnings on current git when CONFIG_PCI is not set :

...

drivers/scsi/fdomain.c:390: warning: 'PCI_dev' defined but not used
drivers/scsi/fdomain.c:1768: warning: 'fdomain_pci_tbl' defined but not used

...


Signed-off-by: Gabriel Craciunescu <[EMAIL PROTECTED]>

---

diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 36169d5..5d282e6 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -387,7 +387,9 @@ static void __iomem *bios_mem;
 static int   bios_major;
 static int   bios_minor;
 static int   PCI_bus;
+#ifdef CONFIG_PCI
 static struct pci_dev  *PCI_dev;
+#endif
 static int   Quantum;  /* Quantum board variant */
 static int   interrupt_level;
 static volatile int  in_command;
@@ -1764,6 +1766,7 @@ struct scsi_host_template fdomain_driver_template = {
 };
 
 #ifndef PCMCIA
+#ifdef CONFIG_PCI
 
 static struct pci_device_id fdomain_pci_tbl[] __devinitdata = {
{ PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70,
@@ -1771,7 +1774,7 @@ static struct pci_device_id fdomain_pci_tbl[] 
__devinitdata = {
{ }
 };
 MODULE_DEVICE_TABLE(pci, fdomain_pci_tbl);
-
+#endif
 #define driver_template fdomain_driver_template
 #include "scsi_module.c"
 
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] libsas: make ATA functions selectable by a config option

2007-07-22 Thread James Bottomley
Not everyone wants libsas automatically to pull in libata.  This patch
makes the behaviour configurable, so you can build libsas with or
without ATA support.

James

diff --git a/drivers/scsi/libsas/Kconfig b/drivers/scsi/libsas/Kconfig
index aafdc92..1d6efef 100644
--- a/drivers/scsi/libsas/Kconfig
+++ b/drivers/scsi/libsas/Kconfig
@@ -30,6 +30,14 @@ config SCSI_SAS_LIBSAS
  This provides transport specific helpers for SAS drivers which
  use the domain device construct (like the aic94xxx).
 
+config SCSI_SAS_ATA
+   bool "ATA support for libsas (requires libata)"
+   depends on SCSI_SAS_LIBSAS && ATA
+   help
+   Builds in ATA support into libsas.  Will necessitate
+   the loading of libata along with libsas.
+   
+
 config SCSI_SAS_LIBSAS_DEBUG
bool "Compile the SAS Domain Transport Attributes in debug mode"
default y
diff --git a/drivers/scsi/libsas/Makefile b/drivers/scsi/libsas/Makefile
index 6383eb5..fd387b9 100644
--- a/drivers/scsi/libsas/Makefile
+++ b/drivers/scsi/libsas/Makefile
@@ -33,5 +33,5 @@ libsas-y +=  sas_init.o \
sas_dump.o \
sas_discover.o \
sas_expander.o \
-   sas_scsi_host.o \
-   sas_ata.o
+   sas_scsi_host.o
+libsas-$(CONFIG_SCSI_SAS_ATA) +=   sas_ata.o
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 359391f..ced2de3 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -21,6 +21,8 @@
  * USA
  */
 
+#include 
+
 #include 
 #include "sas_internal.h"
 #include 
@@ -418,3 +420,398 @@ void sas_ata_task_abort(struct sas_task *task)
waiting = qc->private_data;
complete(waiting);
 }
+
+static void sas_task_timedout(unsigned long _task)
+{
+   struct sas_task *task = (void *) _task;
+   unsigned long flags;
+
+   spin_lock_irqsave(&task->task_state_lock, flags);
+   if (!(task->task_state_flags & SAS_TASK_STATE_DONE))
+   task->task_state_flags |= SAS_TASK_STATE_ABORTED;
+   spin_unlock_irqrestore(&task->task_state_lock, flags);
+
+   complete(&task->completion);
+}
+
+static void sas_disc_task_done(struct sas_task *task)
+{
+   if (!del_timer(&task->timer))
+   return;
+   complete(&task->completion);
+}
+
+#define SAS_DEV_TIMEOUT 10
+
+/**
+ * sas_execute_task -- Basic task processing for discovery
+ * @task: the task to be executed
+ * @buffer: pointer to buffer to do I/O
+ * @size: size of @buffer
+ * @pci_dma_dir: PCI_DMA_...
+ */
+static int sas_execute_task(struct sas_task *task, void *buffer, int size,
+   int pci_dma_dir)
+{
+   int res = 0;
+   struct scatterlist *scatter = NULL;
+   struct task_status_struct *ts = &task->task_status;
+   int num_scatter = 0;
+   int retries = 0;
+   struct sas_internal *i =
+   to_sas_internal(task->dev->port->ha->core.shost->transportt);
+
+   if (pci_dma_dir != PCI_DMA_NONE) {
+   scatter = kzalloc(sizeof(*scatter), GFP_KERNEL);
+   if (!scatter)
+   goto out;
+
+   sg_init_one(scatter, buffer, size);
+   num_scatter = 1;
+   }
+
+   task->task_proto = task->dev->tproto;
+   task->scatter = scatter;
+   task->num_scatter = num_scatter;
+   task->total_xfer_len = size;
+   task->data_dir = pci_dma_dir;
+   task->task_done = sas_disc_task_done;
+   if (pci_dma_dir != PCI_DMA_NONE &&
+   sas_protocol_ata(task->task_proto)) {
+   task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev,
+  task->scatter,
+  task->num_scatter,
+  task->data_dir);
+   }
+
+   for (retries = 0; retries < 5; retries++) {
+   task->task_state_flags = SAS_TASK_STATE_PENDING;
+   init_completion(&task->completion);
+
+   task->timer.data = (unsigned long) task;
+   task->timer.function = sas_task_timedout;
+   task->timer.expires = jiffies + SAS_DEV_TIMEOUT*HZ;
+   add_timer(&task->timer);
+
+   res = i->dft->lldd_execute_task(task, 1, GFP_KERNEL);
+   if (res) {
+   del_timer(&task->timer);
+   SAS_DPRINTK("executing SAS discovery task failed:%d\n",
+   res);
+   goto ex_err;
+   }
+   wait_for_completion(&task->completion);
+   res = -ETASK;
+   if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
+   int res2;
+   SAS_DPRINTK("task aborted, flags:0x%x\n",
+   task->task_state_flags);
+   res2 = i->dft->lldd_abort_task(task);
+

[GIT PATCH] final piece of the SCSI merge for 2.6.22

2007-07-22 Thread James Bottomley
This final piece contains driver updates (mainly qla2xx and the long
delayed ATA update for libsas) plus fix ups for bsg which Jens and Tomo
want to take through the scsi tree.

The patch is available here:

master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git

The short changelog is:

Adam Radford (1):
  3w-9xxx: add support for 9690SA

Adrian Bunk (3):
  seagate: make seagate_st0x_detect() static
  wd33c93: cleanups
  small cleanups

Al Viro (1):
  iscsi_tcp: buggered kmalloc()

Andrew Vasquez (8):
  qla2xxx: Update version number to 8.02.00-k2.
  qla2xxx: Add ISP25XX support.
  qla2xxx: Use pci_try_set_mwi().
  qla2xxx: Use PCI-X/PCI-Express read control interfaces.
  qla2xxx: Re-factor isp_operations to static structures.
  qla2xxx: Correct setting of 'current' and 'supported' speeds during FDMI r
  qla2xxx: Generalize iIDMA support.
  qla2xxx: Generalize FW-Interface-2 support.

Darrick J. Wong (13):
  sas_ata: Implement sas_task_abort for ATA devices
  sas_ata: Assign sas_task to scsi_cmnd to enable EH for ATA devices
  libsas: Unknown STP devices should be reported to libata as unknown.
  libsas: Accept SAM_GOOD for ATAPI devices in sas_ata_task_done
  sas_ata: Don't copy aic94xx's sactive to ata_port
  sas_ata: ata_post_internal should abort the sas_task
  sas_ata: sas_ata_qc_issue should return AC_ERR_*
  sas_ata: Satisfy libata qc function locking requirements
  aic94xx: Don't call pci_map_sg for already-mapped scatterlists
  Migrate libsas ATA code into a separate file
  libsas: support NCQ for SATA disks
  aic94xx: SATA tag mask not set correctly
  Add SATA support to libsas

David Miller (1):
  ESP: Increase ESP_BUS_TIMEOUT to 275.

FUJITA Tomonori (5):
  bsg: unexport sg v3 helper functions
  bsg: fix bsg_unregister_queue
  libsas: kill unused smp_portal code
  libsas: add SAS management protocol handler
  transport_sas: add SAS management protocol support

Gwendal Grignou (1):
  mpt fusion: update Kconfig help

Heiko Carstens (1):
  zfcp: NULL vs 0 usage

James Bottomley (13):
  libsas: make ATA functions selectable by a config option
  bsg: make class backlinks
  bsg: fix bsg_register_queue error path
  libsas: fix scr_read/write users and update the libata documentation
  scsi_transport_sas: add destructor for bsg
  bsg: separate bsg and SCSI (so SCSI can be modular)
  libsas: fix lockdep issue with ATA
  libsas, aic94xx: fix dma mapping cockups with ATA
  libsas: fixup NCQ for SATA disks
  libsas: better error handling in sas_ex_discover_end_dev()
  aic94xx: add SATAPI support
  libsas: fix up sas_smp_phy_control()
  libsas: Add SATA support to STP piece for SATA on SAS expanders

Jan Engelhardt (1):
  Use menuconfig objects

Kristian Høgsberg (1):
  Make scsi_host_template::proc_name const char * instead of char *.

Matthew Wilcox (1):
  a4000t, zorro7xx, mvme16x, bvme6000,sim710: xxx_device_remove seems buggy

Prakash, Sathya (4):
  mpt fusion: add support for Brocade branded LSI FC HBA
  mpt fusion: deregister from transport layer if PCI registration failed
  add PCI_VENDOR_ID macro for Brocade in pci_ids.h
  mpt fusion: add sysfs attributes to display IOC parameters

Salyzyn, Mark (3):
  aacraid: add vpd to inquiry
  aacraid: incorrect dma mapping mask during blinkled recover or user initia
  aacraid: correct valid container response in management ioctl

Shyam Sundar (1):
  qla2xxx: Validate mid-layer 'underflow' during check-condition handling.

Swen Schillig (2):
  zfcp: code cleanup
  zfcp: Replace kmalloc/memset with kzalloc

And the diffstat:

 Documentation/DocBook/libata.tmpl   |5 
 block/Kconfig   |2 
 block/bsg.c |   61 -
 block/scsi_ioctl.c  |   13 
 drivers/firewire/fw-sbp2.c  |2 
 drivers/message/fusion/Kconfig  |1 
 drivers/message/fusion/mptbase.c|  382 ++--
 drivers/message/fusion/mptbase.h|9 
 drivers/message/fusion/mptfc.c  |3 
 drivers/message/fusion/mptsas.c |   72 ++
 drivers/message/fusion/mptscsih.c   |  153 
 drivers/message/fusion/mptscsih.h   |1 
 drivers/message/fusion/mptspi.c |9 
 drivers/s390/scsi/zfcp_aux.c|9 
 drivers/s390/scsi/zfcp_def.h|1 
 drivers/s390/scsi/zfcp_erp.c|3 
 drivers/s390/scsi/zfcp_fsf.c|2 
 drivers/s390/scsi/zfcp_qdio.c   |  113 +--
 drivers/scsi/3w-9xxx.c  |   67 +-
 drivers/scsi/3w-9xxx.h  |5 
 drivers/scsi/Kconfig|   10 
 drivers/scsi/a4000t.c   |3 
 drivers/scsi/aacraid/aachba.c   |  140 
 drivers/scsi/aacraid/aacraid.h  |   14 
 drivers/scsi/aacraid/commsup.c  |   16 
 drivers/scsi/aic94xx/aic94xx_dev.c  |2 
 drivers/scs

Re: What does scsi_level mean?

2007-07-22 Thread Randy Dunlap
On Sun, 22 Jul 2007 18:42:14 +0800 jidong xiao wrote:

> Any one can kindly explain this?
> 
> Thanks
> Jason Xiao
> 
> On 7/21/07, jidong xiao <[EMAIL PROTECTED]> wrote:
> > I noticed that there is a char scsi_level in the struct scsi_device,
> > what does scsi_level mean?
> >
> > struct scsi_device {
> > ...
> >char scsi_level;
> > ...
> > }

Does this help?
It's explained in include/scsi/scsi.h as:

/*
 *  struct scsi_device::scsi_level values. For SCSI devices other than those
 *  prior to SCSI-2 (i.e. over 12 years old) this value is (resp[2] + 1)
 *  where "resp" is a byte array of the response to an INQUIRY. The scsi_level
 *  variable is visible to the user via sysfs.
 */

#define SCSI_UNKNOWN0
#define SCSI_1  1
#define SCSI_1_CCS  2
#define SCSI_2  3
#define SCSI_3  4/* SPC */
#define SCSI_SPC_2  5
#define SCSI_SPC_3  6


> > Is it SCSI revision?
> > If the answer is true, then I am quite curious, from the code I have
> > read, SCSI_2 is something special, see following function:
> > picked up from drivers/scsi/scsi_sysfs.c:
> > int scsi_sysfs_target_initialize(struct scsi_device *sdev){
> >/*
> > * If there wasn't another lun already configured at
> > * this target, then default this device to SCSI_2
> > * until we know better
> > */
> >sdev->scsi_level = SCSI_2;
> > }
> >
> > Why SCSI_2 could be the default value, why not SCSI_1, why not SCSI_3,
> > and etc.Seems SCSI_2 is distinguished from other levels,any reason for
> > this?
> >
> > Thanks
> > Jason Xiao



---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 3/3] scsi: wd33c93 needs

2007-07-22 Thread Al Viro
On Fri, Jul 20, 2007 at 11:50:50AM -0600, Matthew Wilcox wrote:
> On Fri, Jul 20, 2007 at 09:43:47PM +0400, Sergei Shtylyov wrote:
> > Hello Christoph:
> > 
> > >>>+#include 
> > 
> > >>These days that should probably be .
> > 
> > >Not at all, linux/irq.h is something entirely different.
> > 
> >Actually, 
> 
> Not for enable/disable_irq.  For request_irq, yes.
> 
> This is something that should be fixed.

Now it is...  FWIW, I suspect that absolute majority of asm/irq.h
uses can be removed now.

Next steps in irq.h/interrupt.h cleanups:
* scouring asm/irq.h like it had been done for sparc32;
the parts that are only used by relevant arch/ code should be
taken there and includes _in_ asm/irq.h trimmed to minimum
* separating tasklet.h, with interrupt.h still including it.
Using it where needed.
* asm/softirq.h (with stuff mostly taken there from asm/hardirq.h)
and linux/softirq.h; again interrupt.h still should include it.
* mechanical adding include of linux/interrupt.h to files that use
request_irq/free_irq/enable_irq/disable_irq/irqreturn_t/IRQF_...
---> in the next merge window:
* replace include of linux/interrupt.h in netdevice.h with
that of linux/softirq.h.
* trim uses of linux/interrupt.h that are not needed anymore.
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/9] qla2xxx: Validate mid-layer 'underflow' during check-condition handling.

2007-07-22 Thread Andrew Vasquez
On Sun, 22 Jul 2007, Boaz Harrosh wrote:

> From: Boaz Harrosh <[EMAIL PROTECTED]>
> Date: Sun, 22 Jul 2007 17:24:18 +0300
> Subject: [PATCH] qla2xxx: Data accessors Cleanup of last merge
> 
> - Left overs from last code merges of qla2xxx
> 
> Sign-off-by: Boaz Harrosh <[EMAIL PROTECTED]>

Thanks for catching that.  If need be:

Acked-off-by: Andrew Vasquez <[EMAIL PROTECTED]>

> ---
>  drivers/scsi/qla2xxx/qla_isr.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
> index b8f226a..50539da 100644
> --- a/drivers/scsi/qla2xxx/qla_isr.c
> +++ b/drivers/scsi/qla2xxx/qla_isr.c
> @@ -1068,7 +1068,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
>* values.
>*/
>   if (resid &&
> - ((unsigned)(cp->request_bufflen - resid) <
> + ((unsigned)(scsi_bufflen(cp) - resid) <
>cp->underflow)) {
>   DEBUG2(qla_printk(KERN_INFO, ha,
>   "scsi(%ld:%d:%d:%d): Mid-layer underflow "
> @@ -1076,7 +1076,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
>   "error status.\n", ha->host_no,
>   cp->device->channel, cp->device->id,
>   cp->device->lun, resid,
> - cp->request_bufflen));
> + scsi_bufflen(cp)));
>  
>   cp->result = DID_ERROR << 16 | lscsi_status;
>   }
> -- 
> 1.5.2.2.249.g45fd
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] ibmvscsi: use shost_priv

2007-07-22 Thread FUJITA Tomonori
Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c |   34 +++---
 1 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 6735260..65f7fc1 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -702,8 +702,7 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd,
struct srp_cmd *srp_cmd;
struct srp_event_struct *evt_struct;
struct srp_indirect_buf *indirect;
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)&cmnd->device->host->hostdata;
+   struct ibmvscsi_host_data *hostdata = shost_priv(cmnd->device->host);
u16 lun = lun_from_dev(cmnd->device);
u8 out_fmt, in_fmt;
 
@@ -954,8 +953,7 @@ static void sync_completion(struct srp_event_struct 
*evt_struct)
  */
 static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
 {
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
+   struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
struct srp_tsk_mgmt *tsk_mgmt;
struct srp_event_struct *evt;
struct srp_event_struct *tmp_evt, *found_evt;
@@ -1078,9 +1076,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd 
*cmd)
  */
 static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
 {
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
-
+   struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
struct srp_tsk_mgmt *tsk_mgmt;
struct srp_event_struct *evt;
struct srp_event_struct *tmp_evt, *pos;
@@ -1177,8 +1173,7 @@ static int ibmvscsi_eh_device_reset_handler(struct 
scsi_cmnd *cmd)
 static int ibmvscsi_eh_host_reset_handler(struct scsi_cmnd *cmd)
 {
unsigned long wait_switch = 0;
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
+   struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
 
dev_err(hostdata->dev, "Resetting connection due to error recovery\n");
 
@@ -1406,8 +1401,7 @@ static int ibmvscsi_change_queue_depth(struct scsi_device 
*sdev, int qdepth)
 static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf)
 {
struct Scsi_Host *shost = class_to_shost(class_dev);
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)shost->hostdata;
+   struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
 
len = snprintf(buf, PAGE_SIZE, "%s\n",
@@ -1427,8 +1421,7 @@ static ssize_t show_host_partition_name(struct 
class_device *class_dev,
char *buf)
 {
struct Scsi_Host *shost = class_to_shost(class_dev);
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)shost->hostdata;
+   struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
 
len = snprintf(buf, PAGE_SIZE, "%s\n",
@@ -1448,8 +1441,7 @@ static ssize_t show_host_partition_number(struct 
class_device *class_dev,
  char *buf)
 {
struct Scsi_Host *shost = class_to_shost(class_dev);
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)shost->hostdata;
+   struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
 
len = snprintf(buf, PAGE_SIZE, "%d\n",
@@ -1468,8 +1460,7 @@ static struct class_device_attribute 
ibmvscsi_host_partition_number = {
 static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf)
 {
struct Scsi_Host *shost = class_to_shost(class_dev);
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)shost->hostdata;
+   struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
 
len = snprintf(buf, PAGE_SIZE, "%d\n",
@@ -1488,8 +1479,7 @@ static struct class_device_attribute 
ibmvscsi_host_mad_version = {
 static ssize_t show_host_os_type(struct class_device *class_dev, char *buf)
 {
struct Scsi_Host *shost = class_to_shost(class_dev);
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)shost->hostdata;
+   struct ibmvscsi_host_data *hostdata = shost_priv(shost);
int len;
 
len = snprintf(buf, PAGE_SIZE, "%d\n", hostdata->madapter_info.os_type);
@@ -1507,8 +1497,7 @@ static struct class_device_attribute 
ibmvscsi_host_os_type = {
 static ssize_t show_host_config(struct class_device *class_dev, char *buf)
 {
struct Scsi_Host *shost = class_to_shost(class_dev);
-   struct ibmvscsi_host_data *hostdata =
-   (struct ibmvscsi_host_data *)shost->hostdata;
+   struct ibmvscsi_host_data *h

[PATCH 1/2] ibmvscsi: remove unnecessary map_sg check

2007-07-22 Thread FUJITA Tomonori
No need to check use_sg since sg_tablesize is set appropriately in the
scsi host template.

Brian King's patch (2a7309372fe56ae46c499b772d811ad31c501dd9) did this
cleanup but the data buffer accessors patch (written before the patch
and merged after it) restored the check.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 drivers/scsi/ibmvscsi/ibmvscsi.c |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 5870866..6735260 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -393,12 +393,6 @@ static int map_sg_data(struct scsi_cmnd *cmd,
return 1;
else if (sg_mapped < 0)
return 0;
-   else if (sg_mapped > SG_ALL) {
-   printk(KERN_ERR
-  "ibmvscsi: More than %d mapped sg entries, got %d\n",
-  SG_ALL, sg_mapped);
-   return 0;
-   }
 
set_srp_direction(cmd, srp_cmd, sg_mapped);
 
-- 
1.5.2.4

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


2.6.23 regression: lpfc_sli.c: off-by-10

2007-07-22 Thread Adrian Bunk
The Coverity checker spotted the following off-by-10
in drivers/scsi/lpfc/lpfc_sli.c:


<--  snip  -->

...
static int
lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
struct lpfc_iocbq *saveq)
{
...
saveq->context3 = lpfc_sli_replace_hbqbuff(phba,
irsp->un.ulpWord[15]);
...

<--  snip  -->


due to the following code in drivers/scsi/lpfc/lpfc_hw.h:


<--  snip  -->

...
#define IOCB_WORD_SZ8
...
typedef struct _IOCB {  /* IOCB structure */
...
uint32_t ulpWord[IOCB_WORD_SZ - 2]; /* generic 6 'words' */
...

<--  snip  -->


cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed

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


[PATCH 1/2] bsg: use lib/idr.c to find a unique minor number

2007-07-22 Thread FUJITA Tomonori
This replaces the current linear search for a unique minor number with
lib/idr.c.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 block/bsg.c |   69 ++
 include/linux/bsg.h |1 -
 2 files changed, 30 insertions(+), 40 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index 1ba9bc6..f0259c2 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -70,13 +71,12 @@ enum {
 #endif
 
 static DEFINE_MUTEX(bsg_mutex);
-static int bsg_device_nr, bsg_minor_idx;
+static DEFINE_IDR(bsg_minor_idr);
 
 #define BSG_LIST_ARRAY_SIZE8
 static struct hlist_head bsg_device_list[BSG_LIST_ARRAY_SIZE];
 
 static struct class *bsg_class;
-static LIST_HEAD(bsg_class_list);
 static int bsg_major;
 
 static struct kmem_cache *bsg_cmd_cachep;
@@ -781,23 +781,18 @@ static struct bsg_device *__bsg_get_device(int minor)
 
 static struct bsg_device *bsg_get_device(struct inode *inode, struct file 
*file)
 {
-   struct bsg_device *bd = __bsg_get_device(iminor(inode));
-   struct bsg_class_device *bcd, *__bcd;
+   struct bsg_device *bd;
+   struct bsg_class_device *bcd;
 
+   bd = __bsg_get_device(iminor(inode));
if (bd)
return bd;
 
/*
 * find the class device
 */
-   bcd = NULL;
mutex_lock(&bsg_mutex);
-   list_for_each_entry(__bcd, &bsg_class_list, list) {
-   if (__bcd->minor == iminor(inode)) {
-   bcd = __bcd;
-   break;
-   }
-   }
+   bcd = idr_find(&bsg_minor_idr, iminor(inode));
mutex_unlock(&bsg_mutex);
 
if (!bcd)
@@ -936,13 +931,12 @@ void bsg_unregister_queue(struct request_queue *q)
return;
 
mutex_lock(&bsg_mutex);
+   idr_remove(&bsg_minor_idr, bcd->minor);
sysfs_remove_link(&q->kobj, "bsg");
class_device_unregister(bcd->class_dev);
put_device(bcd->dev);
bcd->class_dev = NULL;
bcd->dev = NULL;
-   list_del_init(&bcd->list);
-   bsg_device_nr--;
mutex_unlock(&bsg_mutex);
 }
 EXPORT_SYMBOL_GPL(bsg_unregister_queue);
@@ -950,9 +944,9 @@ EXPORT_SYMBOL_GPL(bsg_unregister_queue);
 int bsg_register_queue(struct request_queue *q, struct device *gdev,
   const char *name)
 {
-   struct bsg_class_device *bcd, *__bcd;
+   struct bsg_class_device *bcd;
dev_t dev;
-   int ret = -EMFILE;
+   int ret, minor;
struct class_device *class_dev = NULL;
const char *devname;
 
@@ -969,28 +963,26 @@ int bsg_register_queue(struct request_queue *q, struct 
device *gdev,
 
bcd = &q->bsg_dev;
memset(bcd, 0, sizeof(*bcd));
-   INIT_LIST_HEAD(&bcd->list);
 
mutex_lock(&bsg_mutex);
-   if (bsg_device_nr == BSG_MAX_DEVS) {
-   printk(KERN_ERR "bsg: too many bsg devices\n");
-   goto err;
-   }
 
-retry:
-   list_for_each_entry(__bcd, &bsg_class_list, list) {
-   if (__bcd->minor == bsg_minor_idx) {
-   bsg_minor_idx++;
-   if (bsg_minor_idx == BSG_MAX_DEVS)
-   bsg_minor_idx = 0;
-   goto retry;
-   }
+   ret = idr_pre_get(&bsg_minor_idr, GFP_KERNEL);
+   if (!ret) {
+   ret = -ENOMEM;
+   goto unlock;
}
 
-   bcd->minor = bsg_minor_idx++;
-   if (bsg_minor_idx == BSG_MAX_DEVS)
-   bsg_minor_idx = 0;
+   ret = idr_get_new(&bsg_minor_idr, bcd, &minor);
+   if (ret < 0)
+   goto unlock;
 
+   if (minor >= BSG_MAX_DEVS) {
+   printk(KERN_ERR "bsg: too many bsg devices\n");
+   ret = -EINVAL;
+   goto remove_idr;
+   }
+
+   bcd->minor = minor;
bcd->queue = q;
bcd->dev = get_device(gdev);
dev = MKDEV(bsg_major, bcd->minor);
@@ -998,27 +990,26 @@ retry:
devname);
if (IS_ERR(class_dev)) {
ret = PTR_ERR(class_dev);
-   goto err_put;
+   goto put_dev;
}
bcd->class_dev = class_dev;
 
if (q->kobj.sd) {
ret = sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg");
if (ret)
-   goto err_unregister;
+   goto unregister_class_dev;
}
 
-   list_add_tail(&bcd->list, &bsg_class_list);
-   bsg_device_nr++;
-
mutex_unlock(&bsg_mutex);
return 0;
 
-err_unregister:
+unregister_class_dev:
class_device_unregister(class_dev);
-err_put:
+put_dev:
put_device(gdev);
-err:
+remove_idr:
+   idr_remove(&bsg_minor_idr, minor);
+unlock:
mutex_unlock(&bsg_mutex);
return ret;
 }
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index f415f89..241eed0 10

[PATCH 2/2] bsg: remove unnecessary code and comments

2007-07-22 Thread FUJITA Tomonori
- kill uhdr in bsg_command structure
- it's not necessary to put SG v4 stuff to block/scsi_ioctl.c

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 block/bsg.c |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index f0259c2..2b5e72b 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -9,13 +9,6 @@
  *  archive for more details.
  *
  */
-/*
- * TODO
- * - Should this get merged, block/scsi_ioctl.c will be migrated into
- *   this file. To keep maintenance down, it's easier to have them
- *   seperated right now.
- *
- */
 #include 
 #include 
 #include 
@@ -92,7 +85,6 @@ struct bsg_command {
struct bio *bidi_bio;
int err;
struct sg_io_v4 hdr;
-   struct sg_io_v4 __user *uhdr;
char sense[SCSI_SENSE_BUFFERSIZE];
 };
 
@@ -620,7 +612,6 @@ static int __bsg_write(struct bsg_device *bd, const char 
__user *buf,
break;
}
 
-   bc->uhdr = (struct sg_io_v4 __user *) buf;
if (copy_from_user(&bc->hdr, buf, sizeof(bc->hdr))) {
ret = -EFAULT;
break;
-- 
1.5.2.4

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


[PATCH] simscsi: convert to use the data buffer accessors

2007-07-22 Thread FUJITA Tomonori
- remove the unnecessary map_single path.

- convert to use the new accessors for the sg lists and the
parameters.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 arch/ia64/hp/sim/simscsi.c |   66 ++--
 1 files changed, 15 insertions(+), 51 deletions(-)

diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index bb87682..decdf6e 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -122,48 +122,22 @@ simscsi_biosparam (struct scsi_device *sdev, struct 
block_device *n,
 }
 
 static void
-simscsi_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset, 
unsigned long len)
-{
-   struct disk_stat stat;
-   struct disk_req req;
-
-   req.addr = __pa(sc->request_buffer);
-   req.len  = len; /* # of bytes to transfer */
-
-   if (sc->request_bufflen < req.len)
-   return;
-
-   stat.fd = desc[sc->device->id];
-   if (DBG)
-   printk("simscsi_%s @ %lx (off %lx)\n",
-  mode == SSC_READ ? "read":"write", req.addr, offset);
-   ia64_ssc(stat.fd, 1, __pa(&req), offset, mode);
-   ia64_ssc(__pa(&stat), 0, 0, 0, SSC_WAIT_COMPLETION);
-
-   if (stat.count == req.len) {
-   sc->result = GOOD;
-   } else {
-   sc->result = DID_ERROR << 16;
-   }
-}
-
-static void
 simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset)
 {
-   int list_len = sc->use_sg;
-   struct scatterlist *sl = (struct scatterlist *)sc->request_buffer;
+   int i;
+   struct scatterlist *sl;
struct disk_stat stat;
struct disk_req req;
 
stat.fd = desc[sc->device->id];
 
-   while (list_len) {
+   scsi_for_each_sg(sc, sl, scsi_sg_count(sc), i) {
req.addr = __pa(page_address(sl->page) + sl->offset);
req.len  = sl->length;
if (DBG)
printk("simscsi_sg_%s @ %lx (off %lx) use_sg=%d 
len=%d\n",
   mode == SSC_READ ? "read":"write", req.addr, 
offset,
-  list_len, sl->length);
+  scsi_sg_count(sc) - i, sl->length);
ia64_ssc(stat.fd, 1, __pa(&req), offset, mode);
ia64_ssc(__pa(&stat), 0, 0, 0, SSC_WAIT_COMPLETION);
 
@@ -173,8 +147,6 @@ simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, 
unsigned long offset)
return;
}
offset +=  sl->length;
-   sl++;
-   list_len--;
}
sc->result = GOOD;
 }
@@ -190,10 +162,7 @@ simscsi_readwrite6 (struct scsi_cmnd *sc, int mode)
unsigned long offset;
 
offset = (((sc->cmnd[1] & 0x1f) << 16) | (sc->cmnd[2] << 8) | 
sc->cmnd[3])*512;
-   if (sc->use_sg > 0)
-   simscsi_sg_readwrite(sc, mode, offset);
-   else
-   simscsi_readwrite(sc, mode, offset, sc->cmnd[4]*512);
+   simscsi_sg_readwrite(sc, mode, offset);
 }
 
 static size_t
@@ -230,26 +199,21 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
| ((unsigned long)sc->cmnd[3] << 16)
| ((unsigned long)sc->cmnd[4] <<  8) 
| ((unsigned long)sc->cmnd[5] <<  0))*512UL;
-   if (sc->use_sg > 0)
-   simscsi_sg_readwrite(sc, mode, offset);
-   else
-   simscsi_readwrite(sc, mode, offset, ((sc->cmnd[7] << 8) | 
sc->cmnd[8])*512);
+   simscsi_sg_readwrite(sc, mode, offset);
 }
 
 static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len)
 {
 
-   int scatterlen = sc->use_sg;
+   int i;
+   unsigned thislen;
struct scatterlist *slp;
 
-   if (scatterlen == 0)
-   memcpy(sc->request_buffer, buf, len);
-   else for (slp = (struct scatterlist *)sc->request_buffer;
- scatterlen-- > 0 && len > 0; slp++) {
-   unsigned thislen = min(len, slp->length);
-
+   scsi_for_each_sg(sc, slp, scsi_sg_count(sc), i) {
+   if (!len)
+   break;
+   thislen = min(len, slp->length);
memcpy(page_address(slp->page) + slp->offset, buf, thislen);
-   slp++;
len -= thislen;
}
 }
@@ -275,7 +239,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void 
(*done)(struct scsi_cmnd *))
if (target_id <= 15 && sc->device->lun == 0) {
switch (sc->cmnd[0]) {
  case INQUIRY:
-   if (sc->request_bufflen < 35) {
+   if (scsi_bufflen(sc) < 35) {
break;
}
sprintf (fname, "%s%c", simscsi_root, 'a' + target_id);
@@ -328,7 +292,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void 
(*done)(struct scsi_cmnd *))
break;
 
  case READ_CAPACITY:
-

[PATCH] ps3rom: convert to use the data buffer accessors

2007-07-22 Thread FUJITA Tomonori
This is against Linus' tree since scsi-misc doesn't include ps3rom
driver yet.

---
From: FUJITA Tomonori <[EMAIL PROTECTED]>
Subject: [PATCH] ps3rom: convert to use the data buffer accessors

This converts ps3rom driver to use the new accessors for the sg lists
and the parameters.

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
---
 drivers/scsi/ps3rom.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index b50f1e1..0f43d1d 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -100,16 +100,16 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, 
const void *buf)
struct scatterlist *sgpnt;
unsigned int buflen;
 
-   buflen = cmd->request_bufflen;
+   buflen = scsi_bufflen(cmd);
if (!buflen)
return 0;
 
-   if (!cmd->request_buffer)
+   if (!scsi_sglist(cmd))
return -1;
 
-   sgpnt = cmd->request_buffer;
active = 1;
-   for (k = 0, req_len = 0, act_len = 0; k < cmd->use_sg; ++k, ++sgpnt) {
+   req_len = act_len = 0;
+   scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) {
if (active) {
kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
len = sgpnt->length;
@@ -124,7 +124,7 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, 
const void *buf)
}
req_len += sgpnt->length;
}
-   cmd->resid = req_len - act_len;
+   scsi_set_resid(cmd, req_len - act_len);
return 0;
 }
 
@@ -138,15 +138,15 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *cmd, 
void *buf)
struct scatterlist *sgpnt;
unsigned int buflen;
 
-   buflen = cmd->request_bufflen;
+   buflen = scsi_bufflen(cmd);
if (!buflen)
return 0;
 
-   if (!cmd->request_buffer)
+   if (!scsi_sglist(cmd))
return -1;
 
-   sgpnt = cmd->request_buffer;
-   for (k = 0, req_len = 0, fin = 0; k < cmd->use_sg; ++k, ++sgpnt) {
+   req_len = fin = 0;
+   scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) {
kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
len = sgpnt->length;
if ((req_len + len) > buflen) {
@@ -177,12 +177,12 @@ static int ps3rom_atapi_request(struct ps3_storage_device 
*dev,
memcpy(&atapi_cmnd.pkt, cmd->cmnd, 12);
atapi_cmnd.pktlen = 12;
atapi_cmnd.block_size = 1; /* transfer size is block_size * blocks */
-   atapi_cmnd.blocks = atapi_cmnd.arglen = cmd->request_bufflen;
+   atapi_cmnd.blocks = atapi_cmnd.arglen = scsi_bufflen(cmd);
atapi_cmnd.buffer = dev->bounce_lpar;
 
switch (cmd->sc_data_direction) {
case DMA_FROM_DEVICE:
-   if (cmd->request_bufflen >= CD_FRAMESIZE)
+   if (scsi_bufflen(cmd) >= CD_FRAMESIZE)
atapi_cmnd.proto = DMA_PROTO;
else
atapi_cmnd.proto = PIO_DATA_IN_PROTO;
@@ -190,7 +190,7 @@ static int ps3rom_atapi_request(struct ps3_storage_device 
*dev,
break;
 
case DMA_TO_DEVICE:
-   if (cmd->request_bufflen >= CD_FRAMESIZE)
+   if (scsi_bufflen(cmd) >= CD_FRAMESIZE)
atapi_cmnd.proto = DMA_PROTO;
else
atapi_cmnd.proto = PIO_DATA_OUT_PROTO;
-- 
1.5.2.4

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


Re: [PATCH 1/2] bsg: use lib/idr.c to find a unique minor number

2007-07-22 Thread Jens Axboe
On Mon, Jul 23 2007, FUJITA Tomonori wrote:
> This replaces the current linear search for a unique minor number with
> lib/idr.c.
> 
> Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>

Awesome, that's a very nice improvement both for code and performance.

Acked-by: Jens Axboe <[EMAIL PROTECTED]>

-- 
Jens Axboe

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