<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel about="http://blog.gmane.org/gmane.linux.scsi">
    <title>gmane.linux.scsi</title>
    <link>http://blog.gmane.org/gmane.linux.scsi</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46475"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46474"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46473"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46472"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46461"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46435"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46428"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46427"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46425"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46424"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46423"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46422"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46421"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46420"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46419"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46418"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46417"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46416"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46414"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.scsi/46411"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46475">
    <title>[PATCH] [Target_Core_Mod]: Convert to se_task_t-&gt;task_sg usage incore and subsystem plugins</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46475</link>
    <description>From: Nicholas Bellinger &lt;nab&lt; at &gt;linux-iscsi.org&gt;
Date: Tue, 2 Dec 2008 18:06:54 -0800
Subject: [PATCH] [Target_Core_Mod]: Convert to se_task_t-&gt;task_sg usage in core and subsystem plugins

This patch adds makes the existing se_task_t-&gt;task_buf become se_task_t-&gt;task_sg of
type struct scatterlist.  Changes to target_core_transport.c in transport_calc_sg_num()
and transport_free_dev_tasks() are simple, along with a one-liner change in
target_core_seobj.c:dev_obj_do_se_mem_map().

Signed-off-by: Nicholas A. Bellinger &lt;nab&lt; at &gt;linux-iscsi.org&gt;
---
 drivers/lio-core/target_core_base.h      |    2 +-
 drivers/lio-core/target_core_seobj.c     |   11 ++++++-----
 drivers/lio-core/target_core_transport.c |    9 ++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/lio-core/target_core_base.h b/drivers/lio-core/target_core_base.h
index 5ee04d3..b866613 100644
--- a/drivers/lio-core/target_core_base.h
+++ b/drivers/lio-core/target_core_base.h
&lt; at &gt;&lt; at &gt; -249,7 +249,7 &lt; at &gt;&lt; at &gt; typedef struct se_transport_task_s {
 
 typedef struct se_task_s {
         unsigned char   task_sense;
-        unsigned char   *task_buf;
+struct scatterlist *task_sg;
         void            *transport_req;
         u8              task_scsi_status;
         u8              task_flags;
diff --git a/drivers/lio-core/target_core_seobj.c b/drivers/lio-core/target_core_seobj.c
index 8e8c951..d013f2c 100644
--- a/drivers/lio-core/target_core_seobj.c
+++ b/drivers/lio-core/target_core_seobj.c
&lt; at &gt;&lt; at &gt; -348,8 +348,9 &lt; at &gt;&lt; at &gt; extern int dev_obj_do_se_mem_map (
  * been done by the transport plugin.
  */
 if (TRANSPORT(dev)-&gt;do_se_mem_map) {
-if ((ret = TRANSPORT(dev)-&gt;do_se_mem_map(task, se_mem_list, in_mem, in_se_mem,
-out_se_mem, se_mem_cnt, task_offset)) == 0)
+if ((ret = TRANSPORT(dev)-&gt;do_se_mem_map(task, se_mem_list,
+in_mem, in_se_mem, out_se_mem, se_mem_cnt,
+task_offset)) == 0)
 T_TASK(task-&gt;iscsi_cmd)-&gt;t_task_se_num += *se_mem_cnt;
 
 return(ret);
&lt; at &gt;&lt; at &gt; -362,10 +363,10 &lt; at &gt;&lt; at &gt; extern int dev_obj_do_se_mem_map (
 return(-1);
 
 /*
- * se_task_t-&gt;task_buf now contains the struct scatterlist array.
+ * se_task_t-&gt;task_sg now contains the struct scatterlist array.
  */
-return(transport_map_mem_to_sg(task, se_mem_list, task-&gt;task_buf, in_se_mem, out_se_mem,
-se_mem_cnt, task_offset));
+return(transport_map_mem_to_sg(task, se_mem_list, task-&gt;task_sg,
+in_se_mem, out_se_mem, se_mem_cnt, task_offset));
 }
 
 extern int dev_obj_get_mem_buf (void *p, iscsi_cmd_t *cmd)
diff --git a/drivers/lio-core/target_core_transport.c b/drivers/lio-core/target_core_transport.c
index d92814c..b8e8294 100644
--- a/drivers/lio-core/target_core_transport.c
+++ b/drivers/lio-core/target_core_transport.c
&lt; at &gt;&lt; at &gt; -4643,7 +4643,7 &lt; at &gt;&lt; at &gt; extern void transport_free_dev_tasks (iscsi_cmd_t *cmd)
 if (!task-&gt;transport_req)
 continue;
 
-kfree(task-&gt;task_buf);
+kfree(task-&gt;task_sg);
 
 spin_unlock_irqrestore(&amp;T_TASK(cmd)-&gt;t_state_lock, flags);
 if (task-&gt;iscsi_dev)
&lt; at &gt;&lt; at &gt; -5097,13 +5097,12 &lt; at &gt;&lt; at &gt; extern u32 transport_calc_sg_num (
 break;
 }
 
-if (!(task-&gt;task_buf = kmalloc(task-&gt;task_sg_num * sizeof(struct scatterlist), GFP_KERNEL))) {
-TRACE_ERROR("Unable to allocate memory for task-&gt;task_buf\n");
+if (!(task-&gt;task_sg = kzalloc(task-&gt;task_sg_num * sizeof(struct scatterlist), GFP_KERNEL))) {
+TRACE_ERROR("Unable to allocate memory for task-&gt;task_sg\n");
 return(0);
 }
-memset(task-&gt;task_buf, 0, task-&gt;task_sg_num * sizeof(struct scatterlist));
 
-sg_init_table((struct scatterlist *)&amp;task-&gt;task_buf[0], task-&gt;task_sg_num);
+sg_init_table(&amp;task-&gt;task_sg[0], task-&gt;task_sg_num);
 
 DEBUG_SC("Successfully allocated task-&gt;task_sg_num: %u\n", task-&gt;task_sg_num);
 
</description>
    <dc:creator>Nicholas A. Bellinger</dc:creator>
    <dc:date>2008-12-03T02:44:36</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46474">
    <title>[PATCH] [Target_Core_Mod]: Update PSCSI, IBLOCK, FILEIO andRAMDISK for se_task_t-&gt;task_sg</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46474</link>
    <description>From: Nicholas Bellinger &lt;nab&lt; at &gt;linux-iscsi.org&gt;
Date: Tue, 2 Dec 2008 18:07:40 -0800
Subject: [PATCH] [Target_Core_Mod]: Update PSCSI, IBLOCK, FILEIO and RAMDISK for se_task_t-&gt;task_sg

This patch changes the generic target core subsystem plugins to use se_task_t-&gt;task_sg
and gets rid of a handful of casts from the original se_task_t-&gt;task_buf, which if present,
will always contain a contigious array of struct scatterlist memory.

Signed-off-by: Nicholas A. Bellinger &lt;nab&lt; at &gt;linux-iscsi.org&gt;
---
 drivers/lio-core/target_core_file.c   |   12 ++++++------
 drivers/lio-core/target_core_iblock.c |    4 ++--
 drivers/lio-core/target_core_pscsi.c  |   11 ++++-------
 drivers/lio-core/target_core_rd.c     |    2 +-
 4 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/lio-core/target_core_file.c b/drivers/lio-core/target_core_file.c
index 5b9b5dd..be1314d 100644
--- a/drivers/lio-core/target_core_file.c
+++ b/drivers/lio-core/target_core_file.c
&lt; at &gt;&lt; at &gt; -586,7 +586,7 &lt; at &gt;&lt; at &gt; static int fd_do_readv (fd_request_t *req, se_task_t *task)
 u32 i;
 mm_segment_t old_fs;
 struct file *fd = req-&gt;fd_dev-&gt;fd_file;
-struct scatterlist *sg = (struct scatterlist *) req-&gt;fd_buf;
+struct scatterlist *sg = task-&gt;task_sg;
 struct iovec iov[req-&gt;fd_sg_count];
 
 memset(iov, 0, sizeof(struct iovec) + req-&gt;fd_sg_count);
&lt; at &gt;&lt; at &gt; -638,7 +638,7 &lt; at &gt;&lt; at &gt; static int fd_do_aio_read (fd_request_t *req, se_task_t *task)
 unsigned long long offset, lba = req-&gt;fd_lba;;
 mm_segment_t old_fs;
 struct file *fd = req-&gt;fd_dev-&gt;fd_file;
-struct scatterlist *sg = (struct scatterlist *) req-&gt;fd_buf;
+struct scatterlist *sg = task-&gt;task_sg;
 struct iovec *iov;
 struct kiocb*iocb;
 
&lt; at &gt;&lt; at &gt; -716,7 +716,7 &lt; at &gt;&lt; at &gt; static int fd_sendactor (read_descriptor_t * desc, struct page *page, unsigned l
 unsigned long count = desc-&gt;count;
 se_task_t *task = desc-&gt;arg.data;
 fd_request_t *req = (fd_request_t *) task-&gt;transport_req;
-struct scatterlist *sg = (struct scatterlist *) req-&gt;fd_buf;
+struct scatterlist *sg = task-&gt;task_sg;
 
 //PYXPRINT("page: %p offset: %lu size: %lu\n", page, offset, size);
 
&lt; at &gt;&lt; at &gt; -767,7 +767,7 &lt; at &gt;&lt; at &gt; static int fd_do_writev (fd_request_t *req, se_task_t *task)
 int ret = 0;
 u32 i;
 struct file *fd = req-&gt;fd_dev-&gt;fd_file;
-struct scatterlist *sg = (struct scatterlist *) req-&gt;fd_buf;
+struct scatterlist *sg = task-&gt;task_sg;
 mm_segment_t old_fs;
 struct iovec iov[req-&gt;fd_sg_count];
 
&lt; at &gt;&lt; at &gt; -803,7 +803,7 &lt; at &gt;&lt; at &gt; static int fd_do_aio_write (fd_request_t *req, se_task_t *task)
 unsigned long long offset, lba = req-&gt;fd_lba;
 mm_segment_t old_fs;
 struct file *fd = req-&gt;fd_dev-&gt;fd_file;
-struct scatterlist *sg = (struct scatterlist *) req-&gt;fd_buf;
+struct scatterlist *sg = task-&gt;task_sg;
 struct iovec *iov;
 struct kiocb    *iocb;
 
&lt; at &gt;&lt; at &gt; -1065,7 +1065,7 &lt; at &gt;&lt; at &gt; extern void fd_map_task_SG (se_task_t *task)
 fd_request_t *req = (fd_request_t *) task-&gt;transport_req;
 
 req-&gt;fd_bufflen= task-&gt;task_size;
-req-&gt;fd_buf= (void *)task-&gt;task_buf;
+req-&gt;fd_buf= NULL;
 req-&gt;fd_sg_count= task-&gt;task_sg_num;
 
 return;
diff --git a/drivers/lio-core/target_core_iblock.c b/drivers/lio-core/target_core_iblock.c
index 50e2a2a..962dc35 100644
--- a/drivers/lio-core/target_core_iblock.c
+++ b/drivers/lio-core/target_core_iblock.c
&lt; at &gt;&lt; at &gt; -755,7 +755,7 &lt; at &gt;&lt; at &gt; extern int iblock_map_task_SG (se_task_t *task)
 iblock_dev_t *ib_dev = (iblock_dev_t *) task-&gt;iscsi_dev-&gt;dev_ptr;
 iblock_req_t *ib_req = (iblock_req_t *) task-&gt;transport_req;
 struct bio *bio = NULL, *hbio = NULL, *tbio = NULL;
-struct scatterlist *sg = (struct scatterlist *)task-&gt;task_buf;
+struct scatterlist *sg = task-&gt;task_sg;
 int ret = 0;
 u32 i, sg_num = task-&gt;task_sg_num;
 u64 lba = task-&gt;task_lba;
&lt; at &gt;&lt; at &gt; -769,7 +769,7 &lt; at &gt;&lt; at &gt; extern int iblock_map_task_SG (se_task_t *task)
 hbio = tbio = bio;
 /*
  * Use fs/bio.c:bio_add_pages() to setup the bio_vec maplist
- * from LIO-SE se_mem_t -&gt; task-&gt;task_buf -&gt; struct scatterlist memory.
+ * from LIO-SE se_mem_t -&gt; task-&gt;task_sg -&gt; struct scatterlist memory.
  */
 for (i = 0; i &lt; task-&gt;task_sg_num; i++) {
 DEBUG_IBLOCK("task: %p bio: %p Calling bio_add_page(): page: %p len:"
diff --git a/drivers/lio-core/target_core_pscsi.c b/drivers/lio-core/target_core_pscsi.c
index 862ad26..0ce57e6 100644
--- a/drivers/lio-core/target_core_pscsi.c
+++ b/drivers/lio-core/target_core_pscsi.c
&lt; at &gt;&lt; at &gt; -1165,22 +1165,19 &lt; at &gt;&lt; at &gt; extern int pscsi_map_task_SG (se_task_t *task)
         pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 int ret = 0;
 
-pt-&gt;pscsi_buf = (void *)task-&gt;task_buf;
+pt-&gt;pscsi_buf = (void *)task-&gt;task_sg;
 
 if (!task-&gt;task_size)
 return(0);
 #if 0
 if ((ret = blk_rq_map_sg(pdv-&gt;pdv_sd-&gt;request_queue,
-pt-&gt;pscsi_req,
-(struct scatterlist *)pt-&gt;pscsi_buf)) &lt; 0) {
+pt-&gt;pscsi_req, task-&gt;task_sg)) &lt; 0) {
 printk(KERN_ERR "PSCSI: blk_rq_map_sg() returned %d\n", ret);
 return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
 }
 #else
-if ((ret = scsi_req_map_sg(pt-&gt;pscsi_req,
-(struct scatterlist *)pt-&gt;pscsi_buf,
-task-&gt;task_sg_num, task-&gt;task_size,
-GFP_KERNEL)) &lt; 0) {
+if ((ret = scsi_req_map_sg(pt-&gt;pscsi_req, task-&gt;task_sg,
+task-&gt;task_sg_num, task-&gt;task_size, GFP_KERNEL)) &lt; 0) {
 printk(KERN_ERR "PSCSI: scsi_req_map_sg() failed: %d\n", ret);
 return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
 }
diff --git a/drivers/lio-core/target_core_rd.c b/drivers/lio-core/target_core_rd.c
index 3bc0d77..ac32e4b 100644
--- a/drivers/lio-core/target_core_rd.c
+++ b/drivers/lio-core/target_core_rd.c
&lt; at &gt;&lt; at &gt; -1195,7 +1195,7 &lt; at &gt;&lt; at &gt; extern void rd_map_task_SG (se_task_t *task)
 rd_request_t *req = (rd_request_t *) task-&gt;transport_req;
 
 req-&gt;rd_bufflen= task-&gt;task_size;
-req-&gt;rd_buf= (void *)task-&gt;task_buf;
+req-&gt;rd_buf= task-&gt;task_sg;
 req-&gt;rd_sg_count= task-&gt;task_sg_num;
 
 return;
</description>
    <dc:creator>Nicholas A. Bellinger</dc:creator>
    <dc:date>2008-12-03T02:15:16</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46473">
    <title>[PATCH] remove ide-scsi</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46473</link>
    <description>This is for 2.6.29 (not 2.6.28) as feature-removal-schedule.txt says.

It's against linux-next (which seems to has some changes to ide-scsi
for 2.6.29 from the ide tree). 

=
From: FUJITA Tomonori &lt;fujita.tomonori&lt; at &gt;lab.ntt.co.jp&gt;
Subject: [PATCH] remove ide-scsi

As planed, this removes ide-scsi.

The 2.6 kernel supports direct writing to ide CD drives, which
eliminates the need for ide-scsi. ide-scsi has been unmaintained and
marked as deprecated.

Signed-off-by: FUJITA Tomonori &lt;fujita.tomonori&lt; at &gt;lab.ntt.co.jp&gt;
---
 Documentation/feature-removal-schedule.txt |    9 -
 MAINTAINERS                                |    5 -
 drivers/ide/Kconfig                        |   17 -
 drivers/scsi/Kconfig                       |    8 +-
 drivers/scsi/Makefile                      |    1 -
 drivers/scsi/ide-scsi.c                    |  840 ----------------------------
 6 files changed, 4 insertions(+), 876 deletions(-)
 delete mode 100644 drivers/scsi/ide-scsi.c

diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 77eb6b1..31f7906 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
&lt; at &gt;&lt; at &gt; -322,15 +322,6 &lt; at &gt;&lt; at &gt; Who:  Krzysztof Piotr Oledzki &lt;ole&lt; at &gt;ans.pl&gt;
 
 ---------------------------
 
-What: ide-scsi (BLK_DEV_IDESCSI)
-When: 2.6.29
-Why:  The 2.6 kernel supports direct writing to ide CD drives, which
-      eliminates the need for ide-scsi. The new method is more
-      efficient in every way.
-Who:  FUJITA Tomonori &lt;fujita.tomonori&lt; at &gt;lab.ntt.co.jp&gt;
-
----------------------------
-
 What:i2c_attach_client(), i2c_detach_client(), i2c_driver-&gt;detach_client()
 When:2.6.29 (ideally) or 2.6.30 (more likely)
 Why:Deprecated by the new (standard) device driver binding model. Use
diff --git a/MAINTAINERS b/MAINTAINERS
index 758dd7a..8e07bb9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
&lt; at &gt;&lt; at &gt; -2138,11 +2138,6 &lt; at &gt;&lt; at &gt; M:Gadi Oxman &lt;gadio&lt; at &gt;netvision.net.il&gt;
 L:linux-kernel&lt; at &gt;vger.kernel.org
 S:Maintained
 
-IDE-SCSI DRIVER
-L:linux-ide&lt; at &gt;vger.kernel.org
-L:linux-scsi&lt; at &gt;vger.kernel.org
-S:Orphan
-
 IDLE-I7300
 P:Andy Henroid
 M:andrew.d.henroid&lt; at &gt;intel.com
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 8d84fe4..d806271 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
&lt; at &gt;&lt; at &gt; -185,23 +185,6 &lt; at &gt;&lt; at &gt; config BLK_DEV_IDETAPE
   To compile this driver as a module, choose M here: the
   module will be called ide-tape.
 
-config BLK_DEV_IDESCSI
-tristate "SCSI emulation support (DEPRECATED)"
-depends on SCSI
-select IDE_ATAPI
----help---
-  WARNING: ide-scsi is no longer needed for cd writing applications!
-  The 2.6 kernel supports direct writing to ide-cd, which eliminates
-  the need for ide-scsi + the entire scsi stack just for writing a
-  cd. The new method is more efficient in every way.
-
-  This will provide SCSI host adapter emulation for IDE ATAPI devices,
-  and will allow you to use a SCSI device driver instead of a native
-  ATAPI driver.
-
-  If both this SCSI emulation and native ATAPI support are compiled
-  into the kernel, the native support will be used.
-
 config BLK_DEV_IDEACPI
 bool "IDE ACPI support"
 depends on ACPI
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index e6af21c..2eb172d 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
&lt; at &gt;&lt; at &gt; -21,7 +21,7 &lt; at &gt;&lt; at &gt; config SCSI
   You also need to say Y here if you have a device which speaks
   the SCSI protocol.  Examples of this include the parallel port
   version of the IOMEGA ZIP drive, USB storage devices, Fibre
-  Channel, FireWire storage and the IDE-SCSI emulation driver.
+  Channel, and FireWire storage.
 
   To compile this driver as a module, choose M here and read
   &lt;file:Documentation/scsi/scsi.txt&gt;.
&lt; at &gt;&lt; at &gt; -101,9 +101,9 &lt; at &gt;&lt; at &gt; config CHR_DEV_OSST
 ---help---
   The OnStream SC-x0 SCSI tape drives cannot be driven by the
   standard st driver, but instead need this special osst driver and
-  use the  /dev/osstX char device nodes (major 206).  Via usb-storage
-  and ide-scsi, you may be able to drive the USB-x0 and DI-x0 drives
-  as well.  Note that there is also a second generation of OnStream
+  use the  /dev/osstX char device nodes (major 206).  Via usb-storage,
+  you may be able to drive the USB-x0 and DI-x0 drives as well.
+  Note that there is also a second generation of OnStream
   tape drives (ADR-x0) that supports the standard SCSI-2 commands for
   tapes (QIC-157) and can be driven by the standard driver st.
   For more information, you may have a look at the SCSI-HOWTO
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 1e49632..42bf88b 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
&lt; at &gt;&lt; at &gt; -103,7 +103,6 &lt; at &gt;&lt; at &gt; obj-$(CONFIG_SCSI_GDTH)+= gdth.o
 obj-$(CONFIG_SCSI_INITIO)+= initio.o
 obj-$(CONFIG_SCSI_INIA100)+= a100u2w.o
 obj-$(CONFIG_SCSI_QLOGICPTI)+= qlogicpti.o
-obj-$(CONFIG_BLK_DEV_IDESCSI)+= ide-scsi.o
 obj-$(CONFIG_SCSI_MESH)+= mesh.o
 obj-$(CONFIG_SCSI_MAC53C94)+= mac53c94.o
 obj-$(CONFIG_BLK_DEV_3W_XXXX_RAID) += 3w-xxxx.o
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
deleted file mode 100644
index c24140a..0000000
--- a/drivers/scsi/ide-scsi.c
+++ /dev/null
&lt; at &gt;&lt; at &gt; -1,840 +0,0 &lt; at &gt;&lt; at &gt;
-/*
- * Copyright (C) 1996-1999  Gadi Oxman &lt;gadio&lt; at &gt;netvision.net.il&gt;
- * Copyright (C) 2004-2005  Bartlomiej Zolnierkiewicz
- */
-
-/*
- * Emulation of a SCSI host adapter for IDE ATAPI devices.
- *
- * With this driver, one can use the Linux SCSI drivers instead of the
- * native IDE ATAPI drivers.
- *
- * Ver 0.1   Dec  3 96   Initial version.
- * Ver 0.2   Jan 26 97   Fixed bug in cleanup_module() and added emulation
- *                        of MODE_SENSE_6/MODE_SELECT_6 for cdroms. Thanks
- *                        to Janos Farkas for pointing this out.
- *                       Avoid using bitfields in structures for m68k.
- *                       Added Scatter/Gather and DMA support.
- * Ver 0.4   Dec  7 97   Add support for ATAPI PD/CD drives.
- *                       Use variable timeout for each command.
- * Ver 0.5   Jan  2 98   Fix previous PD/CD support.
- *                       Allow disabling of SCSI-6 to SCSI-10 transformation.
- * Ver 0.6   Jan 27 98   Allow disabling of SCSI command translation layer
- *                        for access through /dev/sg.
- *                       Fix MODE_SENSE_6/MODE_SELECT_6/INQUIRY translation.
- * Ver 0.7   Dec 04 98   Ignore commands where lun != 0 to avoid multiple
- *                        detection of devices with CONFIG_SCSI_MULTI_LUN
- * Ver 0.8   Feb 05 99   Optical media need translation too. Reverse 0.7.
- * Ver 0.9   Jul 04 99   Fix a bug in SG_SET_TRANSFORM.
- * Ver 0.91  Jun 10 02   Fix "off by one" error in transforms
- * Ver 0.92  Dec 31 02   Implement new SCSI mid level API
- */
-
-#define IDESCSI_VERSION "0.92"
-
-#include &lt;linux/module.h&gt;
-#include &lt;linux/types.h&gt;
-#include &lt;linux/string.h&gt;
-#include &lt;linux/kernel.h&gt;
-#include &lt;linux/mm.h&gt;
-#include &lt;linux/ioport.h&gt;
-#include &lt;linux/blkdev.h&gt;
-#include &lt;linux/errno.h&gt;
-#include &lt;linux/slab.h&gt;
-#include &lt;linux/ide.h&gt;
-#include &lt;linux/scatterlist.h&gt;
-#include &lt;linux/delay.h&gt;
-#include &lt;linux/mutex.h&gt;
-#include &lt;linux/bitops.h&gt;
-
-#include &lt;asm/io.h&gt;
-#include &lt;asm/uaccess.h&gt;
-
-#include &lt;scsi/scsi.h&gt;
-#include &lt;scsi/scsi_cmnd.h&gt;
-#include &lt;scsi/scsi_device.h&gt;
-#include &lt;scsi/scsi_host.h&gt;
-#include &lt;scsi/scsi_tcq.h&gt;
-#include &lt;scsi/sg.h&gt;
-
-#define IDESCSI_DEBUG_LOG0
-
-#if IDESCSI_DEBUG_LOG
-#define debug_log(fmt, args...) \
-printk(KERN_INFO "ide-scsi: " fmt, ## args)
-#else
-#define debug_log(fmt, args...) do {} while (0)
-#endif
-
-/*
- *SCSI command transformation layer
- */
-#define IDESCSI_SG_TRANSFORM1/* /dev/sg transformation */
-
-/*
- *Log flags
- */
-#define IDESCSI_LOG_CMD0/* Log SCSI commands */
-
-typedef struct ide_scsi_obj {
-ide_drive_t*drive;
-ide_driver_t*driver;
-struct gendisk*disk;
-struct Scsi_Host*host;
-
-unsigned long transform;/* SCSI cmd translation layer */
-unsigned long log;/* log flags */
-} idescsi_scsi_t;
-
-static DEFINE_MUTEX(idescsi_ref_mutex);
-/* Set by module param to skip cd */
-static int idescsi_nocd;
-
-#define ide_scsi_g(disk) \
-container_of((disk)-&gt;private_data, struct ide_scsi_obj, driver)
-
-static struct ide_scsi_obj *ide_scsi_get(struct gendisk *disk)
-{
-struct ide_scsi_obj *scsi = NULL;
-
-mutex_lock(&amp;idescsi_ref_mutex);
-scsi = ide_scsi_g(disk);
-if (scsi) {
-if (ide_device_get(scsi-&gt;drive))
-scsi = NULL;
-else
-scsi_host_get(scsi-&gt;host);
-}
-mutex_unlock(&amp;idescsi_ref_mutex);
-return scsi;
-}
-
-static void ide_scsi_put(struct ide_scsi_obj *scsi)
-{
-ide_drive_t *drive = scsi-&gt;drive;
-
-mutex_lock(&amp;idescsi_ref_mutex);
-scsi_host_put(scsi-&gt;host);
-ide_device_put(drive);
-mutex_unlock(&amp;idescsi_ref_mutex);
-}
-
-static inline idescsi_scsi_t *scsihost_to_idescsi(struct Scsi_Host *host)
-{
-return (idescsi_scsi_t*) (&amp;host[1]);
-}
-
-static inline idescsi_scsi_t *drive_to_idescsi(ide_drive_t *ide_drive)
-{
-return scsihost_to_idescsi(ide_drive-&gt;driver_data);
-}
-
-static void ide_scsi_hex_dump(u8 *data, int len)
-{
-print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0);
-}
-
-static int idescsi_end_request(ide_drive_t *, int, int);
-
-static void ide_scsi_callback(ide_drive_t *drive, int dsc)
-{
-idescsi_scsi_t *scsi = drive_to_idescsi(drive);
-struct ide_atapi_pc *pc = drive-&gt;pc;
-
-if (pc-&gt;flags &amp; PC_FLAG_TIMEDOUT)
-debug_log("%s: got timed out packet %lu at %lu\n", __func__,
-  pc-&gt;scsi_cmd-&gt;serial_number, jiffies);
-/* end this request now - scsi should retry it*/
-else if (test_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log))
-printk(KERN_INFO "Packet command completed, %d bytes"
- " transferred\n", pc-&gt;xferred);
-
-idescsi_end_request(drive, 1, 0);
-}
-
-static int idescsi_check_condition(ide_drive_t *drive,
-struct request *failed_cmd)
-{
-idescsi_scsi_t *scsi = drive_to_idescsi(drive);
-struct ide_atapi_pc   *pc;
-struct request *rq;
-u8             *buf;
-
-/* stuff a sense request in front of our current request */
-pc = kzalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC);
-rq = blk_get_request(drive-&gt;queue, READ, GFP_ATOMIC);
-buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC);
-if (!pc || !rq || !buf) {
-kfree(buf);
-if (rq)
-blk_put_request(rq);
-kfree(pc);
-return -ENOMEM;
-}
-rq-&gt;special = (char *) pc;
-pc-&gt;rq = rq;
-pc-&gt;buf = buf;
-pc-&gt;c[0] = REQUEST_SENSE;
-pc-&gt;c[4] = pc-&gt;req_xfer = pc-&gt;buf_size = SCSI_SENSE_BUFFERSIZE;
-rq-&gt;cmd_type = REQ_TYPE_SENSE;
-rq-&gt;cmd_flags |= REQ_PREEMPT;
-pc-&gt;timeout = jiffies + WAIT_READY;
-/* NOTE! Save the failed packet command in "rq-&gt;buffer" */
-rq-&gt;buffer = (void *) failed_cmd-&gt;special;
-pc-&gt;scsi_cmd = ((struct ide_atapi_pc *) failed_cmd-&gt;special)-&gt;scsi_cmd;
-if (test_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log)) {
-printk ("ide-scsi: %s: queue cmd = ", drive-&gt;name);
-ide_scsi_hex_dump(pc-&gt;c, 6);
-}
-rq-&gt;rq_disk = scsi-&gt;disk;
-rq-&gt;ref_count++;
-memcpy(rq-&gt;cmd, pc-&gt;c, 12);
-ide_do_drive_cmd(drive, rq);
-return 0;
-}
-
-static ide_startstop_t
-idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err)
-{
-ide_hwif_t *hwif = drive-&gt;hwif;
-
-if (hwif-&gt;tp_ops-&gt;read_status(hwif) &amp; (ATA_BUSY | ATA_DRQ))
-/* force an abort */
-hwif-&gt;tp_ops-&gt;exec_command(hwif, ATA_CMD_IDLEIMMEDIATE);
-
-rq-&gt;errors++;
-
-idescsi_end_request(drive, 0, 0);
-
-return ide_stopped;
-}
-
-static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
-{
-idescsi_scsi_t *scsi = drive_to_idescsi(drive);
-struct request *rq = HWGROUP(drive)-&gt;rq;
-struct ide_atapi_pc *pc = (struct ide_atapi_pc *) rq-&gt;special;
-int log = test_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log);
-struct Scsi_Host *host;
-int errors = rq-&gt;errors;
-unsigned long flags;
-
-if (!blk_special_request(rq) &amp;&amp; !blk_sense_request(rq)) {
-ide_end_request(drive, uptodate, nrsecs);
-return 0;
-}
-ide_end_drive_cmd (drive, 0, 0);
-if (blk_sense_request(rq)) {
-struct ide_atapi_pc *opc = (struct ide_atapi_pc *) rq-&gt;buffer;
-if (log) {
-printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive-&gt;name, opc-&gt;scsi_cmd-&gt;serial_number);
-ide_scsi_hex_dump(pc-&gt;buf, 16);
-}
-memcpy((void *) opc-&gt;scsi_cmd-&gt;sense_buffer, pc-&gt;buf,
-SCSI_SENSE_BUFFERSIZE);
-kfree(pc-&gt;buf);
-kfree(pc);
-blk_put_request(rq);
-pc = opc;
-rq = pc-&gt;rq;
-pc-&gt;scsi_cmd-&gt;result = (CHECK_CONDITION &lt;&lt; 1) |
-(((pc-&gt;flags &amp; PC_FLAG_TIMEDOUT) ?
-  DID_TIME_OUT :
-  DID_OK) &lt;&lt; 16);
-} else if (pc-&gt;flags &amp; PC_FLAG_TIMEDOUT) {
-if (log)
-printk (KERN_WARNING "ide-scsi: %s: timed out for %lu\n",
-drive-&gt;name, pc-&gt;scsi_cmd-&gt;serial_number);
-pc-&gt;scsi_cmd-&gt;result = DID_TIME_OUT &lt;&lt; 16;
-} else if (errors &gt;= ERROR_MAX) {
-pc-&gt;scsi_cmd-&gt;result = DID_ERROR &lt;&lt; 16;
-if (log)
-printk ("ide-scsi: %s: I/O error for %lu\n", drive-&gt;name, pc-&gt;scsi_cmd-&gt;serial_number);
-} else if (errors) {
-if (log)
-printk ("ide-scsi: %s: check condition for %lu\n", drive-&gt;name, pc-&gt;scsi_cmd-&gt;serial_number);
-if (!idescsi_check_condition(drive, rq))
-/* we started a request sense, so we'll be back, exit for now */
-return 0;
-pc-&gt;scsi_cmd-&gt;result = (CHECK_CONDITION &lt;&lt; 1) | (DID_OK &lt;&lt; 16);
-} else {
-pc-&gt;scsi_cmd-&gt;result = DID_OK &lt;&lt; 16;
-}
-host = pc-&gt;scsi_cmd-&gt;device-&gt;host;
-spin_lock_irqsave(host-&gt;host_lock, flags);
-pc-&gt;done(pc-&gt;scsi_cmd);
-spin_unlock_irqrestore(host-&gt;host_lock, flags);
-kfree(pc);
-blk_put_request(rq);
-drive-&gt;pc = NULL;
-return 0;
-}
-
-static inline int idescsi_set_direction(struct ide_atapi_pc *pc)
-{
-switch (pc-&gt;c[0]) {
-case READ_6: case READ_10: case READ_12:
-pc-&gt;flags &amp;= ~PC_FLAG_WRITING;
-return 0;
-case WRITE_6: case WRITE_10: case WRITE_12:
-pc-&gt;flags |= PC_FLAG_WRITING;
-return 0;
-default:
-return 1;
-}
-}
-
-static int idescsi_map_sg(ide_drive_t *drive, struct ide_atapi_pc *pc)
-{
-ide_hwif_t *hwif = drive-&gt;hwif;
-struct scatterlist *sg, *scsi_sg;
-int segments;
-
-if (!pc-&gt;req_xfer || pc-&gt;req_xfer % 1024)
-return 1;
-
-if (idescsi_set_direction(pc))
-return 1;
-
-sg = hwif-&gt;sg_table;
-scsi_sg = scsi_sglist(pc-&gt;scsi_cmd);
-segments = scsi_sg_count(pc-&gt;scsi_cmd);
-
-if (segments &gt; hwif-&gt;sg_max_nents)
-return 1;
-
-hwif-&gt;sg_nents = segments;
-memcpy(sg, scsi_sg, sizeof(*sg) * segments);
-
-return 0;
-}
-
-static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive,
-struct ide_atapi_pc *pc)
-{
-/* Set the current packet command */
-drive-&gt;pc = pc;
-
-return ide_issue_pc(drive, ide_scsi_get_timeout(pc), ide_scsi_expiry);
-}
-
-/*
- *idescsi_do_request is our request handling function.
- */
-static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, sector_t block)
-{
-debug_log("dev: %s, cmd: %x, errors: %d\n", rq-&gt;rq_disk-&gt;disk_name,
-  rq-&gt;cmd[0], rq-&gt;errors);
-debug_log("sector: %ld, nr_sectors: %ld, current_nr_sectors: %d\n",
-  rq-&gt;sector, rq-&gt;nr_sectors, rq-&gt;current_nr_sectors);
-
-if (blk_sense_request(rq) || blk_special_request(rq)) {
-struct ide_atapi_pc *pc = (struct ide_atapi_pc *)rq-&gt;special;
-
-if ((drive-&gt;dev_flags &amp; IDE_DFLAG_USING_DMA) &amp;&amp;
-    idescsi_map_sg(drive, pc) == 0)
-pc-&gt;flags |= PC_FLAG_DMA_OK;
-
-return idescsi_issue_pc(drive, pc);
-}
-blk_dump_rq_flags(rq, "ide-scsi: unsup command");
-idescsi_end_request (drive, 0, 0);
-return ide_stopped;
-}
-
-#ifdef CONFIG_IDE_PROC_FS
-static ide_proc_entry_t idescsi_proc[] = {
-{ "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL },
-{ NULL, 0, NULL, NULL }
-};
-
-#define ide_scsi_devset_get(name, field) \
-static int get_##name(ide_drive_t *drive) \
-{ \
-idescsi_scsi_t *scsi = drive_to_idescsi(drive); \
-return scsi-&gt;field; \
-}
-
-#define ide_scsi_devset_set(name, field) \
-static int set_##name(ide_drive_t *drive, int arg) \
-{ \
-idescsi_scsi_t *scsi = drive_to_idescsi(drive); \
-scsi-&gt;field = arg; \
-return 0; \
-}
-
-#define ide_scsi_devset_rw_field(_name, _field) \
-ide_scsi_devset_get(_name, _field); \
-ide_scsi_devset_set(_name, _field); \
-IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name);
-
-ide_devset_rw_field(bios_cyl, bios_cyl);
-ide_devset_rw_field(bios_head, bios_head);
-ide_devset_rw_field(bios_sect, bios_sect);
-
-ide_scsi_devset_rw_field(transform, transform);
-ide_scsi_devset_rw_field(log, log);
-
-static const struct ide_proc_devset idescsi_settings[] = {
-IDE_PROC_DEVSET(bios_cyl,  0, 1023),
-IDE_PROC_DEVSET(bios_head, 0,  255),
-IDE_PROC_DEVSET(bios_sect, 0,63),
-IDE_PROC_DEVSET(log,   0, 1),
-IDE_PROC_DEVSET(transform, 0, 3),
-{ 0 },
-};
-
-static ide_proc_entry_t *ide_scsi_proc_entries(ide_drive_t *drive)
-{
-return idescsi_proc;
-}
-
-static const struct ide_proc_devset *ide_scsi_proc_devsets(ide_drive_t *drive)
-{
-return idescsi_settings;
-}
-#endif
-
-/*
- *Driver initialization.
- */
-static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
-{
-clear_bit(IDESCSI_SG_TRANSFORM, &amp;scsi-&gt;transform);
-#if IDESCSI_DEBUG_LOG
-set_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log);
-#endif /* IDESCSI_DEBUG_LOG */
-
-drive-&gt;pc_callback = ide_scsi_callback;
-drive-&gt;pc_update_buffers = NULL;
-drive-&gt;pc_io_buffers = ide_io_buffers;
-
-ide_proc_register_driver(drive, scsi-&gt;driver);
-}
-
-static void ide_scsi_remove(ide_drive_t *drive)
-{
-struct Scsi_Host *scsihost = drive-&gt;driver_data;
-struct ide_scsi_obj *scsi = scsihost_to_idescsi(scsihost);
-struct gendisk *g = scsi-&gt;disk;
-
-scsi_remove_host(scsihost);
-ide_proc_unregister_driver(drive, scsi-&gt;driver);
-
-ide_unregister_region(g);
-
-drive-&gt;driver_data = NULL;
-g-&gt;private_data = NULL;
-put_disk(g);
-
-ide_scsi_put(scsi);
-
-drive-&gt;dev_flags &amp;= ~IDE_DFLAG_SCSI;
-}
-
-static int ide_scsi_probe(ide_drive_t *);
-
-static ide_driver_t idescsi_driver = {
-.gen_driver = {
-.owner= THIS_MODULE,
-.name= "ide-scsi",
-.bus= &amp;ide_bus_type,
-},
-.probe= ide_scsi_probe,
-.remove= ide_scsi_remove,
-.version= IDESCSI_VERSION,
-.do_request= idescsi_do_request,
-.end_request= idescsi_end_request,
-.error                  = idescsi_atapi_error,
-#ifdef CONFIG_IDE_PROC_FS
-.proc_entries= ide_scsi_proc_entries,
-.proc_devsets= ide_scsi_proc_devsets,
-#endif
-};
-
-static int idescsi_ide_open(struct block_device *bdev, fmode_t mode)
-{
-struct ide_scsi_obj *scsi = ide_scsi_get(bdev-&gt;bd_disk);
-
-if (!scsi)
-return -ENXIO;
-
-return 0;
-}
-
-static int idescsi_ide_release(struct gendisk *disk, fmode_t mode)
-{
-ide_scsi_put(ide_scsi_g(disk));
-return 0;
-}
-
-static int idescsi_ide_ioctl(struct block_device *bdev, fmode_t mode,
-unsigned int cmd, unsigned long arg)
-{
-struct ide_scsi_obj *scsi = ide_scsi_g(bdev-&gt;bd_disk);
-return generic_ide_ioctl(scsi-&gt;drive, bdev, cmd, arg);
-}
-
-static struct block_device_operations idescsi_ops = {
-.owner= THIS_MODULE,
-.open= idescsi_ide_open,
-.release= idescsi_ide_release,
-.locked_ioctl= idescsi_ide_ioctl,
-};
-
-static int idescsi_slave_configure(struct scsi_device * sdp)
-{
-/* Configure detected device */
-sdp-&gt;use_10_for_rw = 1;
-sdp-&gt;use_10_for_ms = 1;
-scsi_adjust_queue_depth(sdp, MSG_SIMPLE_TAG, sdp-&gt;host-&gt;cmd_per_lun);
-return 0;
-}
-
-static const char *idescsi_info (struct Scsi_Host *host)
-{
-return "SCSI host adapter emulation for IDE ATAPI devices";
-}
-
-static int idescsi_ioctl (struct scsi_device *dev, int cmd, void __user *arg)
-{
-idescsi_scsi_t *scsi = scsihost_to_idescsi(dev-&gt;host);
-
-if (cmd == SG_SET_TRANSFORM) {
-if (arg)
-set_bit(IDESCSI_SG_TRANSFORM, &amp;scsi-&gt;transform);
-else
-clear_bit(IDESCSI_SG_TRANSFORM, &amp;scsi-&gt;transform);
-return 0;
-} else if (cmd == SG_GET_TRANSFORM)
-return put_user(test_bit(IDESCSI_SG_TRANSFORM, &amp;scsi-&gt;transform), (int __user *) arg);
-return -EINVAL;
-}
-
-static int idescsi_queue (struct scsi_cmnd *cmd,
-void (*done)(struct scsi_cmnd *))
-{
-struct Scsi_Host *host = cmd-&gt;device-&gt;host;
-idescsi_scsi_t *scsi = scsihost_to_idescsi(host);
-ide_drive_t *drive = scsi-&gt;drive;
-struct request *rq = NULL;
-struct ide_atapi_pc *pc = NULL;
-int write = cmd-&gt;sc_data_direction == DMA_TO_DEVICE;
-
-if (!drive) {
-scmd_printk (KERN_ERR, cmd, "drive not present\n");
-goto abort;
-}
-scsi = drive_to_idescsi(drive);
-pc = kmalloc(sizeof(struct ide_atapi_pc), GFP_ATOMIC);
-rq = blk_get_request(drive-&gt;queue, write, GFP_ATOMIC);
-if (rq == NULL || pc == NULL) {
-printk (KERN_ERR "ide-scsi: %s: out of memory\n", drive-&gt;name);
-goto abort;
-}
-
-memset (pc-&gt;c, 0, 12);
-pc-&gt;flags = 0;
-if (cmd-&gt;sc_data_direction == DMA_TO_DEVICE)
-pc-&gt;flags |= PC_FLAG_WRITING;
-pc-&gt;rq = rq;
-memcpy (pc-&gt;c, cmd-&gt;cmnd, cmd-&gt;cmd_len);
-pc-&gt;buf = NULL;
-pc-&gt;sg = scsi_sglist(cmd);
-pc-&gt;sg_cnt = scsi_sg_count(cmd);
-pc-&gt;b_count = 0;
-pc-&gt;req_xfer = pc-&gt;buf_size = scsi_bufflen(cmd);
-pc-&gt;scsi_cmd = cmd;
-pc-&gt;done = done;
-pc-&gt;timeout = jiffies + cmd-&gt;request-&gt;timeout;
-
-if (test_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log)) {
-printk ("ide-scsi: %s: que %lu, cmd = ", drive-&gt;name, cmd-&gt;serial_number);
-ide_scsi_hex_dump(cmd-&gt;cmnd, cmd-&gt;cmd_len);
-if (memcmp(pc-&gt;c, cmd-&gt;cmnd, cmd-&gt;cmd_len)) {
-printk ("ide-scsi: %s: que %lu, tsl = ", drive-&gt;name, cmd-&gt;serial_number);
-ide_scsi_hex_dump(pc-&gt;c, 12);
-}
-}
-
-rq-&gt;special = (char *) pc;
-rq-&gt;cmd_type = REQ_TYPE_SPECIAL;
-spin_unlock_irq(host-&gt;host_lock);
-rq-&gt;ref_count++;
-memcpy(rq-&gt;cmd, pc-&gt;c, 12);
-blk_execute_rq_nowait(drive-&gt;queue, scsi-&gt;disk, rq, 0, NULL);
-spin_lock_irq(host-&gt;host_lock);
-return 0;
-abort:
-kfree (pc);
-if (rq)
-blk_put_request(rq);
-cmd-&gt;result = DID_ERROR &lt;&lt; 16;
-done(cmd);
-return 0;
-}
-
-static int idescsi_eh_abort (struct scsi_cmnd *cmd)
-{
-idescsi_scsi_t *scsi  = scsihost_to_idescsi(cmd-&gt;device-&gt;host);
-ide_drive_t    *drive = scsi-&gt;drive;
-ide_hwif_t     *hwif;
-ide_hwgroup_t  *hwgroup;
-intbusy;
-int             ret   = FAILED;
-
-struct ide_atapi_pc *pc;
-
-/* In idescsi_eh_abort we try to gently pry our command from the ide subsystem */
-
-if (test_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log))
-printk (KERN_WARNING "ide-scsi: abort called for %lu\n", cmd-&gt;serial_number);
-
-if (!drive) {
-printk (KERN_WARNING "ide-scsi: Drive not set in idescsi_eh_abort\n");
-WARN_ON(1);
-goto no_drive;
-}
-
-hwif = drive-&gt;hwif;
-hwgroup = hwif-&gt;hwgroup;
-
-/* First give it some more time, how much is "right" is hard to say :-(
-   FIXME - uses mdelay which causes latency? */
-busy = ide_wait_not_busy(hwif, 100);
-if (test_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log))
-printk (KERN_WARNING "ide-scsi: drive did%s become ready\n", busy?" not":"");
-
-spin_lock_irq(&amp;hwgroup-&gt;lock);
-
-/* If there is no pc running we're done (our interrupt took care of it) */
-pc = drive-&gt;pc;
-if (pc == NULL) {
-ret = SUCCESS;
-goto ide_unlock;
-}
-
-/* It's somewhere in flight. Does ide subsystem agree? */
-if (pc-&gt;scsi_cmd-&gt;serial_number == cmd-&gt;serial_number &amp;&amp; !busy &amp;&amp;
-    elv_queue_empty(drive-&gt;queue) &amp;&amp; HWGROUP(drive)-&gt;rq != pc-&gt;rq) {
-/*
- * FIXME - not sure this condition can ever occur
- */
-printk (KERN_ERR "ide-scsi: cmd aborted!\n");
-
-if (blk_sense_request(pc-&gt;rq))
-kfree(pc-&gt;buf);
-/* we need to call blk_put_request twice. */
-blk_put_request(pc-&gt;rq);
-blk_put_request(pc-&gt;rq);
-kfree(pc);
-drive-&gt;pc = NULL;
-
-ret = SUCCESS;
-}
-
-ide_unlock:
-spin_unlock_irq(&amp;hwgroup-&gt;lock);
-no_drive:
-if (test_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log))
-printk (KERN_WARNING "ide-scsi: abort returns %s\n", ret == SUCCESS?"success":"failed");
-
-return ret;
-}
-
-static int idescsi_eh_reset (struct scsi_cmnd *cmd)
-{
-struct request *req;
-idescsi_scsi_t *scsi  = scsihost_to_idescsi(cmd-&gt;device-&gt;host);
-ide_drive_t    *drive = scsi-&gt;drive;
-ide_hwgroup_t  *hwgroup;
-int             ready = 0;
-int             ret   = SUCCESS;
-
-struct ide_atapi_pc *pc;
-
-/* In idescsi_eh_reset we forcefully remove the command from the ide subsystem and reset the device. */
-
-if (test_bit(IDESCSI_LOG_CMD, &amp;scsi-&gt;log))
-printk (KERN_WARNING "ide-scsi: reset called for %lu\n", cmd-&gt;serial_number);
-
-if (!drive) {
-printk (KERN_WARNING "ide-scsi: Drive not set in idescsi_eh_reset\n");
-WARN_ON(1);
-return FAILED;
-}
-
-hwgroup = drive-&gt;hwif-&gt;hwgroup;
-
-spin_lock_irq(cmd-&gt;device-&gt;host-&gt;host_lock);
-spin_lock(&amp;hwgroup-&gt;lock);
-
-pc = drive-&gt;pc;
-if (pc)
-req = pc-&gt;rq;
-
-if (pc == NULL || req != hwgroup-&gt;rq || hwgroup-&gt;handler == NULL) {
-printk (KERN_WARNING "ide-scsi: No active request in idescsi_eh_reset\n");
-spin_unlock(&amp;hwgroup-&gt;lock);
-spin_unlock_irq(cmd-&gt;device-&gt;host-&gt;host_lock);
-return FAILED;
-}
-
-/* kill current request */
-if (__blk_end_request(req, -EIO, 0))
-BUG();
-if (blk_sense_request(req))
-kfree(pc-&gt;buf);
-kfree(pc);
-drive-&gt;pc = NULL;
-blk_put_request(req);
-
-/* now nuke the drive queue */
-while ((req = elv_next_request(drive-&gt;queue))) {
-if (__blk_end_request(req, -EIO, 0))
-BUG();
-}
-
-hwgroup-&gt;rq = NULL;
-hwgroup-&gt;handler = NULL;
-hwgroup-&gt;busy = 1; /* will set this to zero when ide reset finished */
-spin_unlock(&amp;hwgroup-&gt;lock);
-
-ide_do_reset(drive);
-
-/* ide_do_reset starts a polling handler which restarts itself every 50ms until the reset finishes */
-
-do {
-spin_unlock_irq(cmd-&gt;device-&gt;host-&gt;host_lock);
-msleep(50);
-spin_lock_irq(cmd-&gt;device-&gt;host-&gt;host_lock);
-} while ( HWGROUP(drive)-&gt;handler );
-
-ready = drive_is_ready(drive);
-HWGROUP(drive)-&gt;busy--;
-if (!ready) {
-printk (KERN_ERR "ide-scsi: reset failed!\n");
-ret = FAILED;
-}
-
-spin_unlock_irq(cmd-&gt;device-&gt;host-&gt;host_lock);
-return ret;
-}
-
-static int idescsi_bios(struct scsi_device *sdev, struct block_device *bdev,
-sector_t capacity, int *parm)
-{
-idescsi_scsi_t *idescsi = scsihost_to_idescsi(sdev-&gt;host);
-ide_drive_t *drive = idescsi-&gt;drive;
-
-if (drive-&gt;bios_cyl &amp;&amp; drive-&gt;bios_head &amp;&amp; drive-&gt;bios_sect) {
-parm[0] = drive-&gt;bios_head;
-parm[1] = drive-&gt;bios_sect;
-parm[2] = drive-&gt;bios_cyl;
-}
-return 0;
-}
-
-static struct scsi_host_template idescsi_template = {
-.module= THIS_MODULE,
-.name= "idescsi",
-.info= idescsi_info,
-.slave_configure        = idescsi_slave_configure,
-.ioctl= idescsi_ioctl,
-.queuecommand= idescsi_queue,
-.eh_abort_handler= idescsi_eh_abort,
-.eh_host_reset_handler  = idescsi_eh_reset,
-.bios_param= idescsi_bios,
-.can_queue= 40,
-.this_id= -1,
-.sg_tablesize= 256,
-.cmd_per_lun= 5,
-.max_sectors= 128,
-.use_clustering= DISABLE_CLUSTERING,
-.emulated= 1,
-.proc_name= "ide-scsi",
-};
-
-static int ide_scsi_probe(ide_drive_t *drive)
-{
-idescsi_scsi_t *idescsi;
-struct Scsi_Host *host;
-struct gendisk *g;
-static int warned;
-int err = -ENOMEM;
-u16 last_lun;
-
-if (!warned &amp;&amp; drive-&gt;media == ide_cdrom) {
-printk(KERN_WARNING "ide-scsi is deprecated for cd burning! Use ide-cd and give dev=/dev/hdX as device\n");
-warned = 1;
-}
-
-if (idescsi_nocd &amp;&amp; drive-&gt;media == ide_cdrom)
-return -ENODEV;
-
-if (!strstr("ide-scsi", drive-&gt;driver_req) ||
-    drive-&gt;media == ide_disk ||
-    !(host = scsi_host_alloc(&amp;idescsi_template,sizeof(idescsi_scsi_t))))
-return -ENODEV;
-
-drive-&gt;dev_flags |= IDE_DFLAG_SCSI;
-
-g = alloc_disk(1 &lt;&lt; PARTN_BITS);
-if (!g)
-goto out_host_put;
-
-ide_init_disk(g, drive);
-
-host-&gt;max_id = 1;
-
-last_lun = drive-&gt;id[ATA_ID_LAST_LUN];
-if (last_lun)
-debug_log("%s: last_lun=%u\n", drive-&gt;name, last_lun);
-
-if ((last_lun &amp; 7) != 7)
-host-&gt;max_lun = (last_lun &amp; 7) + 1;
-else
-host-&gt;max_lun = 1;
-
-drive-&gt;driver_data = host;
-idescsi = scsihost_to_idescsi(host);
-idescsi-&gt;drive = drive;
-idescsi-&gt;driver = &amp;idescsi_driver;
-idescsi-&gt;host = host;
-idescsi-&gt;disk = g;
-g-&gt;private_data = &amp;idescsi-&gt;driver;
-err = 0;
-idescsi_setup(drive, idescsi);
-g-&gt;fops = &amp;idescsi_ops;
-ide_register_region(g);
-err = scsi_add_host(host, &amp;drive-&gt;gendev);
-if (!err) {
-scsi_scan_host(host);
-return 0;
-}
-/* fall through on error */
-ide_unregister_region(g);
-ide_proc_unregister_driver(drive, &amp;idescsi_driver);
-
-put_disk(g);
-out_host_put:
-drive-&gt;dev_flags &amp;= ~IDE_DFLAG_SCSI;
-scsi_host_put(host);
-return err;
-}
-
-static int __init init_idescsi_module(void)
-{
-return driver_register(&amp;idescsi_driver.gen_driver);
-}
-
-static void __exit exit_idescsi_module(void)
-{
-driver_unregister(&amp;idescsi_driver.gen_driver);
-}
-
-module_param(idescsi_nocd, int, 0600);
-MODULE_PARM_DESC(idescsi_nocd, "Disable handling of CD-ROMs so they may be driven by ide-cd");
-module_init(init_idescsi_module);
-module_exit(exit_idescsi_module);
-MODULE_LICENSE("GPL");
</description>
    <dc:creator>FUJITA Tomonori</dc:creator>
    <dc:date>2008-12-03T01:38:54</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46472">
    <title>[PATCH] [Target_Core_Mod/PSCSI]: Use struct request to structscsi_device-&gt;request_queue</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46472</link>
    <description>From: Nicholas Bellinger &lt;nab&lt; at &gt;linux-iscsi.org&gt;
Date: Tue, 2 Dec 2008 16:30:51 -0800
Subject: [PATCH] [Target_Core_Mod/PSCSI]: Use struct request to struct scsi_device-&gt;request_queue

This patch begins to remove the usage of scsi_execute_async() from the PSCSI
subsystem plugin for v3.0 generic target core.

It uses blk_get_request() to allocate struct request in pscsi_blk_get_request()
and used by all CDB types and both memory backing types.  struct request is then
released with __blk_put_request() in the struct request-&gt;end_io() context in
pscsi_req_done().

Also, this patch adds a temporary EXPORT_SYMBOL_GPL() for
scsi/drivers/scsi_lib.c:scsi_req_map_sg() (which will also be going away at
some point).  At that point, the upstream struct scatterlist and/or
struct page -&gt; struct request mapping for usage with struct scsi_device-&gt;request_queue
will be dropped into place in drivers/lio-core/target_core_pscsi.c:pscsi_map_task_SG()

Tested on v2.6.28-rc7 32-bit x86 with virtual VMware TYPE_DISK on virtual MPT-Fusion

Signed-off-by: Nicholas A. Bellinger &lt;nab&lt; at &gt;linux-iscsi.org&gt;
---
 drivers/lio-core/target_core_pscsi.c |  206 +++++++++++++++++++++++++---------
 drivers/lio-core/target_core_pscsi.h |    5 +-
 drivers/scsi/scsi_lib.c              |    6 +-
 3 files changed, 161 insertions(+), 56 deletions(-)

diff --git a/drivers/lio-core/target_core_pscsi.c b/drivers/lio-core/target_core_pscsi.c
index ed9f588..bb46e1c 100644
--- a/drivers/lio-core/target_core_pscsi.c
+++ b/drivers/lio-core/target_core_pscsi.c
&lt; at &gt;&lt; at &gt; -37,6 +37,7 &lt; at &gt;&lt; at &gt;
 #include &lt;linux/spinlock.h&gt;
 #include &lt;linux/smp_lock.h&gt;
 #include &lt;linux/genhd.h&gt;
+#include &lt;linux/cdrom.h&gt;
 #include &lt;linux/file.h&gt;
 
 #include &lt;scsi/scsi.h&gt;
&lt; at &gt;&lt; at &gt; -44,6 +45,7 &lt; at &gt;&lt; at &gt;
 #include &lt;scsi/scsi_cmnd.h&gt;
 #include &lt;scsi/scsi_host.h&gt;
 #include &lt;sd.h&gt;
+#include &lt;sr.h&gt;
 
 #include &lt;iscsi_linux_os.h&gt;
 #include &lt;iscsi_linux_defs.h&gt;
&lt; at &gt;&lt; at &gt; -763,11 +765,11 &lt; at &gt;&lt; at &gt; extern void *pscsi_allocate_request (
 se_device_t *dev)
 {
 pscsi_plugin_task_t *pt;
-if (!(pt = kmalloc(sizeof(pscsi_plugin_task_t), GFP_KERNEL))) {
-TRACE_ERROR("Unable to allocate pscsi_plugin_task_t\n");
+
+if (!(pt = kzalloc(sizeof(pscsi_plugin_task_t), GFP_KERNEL))) {
+printk(KERN_ERR "Unable to allocate pscsi_plugin_task_t\n");
 return(NULL);
 }
-memset(pt, 0, sizeof(pscsi_plugin_task_t));
 
 return(pt);
 }
&lt; at &gt;&lt; at &gt; -788,7 +790,44 &lt; at &gt;&lt; at &gt; extern void pscsi_get_evpd_sn (unsigned char *buf, u32 size, se_device_t *dev)
 return;
 }
 
-/*pscsi_do_task(): (Part of se_subsystem_api_t template)
+static int pscsi_blk_get_request (se_task_t *task)
+{
+pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
+pscsi_dev_virt_t *pdv = (pscsi_dev_virt_t *) task-&gt;iscsi_dev-&gt;dev_ptr;
+
+pt-&gt;pscsi_req = blk_get_request(pdv-&gt;pdv_sd-&gt;request_queue,
+(pt-&gt;pscsi_direction == DMA_TO_DEVICE), GFP_KERNEL);
+if (!(pt-&gt;pscsi_req) || IS_ERR(pt-&gt;pscsi_req)) {
+printk(KERN_ERR "PSCSI: blk_get_request() failed: %ld\n",
+IS_ERR(pt-&gt;pscsi_req));
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+}
+/*
+ * Defined as "scsi command" in include/linux/blkdev.h.
+ */
+pt-&gt;pscsi_req-&gt;cmd_type = REQ_TYPE_BLOCK_PC;
+/*
+ * Setup the done function pointer for struct request,
+ * also set the end_io_data pointer.to se_task_t.
+ */
+pt-&gt;pscsi_req-&gt;end_io = pscsi_req_done;
+pt-&gt;pscsi_req-&gt;end_io_data = (void *)task;
+/*
+ * Load the referenced se_task_t's SCSI CDB into
+ * include/linux/blkdev.h:struct request-&gt;cmd
+ */
+pt-&gt;pscsi_req-&gt;cmd_len = COMMAND_SIZE(pt-&gt;pscsi_cdb[0]);
+memcpy(pt-&gt;pscsi_req-&gt;cmd, pt-&gt;pscsi_cdb, pt-&gt;pscsi_req-&gt;cmd_len);
+/*
+ * Setup pointer for outgoing sense data.
+ */
+pt-&gt;pscsi_req-&gt;sense = (void *)&amp;pt-&gt;pscsi_sense[0];
+pt-&gt;pscsi_req-&gt;sense_len = 0;
+
+return(0);
+}
+
+/*      pscsi_do_task(): (Part of se_subsystem_api_t template)
  *
  *
  */
&lt; at &gt;&lt; at &gt; -796,17 +835,32 &lt; at &gt;&lt; at &gt; extern int pscsi_do_task (se_task_t *task)
 {
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 pscsi_dev_virt_t *pdv = (pscsi_dev_virt_t *) task-&gt;iscsi_dev-&gt;dev_ptr;
-int ret;
-
-if ((ret = scsi_execute_async((struct scsi_device *)pdv-&gt;pdv_sd,
-   pt-&gt;pscsi_cdb, COMMAND_SIZE(pt-&gt;pscsi_cdb[0]), pt-&gt;pscsi_direction,
-   pt-&gt;pscsi_buf, task-&gt;task_size, task-&gt;task_sg_num,
-   (task-&gt;se_obj_api-&gt;get_device_type(task-&gt;se_obj_ptr) == 0) ?
-   PS_TIMEOUT_DISK : PS_TIMEOUT_OTHER, PS_RETRY,
-   (void *)task, pscsi_req_done, GFP_KERNEL)) != 0) {
-TRACE_ERROR("PSCSI Execute(): returned: %d\n", ret);
-return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
-}
+struct gendisk *gd = NULL;
+/*
+ * Grab pointer to struct gendisk for TYPE_DISK and TYPE_ROM
+ * cases (eg: cases where struct scsi_device has a backing
+ * struct block_device.  Also set the struct request-&gt;timeout
+ * value based on peripheral device type (from SCSI).
+ */
+if (pdv-&gt;pdv_sd-&gt;type == TYPE_DISK) {
+struct scsi_disk *sdisk = dev_get_drvdata(
+&amp;pdv-&gt;pdv_sd-&gt;sdev_gendev);
+gd = sdisk-&gt;disk;
+pt-&gt;pscsi_req-&gt;timeout = PS_TIMEOUT_DISK;
+} else if (pdv-&gt;pdv_sd-&gt;type == TYPE_ROM) {
+struct scsi_cd *scd = dev_get_drvdata(
+&amp;pdv-&gt;pdv_sd-&gt;sdev_gendev);
+gd = scd-&gt;disk;
+pt-&gt;pscsi_req-&gt;timeout = PS_TIMEOUT_OTHER;
+} else
+pt-&gt;pscsi_req-&gt;timeout = PS_TIMEOUT_OTHER;
+
+pt-&gt;pscsi_req-&gt;retries = PS_RETRY;
+/*
+ * Queue the struct request into the struct scsi_device-&gt;request_queue.
+ */
+blk_execute_rq_nowait(pdv-&gt;pdv_sd-&gt;request_queue, gd,
+      pt-&gt;pscsi_req, 1, pscsi_req_done);
 
 return(PYX_TRANSPORT_SENT_TO_TRANSPORT);
 }
&lt; at &gt;&lt; at &gt; -817,7 +871,8 &lt; at &gt;&lt; at &gt; extern int pscsi_do_task (se_task_t *task)
  */
 extern void pscsi_free_task (se_task_t *task)
 {
-kfree(task-&gt;transport_req);
+pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
+kfree(pt);
 return;
 }
 
&lt; at &gt;&lt; at &gt; -1099,31 +1154,64 &lt; at &gt;&lt; at &gt; extern void __pscsi_get_dev_info (pscsi_dev_virt_t *pdv, char *b, int *bl)
 return;
 }
 
-/*pscsi_map_task_SG(): 
+extern int scsi_req_map_sg(struct request *, struct scatterlist *, int,  unsigned , gfp_t );
+
+/*      pscsi_map_task_SG(): 
  *
  *
  */
-extern void pscsi_map_task_SG (se_task_t *task)
+extern int pscsi_map_task_SG (se_task_t *task)
 {
         pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
+int ret = 0;
+
 pt-&gt;pscsi_buf = (void *)task-&gt;task_buf;
 
-return;
+if (!task-&gt;task_size)
+return(0);
+#if 0
+if ((ret = blk_rq_map_sg(pdv-&gt;pdv_sd-&gt;request_queue,
+pt-&gt;pscsi_req,
+(struct scatterlist *)pt-&gt;pscsi_buf)) &lt; 0) {
+printk(KERN_ERR "PSCSI: blk_rq_map_sg() returned %d\n", ret);
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+}
+#else
+if ((ret = scsi_req_map_sg(pt-&gt;pscsi_req,
+(struct scatterlist *)pt-&gt;pscsi_buf,
+task-&gt;task_sg_num, task-&gt;task_size,
+GFP_KERNEL)) &lt; 0) {
+printk(KERN_ERR "PSCSI: scsi_req_map_sg() failed: %d\n", ret);
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+}
+#endif
+return(0);
 }
 
 /*pscsi_map_task_non_SG():
  *
  *
  */
-extern void pscsi_map_task_non_SG (se_task_t *task)
+extern int pscsi_map_task_non_SG (se_task_t *task)
 {
 iscsi_cmd_t *cmd = task-&gt;iscsi_cmd;
+pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 unsigned char *buf = (unsigned char *) T_TASK(cmd)-&gt;t_task_buf;
+pscsi_dev_virt_t *pdv = (pscsi_dev_virt_t *) task-&gt;iscsi_dev-&gt;dev_ptr;
+int ret = 0;
 
-pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 pt-&gt;pscsi_buf = (void *)buf;
 
-return;
+if (!task-&gt;task_size)
+return(0);
+
+if ((ret = blk_rq_map_kern(pdv-&gt;pdv_sd-&gt;request_queue,
+pt-&gt;pscsi_req, pt-&gt;pscsi_buf,
+task-&gt;task_size, GFP_KERNEL)) &lt; 0) {
+printk(KERN_ERR "PSCSI: blk_rq_map_kern() failed: %d\n", ret);
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+}
+return(0);
 }
 
 /*pscsi_CDB_inquiry():
&lt; at &gt;&lt; at &gt; -1135,9 +1223,10 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_inquiry (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_FROM_DEVICE;
-pscsi_map_task_non_SG(task);
+if (pscsi_blk_get_request(task) &lt; 0)
+return(-1);
 
-return(0);
+return(pscsi_map_task_non_SG(task));
 }
 
 extern int pscsi_CDB_none (se_task_t *task, u32 size)
&lt; at &gt;&lt; at &gt; -1146,7 +1235,7 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_none (se_task_t *task, u32 size)
 
 pt-&gt;pscsi_direction = DMA_NONE;
 
-return(0);
+return(pscsi_blk_get_request(task));
 }
 
 /*pscsi_CDB_read_non_SG():
&lt; at &gt;&lt; at &gt; -1158,9 +1247,11 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_read_non_SG (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_FROM_DEVICE;
-pscsi_map_task_non_SG(task);
 
-return(0);
+if (pscsi_blk_get_request(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+
+return(pscsi_map_task_non_SG(task));
 }
 
 /*pscsi_CDB_read_SG():
&lt; at &gt;&lt; at &gt; -1172,7 +1263,12 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_read_SG (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_FROM_DEVICE;
-pscsi_map_task_SG(task);
+
+if (pscsi_blk_get_request(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+
+if (pscsi_map_task_SG(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
 
 return(task-&gt;task_sg_num);
 }
&lt; at &gt;&lt; at &gt; -1186,9 +1282,11 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_write_non_SG (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_TO_DEVICE;
-pscsi_map_task_non_SG(task);
 
-return(0);
+if (pscsi_blk_get_request(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+
+return(pscsi_map_task_non_SG(task));
 }
 
 /*pscsi_CDB_write_SG():
&lt; at &gt;&lt; at &gt; -1200,7 +1298,12 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_write_SG (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_TO_DEVICE;
-pscsi_map_task_SG(task);
+
+if (pscsi_blk_get_request(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+
+if (pscsi_map_task_SG(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
 
 return(task-&gt;task_sg_num);
 }
&lt; at &gt;&lt; at &gt; -1386,22 +1489,25 &lt; at &gt;&lt; at &gt; extern void pscsi_shutdown_hba (se_hba_t *hba)
  *
  *
  */
-//#warning FIXME: We can do some custom handling of HBA fuckups here.
-extern inline void pscsi_process_SAM_status (se_task_t *task, unsigned char *cdb, int result)
+static inline void pscsi_process_SAM_status (
+se_task_t *task,
+pscsi_plugin_task_t *pt)
 {
-if ((task-&gt;task_scsi_status = status_byte(result))) {
+if ((task-&gt;task_scsi_status = status_byte(pt-&gt;pscsi_result))) {
 task-&gt;task_scsi_status &lt;&lt;= 1;
-PYXPRINT("Parallel SCSI Status Byte exception - ITT: 0x%08x Task: %p CDB: 0x%02x"
-" Result: 0x%08x\n", task-&gt;iscsi_cmd-&gt;init_task_tag, task, cdb[0], result);
+PYXPRINT("PSCSI Status Byte exception at task: %p CDB: 0x%02x"
+" Result: 0x%08x\n", task, pt-&gt;pscsi_cdb[0],
+pt-&gt;pscsi_result);
 }
 
-switch (host_byte(result)) {
+switch (host_byte(pt-&gt;pscsi_result)) {
 case DID_OK:
 transport_complete_task(task, (!task-&gt;task_scsi_status));
 break;
 default:
-PYXPRINT("Parallel SCSI Host Byte exception - ITT: 0x%08x Task: %p CDB: 0x%02x"
-" Result: 0x%08x\n", task-&gt;iscsi_cmd-&gt;init_task_tag, task, cdb[0], result);
+PYXPRINT("PSCSI Host Byte exception at task: %p CDB: 0x%02x"
+" Result: 0x%08x\n", task, pt-&gt;pscsi_cdb[0],
+pt-&gt;pscsi_result);
 task-&gt;task_scsi_status = SAM_STAT_CHECK_CONDITION;
 task-&gt;task_error_status = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE;
 task-&gt;iscsi_cmd-&gt;transport_error_status = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE;
&lt; at &gt;&lt; at &gt; -1412,21 +1518,17 &lt; at &gt;&lt; at &gt; extern inline void pscsi_process_SAM_status (se_task_t *task, unsigned char *cdb
 return;
 }
 
-extern void pscsi_req_done (void *data, char *sense, int result, int data_len)
+extern void pscsi_req_done (struct request *req, int uptodate)
 {
-se_task_t *task = (se_task_t *)data;
+se_task_t *task = (se_task_t *)req-&gt;end_io_data;
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *)task-&gt;transport_req;
-#if 0
-printk("pscsi_req_done(): result: %08x, sense: %p data_len: %d\n",
-result, sense, data_len);
-#endif
-pt-&gt;pscsi_result = result;
-pt-&gt;pscsi_data_len = data_len;
-
-if (result != 0)
-memcpy(pt-&gt;pscsi_sense, sense, SCSI_SENSE_BUFFERSIZE);
+
+pt-&gt;pscsi_result = req-&gt;errors;
+pt-&gt;pscsi_resid = req-&gt;data_len;
 
-pscsi_process_SAM_status(task, &amp;pt-&gt;pscsi_cdb[0], result);
+pscsi_process_SAM_status(task, pt);
+__blk_put_request(req-&gt;q, req);
+pt-&gt;pscsi_req = NULL;
+
 return;
 }
-
diff --git a/drivers/lio-core/target_core_pscsi.h b/drivers/lio-core/target_core_pscsi.h
index 980587d..090f0d2 100644
--- a/drivers/lio-core/target_core_pscsi.h
+++ b/drivers/lio-core/target_core_pscsi.h
&lt; at &gt;&lt; at &gt; -90,7 +90,7 &lt; at &gt;&lt; at &gt; extern struct scatterlist *pscsi_get_SG (se_task_t *);
 extern u32 pscsi_get_SG_count (se_task_t *);
 extern int pscsi_set_non_SG_buf (unsigned char *, se_task_t *);
 extern void pscsi_shutdown_hba (struct se_hba_s *);
-extern void pscsi_req_done (void *, char *, int, int);
+extern void pscsi_req_done (struct request *, int);
 #endif
 
 #include &lt;linux/device.h&gt;
&lt; at &gt;&lt; at &gt; -104,8 +104,9 &lt; at &gt;&lt; at &gt; typedef struct pscsi_plugin_task_s {
 unsigned char pscsi_sense[SCSI_SENSE_BUFFERSIZE];
 intpscsi_direction;
 intpscsi_result;
-u32pscsi_data_len;
+u32pscsi_resid;
 void*pscsi_buf;
+struct request *pscsi_req;
 } pscsi_plugin_task_t;
 
 #define PDF_HAS_CHANNEL_ID0x01
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f5d3b96..9e03a02 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
&lt; at &gt;&lt; at &gt; -303,8 +303,8 &lt; at &gt;&lt; at &gt; static void scsi_bi_endio(struct bio *bio, int error)
  * request can be sent to the block layer. We do not trust the scatterlist
  * sent to use, as some ULDs use that struct to only organize the pages.
  */
-static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl,
-   int nsegs, unsigned bufflen, gfp_t gfp)
+int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl,
+    int nsegs, unsigned bufflen, gfp_t gfp)
 {
 struct request_queue *q = rq-&gt;q;
 int nr_pages = (bufflen + sgl[0].offset + PAGE_SIZE - 1) &gt;&gt; PAGE_SHIFT;
&lt; at &gt;&lt; at &gt; -379,6 +379,8 &lt; at &gt;&lt; at &gt; free_bios:
 return err;
 }
 
+EXPORT_SYMBOL_GPL(scsi_req_map_sg);
+
 /**
  * scsi_execute_async - insert request
  * &lt; at &gt;sdev:scsi device
</description>
    <dc:creator>Nicholas A. Bellinger</dc:creator>
    <dc:date>2008-12-03T00:49:08</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46461">
    <title>[GIT PATCH] SCSI fixes for 2.6.28-rc7</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46461</link>
    <description>This is quite a hefty update for so late. It includes a slew of block
timer related fixes (we moved to using block timers when the 2.6.28
merge window opened).  The bad news is that I still don't think we have
all the block timer related bugs caught and fixed.  There's also a slew
of zfcp (s390 driver) fixes and a few miscellaneous others (including
another regression bugzilla fix, the hang in starved list processing).

The patch is available here:

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

The short changelog is:

Christof Schmitt (1):
      zfcp: Fix opening of wka ports

James Bottomley (5):
      stex: switch to block timeout
      make scsi_eh_try_stu use block timeout
      megaraid_sas: switch to block timeout
      ibmvscsi: switch to block timeout
      aacraid: switch to block timeout

James Smart (1):
      fc_transport: fix old bug on bitflag definitions

Martin Petermann (1):
      zfcp: fix remote port status check

Mike Christie (1):
      Fix hang in starved list processing

Swen Schillig (5):
      zfcp: prevent double decrement on host_busy while being busy
      zfcp: fix deadlock between wq triggered port scan and ERP
      zfcp: eliminate race between validation and locking
      zfcp: verify for correct rport state before scanning for SCSI devs
      zfcp: returning an ERR_PTR where a NULL value is expected

And the diffstat:

 drivers/s390/scsi/zfcp_erp.c         |    7 +++++--
 drivers/s390/scsi/zfcp_fc.c          |    7 +++----
 drivers/s390/scsi/zfcp_fsf.c         |   20 ++++++++++++++------
 drivers/s390/scsi/zfcp_scsi.c        |    2 +-
 drivers/scsi/aacraid/linit.c         |    4 ++--
 drivers/scsi/ibmvscsi/ibmvscsi.c     |    2 +-
 drivers/scsi/megaraid/megaraid_sas.c |    3 ++-
 drivers/scsi/scsi_error.c            |    3 +--
 drivers/scsi/scsi_lib.c              |   23 +++++++++++------------
 drivers/scsi/stex.c                  |    2 +-
 include/scsi/scsi_transport_fc.h     |    2 +-
 11 files changed, 42 insertions(+), 33 deletions(-)

The entire diff is below.

James

---

diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 35364f6..c557ba3 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
&lt; at &gt;&lt; at &gt; -720,7 +720,6 &lt; at &gt;&lt; at &gt; static int zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *act,
 goto failed_openfcp;
 
 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &amp;act-&gt;adapter-&gt;status);
-schedule_work(&amp;act-&gt;adapter-&gt;scan_work);
 
 return ZFCP_ERP_SUCCEEDED;
 
&lt; at &gt;&lt; at &gt; -1186,7 +1185,9 &lt; at &gt;&lt; at &gt; static void zfcp_erp_scsi_scan(struct work_struct *work)
 container_of(work, struct zfcp_erp_add_work, work);
 struct zfcp_unit *unit = p-&gt;unit;
 struct fc_rport *rport = unit-&gt;port-&gt;rport;
-scsi_scan_target(&amp;rport-&gt;dev, 0, rport-&gt;scsi_target_id,
+
+if (rport &amp;&amp; rport-&gt;port_state == FC_PORTSTATE_ONLINE)
+scsi_scan_target(&amp;rport-&gt;dev, 0, rport-&gt;scsi_target_id,
  scsilun_to_int((struct scsi_lun *)&amp;unit-&gt;fcp_lun), 0);
 atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &amp;unit-&gt;status);
 zfcp_unit_put(unit);
&lt; at &gt;&lt; at &gt; -1282,6 +1283,8 &lt; at &gt;&lt; at &gt; static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
 case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
 if (result != ZFCP_ERP_SUCCEEDED)
 zfcp_erp_rports_del(adapter);
+else
+schedule_work(&amp;adapter-&gt;scan_work);
 zfcp_adapter_put(adapter);
 break;
 }
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index 1a7c80a..8aab309 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
&lt; at &gt;&lt; at &gt; -50,7 +50,8 &lt; at &gt;&lt; at &gt; static int zfcp_wka_port_get(struct zfcp_wka_port *wka_port)
 if (mutex_lock_interruptible(&amp;wka_port-&gt;mutex))
 return -ERESTARTSYS;
 
-if (wka_port-&gt;status != ZFCP_WKA_PORT_ONLINE) {
+if (wka_port-&gt;status == ZFCP_WKA_PORT_OFFLINE ||
+    wka_port-&gt;status == ZFCP_WKA_PORT_CLOSING) {
 wka_port-&gt;status = ZFCP_WKA_PORT_OPENING;
 if (zfcp_fsf_open_wka_port(wka_port))
 wka_port-&gt;status = ZFCP_WKA_PORT_OFFLINE;
&lt; at &gt;&lt; at &gt; -125,8 +126,7 &lt; at &gt;&lt; at &gt; static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
 
 read_lock_irqsave(&amp;zfcp_data.config_lock, flags);
 list_for_each_entry(port, &amp;fsf_req-&gt;adapter-&gt;port_list_head, list) {
-/* FIXME: ZFCP_STATUS_PORT_DID_DID check is racy */
-if (!(atomic_read(&amp;port-&gt;status) &amp; ZFCP_STATUS_PORT_DID_DID))
+if (!(atomic_read(&amp;port-&gt;status) &amp; ZFCP_STATUS_PORT_PHYS_OPEN))
 /* Try to connect to unused ports anyway. */
 zfcp_erp_port_reopen(port,
      ZFCP_STATUS_COMMON_ERP_FAILED,
&lt; at &gt;&lt; at &gt; -610,7 +610,6 &lt; at &gt;&lt; at &gt; int zfcp_scan_ports(struct zfcp_adapter *adapter)
 int ret, i;
 struct zfcp_gpn_ft *gpn_ft;
 
-zfcp_erp_wait(adapter); /* wait until adapter is finished with ERP */
 if (fc_host_port_type(adapter-&gt;scsi_host) != FC_PORTTYPE_NPORT)
 return 0;
 
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index d024442..dc03676 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
&lt; at &gt;&lt; at &gt; -930,8 +930,10 &lt; at &gt;&lt; at &gt; struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
 goto out;
 req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND,
   req_flags, adapter-&gt;pool.fsf_req_abort);
-if (IS_ERR(req))
+if (IS_ERR(req)) {
+req = NULL;
 goto out;
+}
 
 if (unlikely(!(atomic_read(&amp;unit-&gt;status) &amp;
        ZFCP_STATUS_COMMON_UNBLOCKED)))
&lt; at &gt;&lt; at &gt; -1584,6 +1586,7 &lt; at &gt;&lt; at &gt; static void zfcp_fsf_open_wka_port_handler(struct zfcp_fsf_req *req)
 wka_port-&gt;status = ZFCP_WKA_PORT_OFFLINE;
 break;
 case FSF_PORT_ALREADY_OPEN:
+break;
 case FSF_GOOD:
 wka_port-&gt;handle = header-&gt;port_handle;
 wka_port-&gt;status = ZFCP_WKA_PORT_ONLINE;
&lt; at &gt;&lt; at &gt; -2113,18 +2116,21 &lt; at &gt;&lt; at &gt; static inline void zfcp_fsf_trace_latency(struct zfcp_fsf_req *fsf_req)
 
 static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
 {
-struct scsi_cmnd *scpnt = req-&gt;data;
+struct scsi_cmnd *scpnt;
 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *)
     &amp;(req-&gt;qtcb-&gt;bottom.io.fcp_rsp);
 u32 sns_len;
 char *fcp_rsp_info = (unsigned char *) &amp;fcp_rsp_iu[1];
 unsigned long flags;
 
-if (unlikely(!scpnt))
-return;
-
 read_lock_irqsave(&amp;req-&gt;adapter-&gt;abort_lock, flags);
 
+scpnt = req-&gt;data;
+if (unlikely(!scpnt)) {
+read_unlock_irqrestore(&amp;req-&gt;adapter-&gt;abort_lock, flags);
+return;
+}
+
 if (unlikely(req-&gt;status &amp; ZFCP_STATUS_FSFREQ_ABORTED)) {
 set_host_byte(scpnt, DID_SOFT_ERROR);
 set_driver_byte(scpnt, SUGGEST_RETRY);
&lt; at &gt;&lt; at &gt; -2442,8 +2448,10 &lt; at &gt;&lt; at &gt; struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *adapter,
 goto out;
 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
   adapter-&gt;pool.fsf_req_scsi);
-if (IS_ERR(req))
+if (IS_ERR(req)) {
+req = NULL;
 goto out;
+}
 
 req-&gt;status |= ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT;
 req-&gt;data = unit;
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index e46fd3e..468c880 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
&lt; at &gt;&lt; at &gt; -88,7 +88,7 &lt; at &gt;&lt; at &gt; static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
 ret = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, 0,
      ZFCP_REQ_AUTO_CLEANUP);
 if (unlikely(ret == -EBUSY))
-zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
+return SCSI_MLQUEUE_DEVICE_BUSY;
 else if (unlikely(ret &lt; 0))
 return SCSI_MLQUEUE_HOST_BUSY;
 
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 9aa301c..162cd92 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
&lt; at &gt;&lt; at &gt; -427,8 +427,8 &lt; at &gt;&lt; at &gt; static int aac_slave_configure(struct scsi_device *sdev)
  * Firmware has an individual device recovery time typically
  * of 35 seconds, give us a margin.
  */
-if (sdev-&gt;timeout &lt; (45 * HZ))
-sdev-&gt;timeout = 45 * HZ;
+if (sdev-&gt;request_queue-&gt;rq_timeout &lt; (45 * HZ))
+blk_queue_rq_timeout(sdev-&gt;request_queue, 45*HZ);
 for (cid = 0; cid &lt; aac-&gt;maximum_num_containers; ++cid)
 if (aac-&gt;fsa_dev[cid].valid)
 ++num_lsu;
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 87e09f3..6cad175 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
&lt; at &gt;&lt; at &gt; -1442,7 +1442,7 &lt; at &gt;&lt; at &gt; static int ibmvscsi_slave_configure(struct scsi_device *sdev)
 spin_lock_irqsave(shost-&gt;host_lock, lock_flags);
 if (sdev-&gt;type == TYPE_DISK) {
 sdev-&gt;allow_restart = 1;
-sdev-&gt;timeout = 60 * HZ;
+blk_queue_rq_timeout(sdev-&gt;request_queue, 60 * HZ);
 }
 scsi_adjust_queue_depth(sdev, 0, shost-&gt;cmd_per_lun);
 spin_unlock_irqrestore(shost-&gt;host_lock, lock_flags);
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index a454f94..17ce7ab 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
&lt; at &gt;&lt; at &gt; -1016,7 +1016,8 &lt; at &gt;&lt; at &gt; static int megasas_slave_configure(struct scsi_device *sdev)
  * The RAID firmware may require extended timeouts.
  */
 if (sdev-&gt;channel &gt;= MEGASAS_MAX_PD_CHANNELS)
-sdev-&gt;timeout = MEGASAS_DEFAULT_CMD_TIMEOUT * HZ;
+blk_queue_rq_timeout(sdev-&gt;request_queue,
+     MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
 return 0;
 }
 
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 3863617..edfaf24 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
&lt; at &gt;&lt; at &gt; -932,8 +932,7 &lt; at &gt;&lt; at &gt; static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
 int i, rtn = NEEDS_RETRY;
 
 for (i = 0; rtn == NEEDS_RETRY &amp;&amp; i &lt; 2; i++)
-rtn = scsi_send_eh_cmnd(scmd, stu_command, 6,
-scmd-&gt;device-&gt;timeout, 0);
+rtn = scsi_send_eh_cmnd(scmd, stu_command, 6, scmd-&gt;device-&gt;request_queue-&gt;rq_timeout, 0);
 
 if (rtn == SUCCESS)
 return 0;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f5d3b96..fa45a1a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
&lt; at &gt;&lt; at &gt; -567,15 +567,18 &lt; at &gt;&lt; at &gt; static inline int scsi_host_is_busy(struct Scsi_Host *shost)
  */
 static void scsi_run_queue(struct request_queue *q)
 {
-struct scsi_device *starved_head = NULL, *sdev = q-&gt;queuedata;
+struct scsi_device *sdev = q-&gt;queuedata;
 struct Scsi_Host *shost = sdev-&gt;host;
+LIST_HEAD(starved_list);
 unsigned long flags;
 
 if (scsi_target(sdev)-&gt;single_lun)
 scsi_single_lun_run(sdev);
 
 spin_lock_irqsave(shost-&gt;host_lock, flags);
-while (!list_empty(&amp;shost-&gt;starved_list) &amp;&amp; !scsi_host_is_busy(shost)) {
+list_splice_init(&amp;shost-&gt;starved_list, &amp;starved_list);
+
+while (!list_empty(&amp;starved_list)) {
 int flagset;
 
 /*
&lt; at &gt;&lt; at &gt; -588,24 +591,18 &lt; at &gt;&lt; at &gt; static void scsi_run_queue(struct request_queue *q)
  * scsi_request_fn must get the host_lock before checking
  * or modifying starved_list or starved_entry.
  */
-sdev = list_entry(shost-&gt;starved_list.next,
-  struct scsi_device, starved_entry);
-/*
- * The *queue_ready functions can add a device back onto the
- * starved list's tail, so we must check for a infinite loop.
- */
-if (sdev == starved_head)
+if (scsi_host_is_busy(shost))
 break;
-if (!starved_head)
-starved_head = sdev;
 
+sdev = list_entry(starved_list.next,
+  struct scsi_device, starved_entry);
+list_del_init(&amp;sdev-&gt;starved_entry);
 if (scsi_target_is_busy(scsi_target(sdev))) {
 list_move_tail(&amp;sdev-&gt;starved_entry,
        &amp;shost-&gt;starved_list);
 continue;
 }
 
-list_del_init(&amp;sdev-&gt;starved_entry);
 spin_unlock(shost-&gt;host_lock);
 
 spin_lock(sdev-&gt;request_queue-&gt;queue_lock);
&lt; at &gt;&lt; at &gt; -621,6 +618,8 &lt; at &gt;&lt; at &gt; static void scsi_run_queue(struct request_queue *q)
 
 spin_lock(shost-&gt;host_lock);
 }
+/* put any unprocessed entries back */
+list_splice(&amp;starved_list, &amp;shost-&gt;starved_list);
 spin_unlock_irqrestore(shost-&gt;host_lock, flags);
 
 blk_run_queue(q);
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 3790906..2fa830c 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
&lt; at &gt;&lt; at &gt; -477,7 +477,7 &lt; at &gt;&lt; at &gt; stex_slave_config(struct scsi_device *sdev)
 {
 sdev-&gt;use_10_for_rw = 1;
 sdev-&gt;use_10_for_ms = 1;
-sdev-&gt;timeout = 60 * HZ;
+blk_queue_rq_timeout(sdev-&gt;request_queue, 60 * HZ);
 sdev-&gt;tagged_supported = 1;
 
 return 0;
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 49d8913..6e04e6f 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
&lt; at &gt;&lt; at &gt; -357,7 +357,7 &lt; at &gt;&lt; at &gt; struct fc_rport {/* aka fc_starget_attrs */
 /* bit field values for struct fc_rport "flags" field: */
 #define FC_RPORT_DEVLOSS_PENDING0x01
 #define FC_RPORT_SCAN_PENDING0x02
-#define FC_RPORT_FAST_FAIL_TIMEDOUT0x03
+#define FC_RPORT_FAST_FAIL_TIMEDOUT0x04
 
 #definedev_to_rport(d)\
 container_of(d, struct fc_rport, dev)


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

</description>
    <dc:creator>James Bottomley</dc:creator>
    <dc:date>2008-12-02T16:58:56</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46435">
    <title>iscsi update for 2.6.29</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46435</link>
    <description>This patchset is for 2.6.29. This should be the final patches
to prepare the iscsi layer for cxgb3i, which looks like it
has gone through the netdev review and will be sent here next
shortly.

This patchset was made over scsi-misc, and the fix here.
http://marc.info/?l=linux-scsi&amp;m=122815519326207&amp;w=2
(the fix in that email does not conflict with this patchset
and can be applied over or before these patches).

cxgb3i adds a new offload model. Where qla4xxx offloaded pretty
much everything, and bnx2i offloaded the iscsi sequence processing
(give it the iscsi scsi command pdu and the offload engine will
handle everything between), cxgb3i offloads operations like
digest, padding, and data transfers. It relies on the iscsi layer
for the sequence state machine, so this patchset is basically
just breaking up iscsi_tcp into a lib layer so cxgb3i can share
the code.



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

</description>
    <dc:creator>michaelc&lt; at &gt;cs.wisc.edu</dc:creator>
    <dc:date>2008-12-02T06:32:03</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46428">
    <title>Changes to Linux/SCSI target mode infrastructure for v2.6.28</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46428</link>
    <description>Greetings Tomo-san and Co,

With the ongoing work in Linux/SCSI for v2.6.28 to map target mode
struct scatterlist memory directly down to struct scsi_cmnd without the
need for a intermediate struct bio as with the existing
scsi_execute_async(), I have started the porting process for the
Linux/SCSI subsystem plugin in generic target core v3.0
(lio-core-2.6.git) on v2.6.28-rc6.

So far, using struct request for ICF_SCSI_CONTROL_NONSG_IO_CDB is up
using blk_rq_map_kern(), as well as ICF_SCSI_NON_DATA_CDB ops using
struct request.  In order to get the first READ_10s of type
ICF_SCSI_DATA_SG_IO_CDB to work, I had to add a temporary
EXPORT_SYMBOL_GPL() for drivers/scsi/scsi_lib.c:scsi_req_map_sg() in
lio-core-2.6.git for v2.6.28-rc6 in order to get TYPE_DISK up using an
software emulated MPT-Fusion HBA driver with struct request.  I have
been looking at drivers/scsi/scsi_tgt_lib.c() (which currently uses
struct request), and I figure we need something similar for the generic
target infrastructure, although __scsi_get_command() and
__scsi_put_command() are currently used in that code.

Below is what my patch looks like so far, I will probably just end up
commiting an temporary ifdef to keep scsi_execute_async() until the
proper pieces are in place and the other issues are resolved below.
for struct scatterlist in
drivers/lio-core/target_core_pscsi.c:pscsi_map_task_SG() get rid of
scsi_req_map_sg() usage all together.

So far during my initial testing, I am running into a two different
exceptions.  One NULL pointer deference OOPS after half dozen Open/iSCSI
login/logouts in block/elevator.c:elv_dequeue_request().   Here is the
trace from SCSI softirq context:

http://linux-iscsi.org/builds/user/nab/2.6.28-rc6-oops-0.png
http://linux-iscsi.org/builds/user/nab/2.6.28-rc6-oops-1.png

The other one is a BUG_ON in blk/blk-timeout.c:177 in blk_add_timeout()
that happens after a few hundred MB of READ_10 traffic, which also
appears to pass through elv_dequeue_request() at some point:

http://linux-iscsi.org/builds/user/nab/2.6.28-rc6-oops-2.png
http://linux-iscsi.org/builds/user/nab/2.6.28-rc6-oops-4.png

Tomo, Boaz, Jens, any comments..?

--nab

diff --git a/drivers/lio-core/target_core_pscsi.c b/drivers/lio-core/target_core_pscsi.c
index ed9f588..5161483 100644
--- a/drivers/lio-core/target_core_pscsi.c
+++ b/drivers/lio-core/target_core_pscsi.c
&lt; at &gt;&lt; at &gt; -37,6 +37,7 &lt; at &gt;&lt; at &gt;
 #include &lt;linux/spinlock.h&gt;
 #include &lt;linux/smp_lock.h&gt;
 #include &lt;linux/genhd.h&gt;
+#include &lt;linux/cdrom.h&gt;
 #include &lt;linux/file.h&gt;
 
 #include &lt;scsi/scsi.h&gt;
&lt; at &gt;&lt; at &gt; -44,6 +45,7 &lt; at &gt;&lt; at &gt;
 #include &lt;scsi/scsi_cmnd.h&gt;
 #include &lt;scsi/scsi_host.h&gt;
 #include &lt;sd.h&gt;
+#include &lt;sr.h&gt;
 
 #include &lt;iscsi_linux_os.h&gt;
 #include &lt;iscsi_linux_defs.h&gt;
&lt; at &gt;&lt; at &gt; -763,11 +765,11 &lt; at &gt;&lt; at &gt; extern void *pscsi_allocate_request (
 se_device_t *dev)
 {
 pscsi_plugin_task_t *pt;
-if (!(pt = kmalloc(sizeof(pscsi_plugin_task_t), GFP_KERNEL))) {
-TRACE_ERROR("Unable to allocate pscsi_plugin_task_t\n");
+
+if (!(pt = kzalloc(sizeof(pscsi_plugin_task_t), GFP_KERNEL))) {
+printk(KERN_ERR "Unable to allocate pscsi_plugin_task_t\n");
 return(NULL);
 }
-memset(pt, 0, sizeof(pscsi_plugin_task_t));
 
 return(pt);
 }
&lt; at &gt;&lt; at &gt; -788,7 +790,44 &lt; at &gt;&lt; at &gt; extern void pscsi_get_evpd_sn (unsigned char *buf, u32 size, se_device_t *dev)
 return;
 }
 
-/*pscsi_do_task(): (Part of se_subsystem_api_t template)
+static int pscsi_blk_get_request (se_task_t *task)
+{
+pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
+pscsi_dev_virt_t *pdv = (pscsi_dev_virt_t *) task-&gt;iscsi_dev-&gt;dev_ptr;
+
+pt-&gt;pscsi_req = blk_get_request(pdv-&gt;pdv_sd-&gt;request_queue,
+(pt-&gt;pscsi_direction == DMA_TO_DEVICE), GFP_KERNEL);
+if (!(pt-&gt;pscsi_req) || IS_ERR(pt-&gt;pscsi_req)) {
+printk(KERN_ERR "PSCSI: blk_get_request() failed: %ld\n",
+IS_ERR(pt-&gt;pscsi_req));
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+}
+/*
+ * Defined as "scsi command" in include/linux/blkdev.h.
+ */
+pt-&gt;pscsi_req-&gt;cmd_type = REQ_TYPE_BLOCK_PC;
+/*
+ * Setup the done function pointer for struct request,
+ * also set the end_io_data pointer.to se_task_t.
+ */
+pt-&gt;pscsi_req-&gt;end_io = pscsi_req_done;
+pt-&gt;pscsi_req-&gt;end_io_data = (void *)task;
+/*
+ * Load the referenced se_task_t's SCSI CDB into
+ * include/linux/blkdev.h:struct request-&gt;cmd
+ */
+pt-&gt;pscsi_req-&gt;cmd_len = COMMAND_SIZE(pt-&gt;pscsi_cdb[0]);
+memcpy(pt-&gt;pscsi_req-&gt;cmd, pt-&gt;pscsi_cdb, pt-&gt;pscsi_req-&gt;cmd_len);
+/*
+ * Setup pointer for outgoing sense data.
+ */
+pt-&gt;pscsi_req-&gt;sense = (void *)&amp;pt-&gt;pscsi_sense[0];
+pt-&gt;pscsi_req-&gt;sense_len = 0;
+
+return(0);
+}
+
+/*      pscsi_do_task(): (Part of se_subsystem_api_t template)
  *
  *
  */
&lt; at &gt;&lt; at &gt; -796,17 +835,32 &lt; at &gt;&lt; at &gt; extern int pscsi_do_task (se_task_t *task)
 {
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 pscsi_dev_virt_t *pdv = (pscsi_dev_virt_t *) task-&gt;iscsi_dev-&gt;dev_ptr;
-int ret;
-
-if ((ret = scsi_execute_async((struct scsi_device *)pdv-&gt;pdv_sd,
-   pt-&gt;pscsi_cdb, COMMAND_SIZE(pt-&gt;pscsi_cdb[0]), pt-&gt;pscsi_direction,
-   pt-&gt;pscsi_buf, task-&gt;task_size, task-&gt;task_sg_num,
-   (task-&gt;se_obj_api-&gt;get_device_type(task-&gt;se_obj_ptr) == 0) ?
-   PS_TIMEOUT_DISK : PS_TIMEOUT_OTHER, PS_RETRY,
-   (void *)task, pscsi_req_done, GFP_KERNEL)) != 0) {
-TRACE_ERROR("PSCSI Execute(): returned: %d\n", ret);
-return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
-}
+struct gendisk *gd = NULL;
+/*
+ * Grab pointer to struct gendisk for TYPE_DISK and TYPE_ROM
+ * cases (eg: cases where struct scsi_device has a backing
+ * struct block_device.  Also set the struct request-&gt;timeout
+ * value based on peripheral device type (from SCSI).
+ */
+if (pdv-&gt;pdv_sd-&gt;type == TYPE_DISK) {
+struct scsi_disk *sdisk = dev_get_drvdata(
+&amp;pdv-&gt;pdv_sd-&gt;sdev_gendev);
+gd = sdisk-&gt;disk;
+pt-&gt;pscsi_req-&gt;timeout = PS_TIMEOUT_DISK;
+} else if (pdv-&gt;pdv_sd-&gt;type == TYPE_ROM) {
+struct scsi_cd *scd = dev_get_drvdata(
+&amp;pdv-&gt;pdv_sd-&gt;sdev_gendev);
+gd = scd-&gt;disk;
+pt-&gt;pscsi_req-&gt;timeout = PS_TIMEOUT_OTHER;
+} else
+pt-&gt;pscsi_req-&gt;timeout = PS_TIMEOUT_OTHER;
+
+pt-&gt;pscsi_req-&gt;retries = PS_RETRY;
+/*
+ * Queue the struct request into the struct scsi_device-&gt;request_queue.
+ */
+blk_execute_rq_nowait(pdv-&gt;pdv_sd-&gt;request_queue, gd,
+      pt-&gt;pscsi_req, 1, pscsi_req_done);
 
 return(PYX_TRANSPORT_SENT_TO_TRANSPORT);
 }
&lt; at &gt;&lt; at &gt; -817,7 +871,14 &lt; at &gt;&lt; at &gt; extern int pscsi_do_task (se_task_t *task)
  */
 extern void pscsi_free_task (se_task_t *task)
 {
-kfree(task-&gt;transport_req);
+pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
+
+if (pt-&gt;pscsi_req) {
+blk_put_request(pt-&gt;pscsi_req);
+pt-&gt;pscsi_req = NULL;
+}
+
+kfree(pt);
 return;
 }
 
&lt; at &gt;&lt; at &gt; -1099,31 +1160,65 &lt; at &gt;&lt; at &gt; extern void __pscsi_get_dev_info (pscsi_dev_virt_t *pdv, char *b, int *bl)
 return;
 }
 
-/*pscsi_map_task_SG(): 
+extern int scsi_req_map_sg(struct request *, struct scatterlist *, int,  unsigned , gfp_t );
+
+/*      pscsi_map_task_SG(): 
  *
  *
  */
-extern void pscsi_map_task_SG (se_task_t *task)
+extern int pscsi_map_task_SG (se_task_t *task)
 {
         pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
+int ret = 0;
+
 pt-&gt;pscsi_buf = (void *)task-&gt;task_buf;
 
-return;
+if (!task-&gt;task_size)
+return(0);
+#if 0
+if ((ret = blk_rq_map_sg(pdv-&gt;pdv_sd-&gt;request_queue,
+pt-&gt;pscsi_req,
+(struct scatterlist *)pt-&gt;pscsi_buf)) &lt; 0) {
+printk(KERN_ERR "PSCSI: blk_rq_map_sg() returned %d\n", ret);
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+}
+#else
+if ((ret = scsi_req_map_sg(pt-&gt;pscsi_req,
+(struct scatterlist *)pt-&gt;pscsi_buf,
+task-&gt;task_sg_num, task-&gt;task_size,
+GFP_KERNEL)) &lt; 0) {
+printk(KERN_ERR "PSCSI: scsi_req_map_sg() failed: %d\n", ret);
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+}
+#endif
+return(0);
 }
 
 /*pscsi_map_task_non_SG():
  *
  *
  */
-extern void pscsi_map_task_non_SG (se_task_t *task)
+extern int pscsi_map_task_non_SG (se_task_t *task)
 {
 iscsi_cmd_t *cmd = task-&gt;iscsi_cmd;
+pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
+pscsi_dev_virt_t *pdv = (pscsi_dev_virt_t *) task-&gt;iscsi_dev-&gt;dev_ptr;
 unsigned char *buf = (unsigned char *) T_TASK(cmd)-&gt;t_task_buf;
+int ret = 0;
 
-pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 pt-&gt;pscsi_buf = (void *)buf;
 
-return;
+if (!task-&gt;task_size)
+return(0);
+
+if ((ret = blk_rq_map_kern(pdv-&gt;pdv_sd-&gt;request_queue,
+pt-&gt;pscsi_req, pt-&gt;pscsi_buf,
+task-&gt;task_size, GFP_KERNEL)) &lt; 0) {
+printk(KERN_ERR "PSCSI: blk_rq_map_kern() failed: %d\n", ret);
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+}
+
+return(0);
 }
 
 /*pscsi_CDB_inquiry():
&lt; at &gt;&lt; at &gt; -1135,9 +1230,11 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_inquiry (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_FROM_DEVICE;
-pscsi_map_task_non_SG(task);
+
+if (pscsi_blk_get_request(task) &lt; 0)
+return(-1);
 
-return(0);
+return(pscsi_map_task_non_SG(task));
 }
 
 extern int pscsi_CDB_none (se_task_t *task, u32 size)
&lt; at &gt;&lt; at &gt; -1146,7 +1243,7 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_none (se_task_t *task, u32 size)
 
 pt-&gt;pscsi_direction = DMA_NONE;
 
-return(0);
+return(pscsi_blk_get_request(task));
 }
 
 /*pscsi_CDB_read_non_SG():
&lt; at &gt;&lt; at &gt; -1158,9 +1255,11 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_read_non_SG (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_FROM_DEVICE;
-pscsi_map_task_non_SG(task);
 
-return(0);
+if (pscsi_blk_get_request(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+
+return(pscsi_map_task_non_SG(task));
 }
 
 /*pscsi_CDB_read_SG():
&lt; at &gt;&lt; at &gt; -1172,7 +1271,12 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_read_SG (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_FROM_DEVICE;
-pscsi_map_task_SG(task);
+
+if (pscsi_blk_get_request(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+
+if (pscsi_map_task_SG(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
 
 return(task-&gt;task_sg_num);
 }
&lt; at &gt;&lt; at &gt; -1186,9 +1290,11 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_write_non_SG (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_TO_DEVICE;
-pscsi_map_task_non_SG(task);
 
-return(0);
+if (pscsi_blk_get_request(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+
+return(pscsi_map_task_non_SG(task));
 }
 
 /*pscsi_CDB_write_SG():
&lt; at &gt;&lt; at &gt; -1200,7 +1306,12 &lt; at &gt;&lt; at &gt; extern int pscsi_CDB_write_SG (se_task_t *task, u32 size)
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *) task-&gt;transport_req;
 
 pt-&gt;pscsi_direction = DMA_TO_DEVICE;
-pscsi_map_task_SG(task);
+
+if (pscsi_blk_get_request(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
+
+if (pscsi_map_task_SG(task) &lt; 0)
+return(PYX_TRANSPORT_LOGICAL_UNIT_COMMUNICATION_FAILURE);
 
 return(task-&gt;task_sg_num);
 }
&lt; at &gt;&lt; at &gt; -1386,22 +1497,25 &lt; at &gt;&lt; at &gt; extern void pscsi_shutdown_hba (se_hba_t *hba)
  *
  *
  */
-//#warning FIXME: We can do some custom handling of HBA fuckups here.
-extern inline void pscsi_process_SAM_status (se_task_t *task, unsigned char *cdb, int result)
+static inline void pscsi_process_SAM_status (
+se_task_t *task,
+pscsi_plugin_task_t *pt)
 {
-if ((task-&gt;task_scsi_status = status_byte(result))) {
+if ((task-&gt;task_scsi_status = status_byte(pt-&gt;pscsi_result))) {
 task-&gt;task_scsi_status &lt;&lt;= 1;
-PYXPRINT("Parallel SCSI Status Byte exception - ITT: 0x%08x Task: %p CDB: 0x%02x"
-" Result: 0x%08x\n", task-&gt;iscsi_cmd-&gt;init_task_tag, task, cdb[0], result);
+PYXPRINT("PSCSI Status Byte exception at task: %p CDB: 0x%02x"
+" Result: 0x%08x\n", task, pt-&gt;pscsi_cdb[0],
+pt-&gt;pscsi_result);
 }
 
-switch (host_byte(result)) {
+switch (host_byte(pt-&gt;pscsi_result)) {
 case DID_OK:
 transport_complete_task(task, (!task-&gt;task_scsi_status));
 break;
 default:
-PYXPRINT("Parallel SCSI Host Byte exception - ITT: 0x%08x Task: %p CDB: 0x%02x"
-" Result: 0x%08x\n", task-&gt;iscsi_cmd-&gt;init_task_tag, task, cdb[0], result);
+PYXPRINT("PSCSI Host Byte exception at task: %p CDB: 0x%02x"
+" Result: 0x%08x\n", task, pt-&gt;pscsi_cdb[0],
+pt-&gt;pscsi_result);
 task-&gt;task_scsi_status = SAM_STAT_CHECK_CONDITION;
 task-&gt;task_error_status = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE;
 task-&gt;iscsi_cmd-&gt;transport_error_status = PYX_TRANSPORT_UNKNOWN_SAM_OPCODE;
&lt; at &gt;&lt; at &gt; -1412,21 +1526,17 &lt; at &gt;&lt; at &gt; extern inline void pscsi_process_SAM_status (se_task_t *task, unsigned char *cdb
 return;
 }
 
-extern void pscsi_req_done (void *data, char *sense, int result, int data_len)
+extern void pscsi_req_done (struct request *req, int uptodate)
 {
-se_task_t *task = (se_task_t *)data;
+se_task_t *task = (se_task_t *)req-&gt;end_io_data;
 pscsi_plugin_task_t *pt = (pscsi_plugin_task_t *)task-&gt;transport_req;
-#if 0
-printk("pscsi_req_done(): result: %08x, sense: %p data_len: %d\n",
-result, sense, data_len);
-#endif
-pt-&gt;pscsi_result = result;
-pt-&gt;pscsi_data_len = data_len;
-
-if (result != 0)
-memcpy(pt-&gt;pscsi_sense, sense, SCSI_SENSE_BUFFERSIZE);
+
+pt-&gt;pscsi_result = req-&gt;errors;
+pt-&gt;pscsi_resid = req-&gt;data_len;
 
-pscsi_process_SAM_status(task, &amp;pt-&gt;pscsi_cdb[0], result);
+pscsi_process_SAM_status(task, pt);
+
+__blk_put_request(req-&gt;q, req);
+
 return;
 }
-
diff --git a/drivers/lio-core/target_core_pscsi.h b/drivers/lio-core/target_core_pscsi.h
index 980587d..090f0d2 100644
--- a/drivers/lio-core/target_core_pscsi.h
+++ b/drivers/lio-core/target_core_pscsi.h
&lt; at &gt;&lt; at &gt; -90,7 +90,7 &lt; at &gt;&lt; at &gt; extern struct scatterlist *pscsi_get_SG (se_task_t *);
 extern u32 pscsi_get_SG_count (se_task_t *);
 extern int pscsi_set_non_SG_buf (unsigned char *, se_task_t *);
 extern void pscsi_shutdown_hba (struct se_hba_s *);
-extern void pscsi_req_done (void *, char *, int, int);
+extern void pscsi_req_done (struct request *, int);
 #endif
 
 #include &lt;linux/device.h&gt;
&lt; at &gt;&lt; at &gt; -104,8 +104,9 &lt; at &gt;&lt; at &gt; typedef struct pscsi_plugin_task_s {
 unsigned char pscsi_sense[SCSI_SENSE_BUFFERSIZE];
 intpscsi_direction;
 intpscsi_result;
-u32pscsi_data_len;
+u32pscsi_resid;
 void*pscsi_buf;
+struct request *pscsi_req;
 } pscsi_plugin_task_t;
 
 #define PDF_HAS_CHANNEL_ID0x01
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f5d3b96..9e03a02 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
&lt; at &gt;&lt; at &gt; -303,8 +303,8 &lt; at &gt;&lt; at &gt; static void scsi_bi_endio(struct bio *bio, int error)
  * request can be sent to the block layer. We do not trust the scatterlist
  * sent to use, as some ULDs use that struct to only organize the pages.
  */
-static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl,
-   int nsegs, unsigned bufflen, gfp_t gfp)
+int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl,
+    int nsegs, unsigned bufflen, gfp_t gfp)
 {
 struct request_queue *q = rq-&gt;q;
 int nr_pages = (bufflen + sgl[0].offset + PAGE_SIZE - 1) &gt;&gt; PAGE_SHIFT;
&lt; at &gt;&lt; at &gt; -379,6 +379,8 &lt; at &gt;&lt; at &gt; free_bios:
 return err;
 }
 
+EXPORT_SYMBOL_GPL(scsi_req_map_sg);
+
 /**
  * scsi_execute_async - insert request
  * &lt; at &gt;sdev:scsi device


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

</description>
    <dc:creator>Nicholas A. Bellinger</dc:creator>
    <dc:date>2008-12-02T01:52:07</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46427">
    <title>Linux SCSI programming</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46427</link>
    <description>Hi,

I'm trying to port a Windows SCSI API over to Linux. The API has
several functions, most of them using ATA_PASS_THROUGH_EX to send a
vendor specific command over to the device. I've managed to port 1 of
the API function that is a modified INQUIRY command. However, I'm very
confused as to how ATA passthrough is done in Linux. I've looked at
the sg3_utils source code to get some inspiration but it's too
complicated for me to understand what's going on.

Does anyone know how to port this?

In Windows a ATA_PASS_THROUGH_EX pointer is declared and memory
allocated for it. It's fields are then initialized(Length, AtaFlags,
DataTransferLength, TimeOutValue, DataBufferOffset, CurrentTaskFile[],
PreviousTaskFile[], etc) and then a DeviceIoControl() is called.

Now I know Linux's version of DeviceIoControl is ioctl() and I've used
it successfully for the INQUIRY command, but what's Linux's version of
ATA_PASS_THROUGH_EX?

Any help would be appreciated. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>Sihan Goi</dc:creator>
    <dc:date>2008-12-02T01:50:00</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46425">
    <title>[patch 08/10] scsi: annotate gdth_rdcap_data, gdth_rdcap16_data endianness</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46425</link>
    <description>From: Harvey Harrison &lt;harvey.harrison&lt; at &gt;gmail.com&gt;

It would be easy to get rid of the typedefs too, but I kept this
minimal.

Noticed by sparse:
drivers/scsi/gdth.c:2395:31: warning: incorrect type in assignment (different base types)
drivers/scsi/gdth.c:2395:31:    expected unsigned int [unsigned] [assigned] [usertype] last_block_no
drivers/scsi/gdth.c:2395:31:    got restricted __be32 [usertype] &lt;noident&gt;
drivers/scsi/gdth.c:2396:27: warning: incorrect type in assignment (different base types)
drivers/scsi/gdth.c:2396:27:    expected unsigned int [unsigned] [assigned] [usertype] block_length
drivers/scsi/gdth.c:2396:27:    got restricted __be32 [usertype] &lt;noident&gt;
drivers/scsi/gdth.c:2406:33: warning: incorrect type in assignment (different base types)
drivers/scsi/gdth.c:2406:33:    expected unsigned long long [unsigned] [usertype] last_block_no
drivers/scsi/gdth.c:2406:33:    got restricted __be64 [usertype] &lt;noident&gt;
drivers/scsi/gdth.c:2407:33: warning: incorrect type in assignment (different base types)
drivers/scsi/gdth.c:2407:33:    expected unsigned int [unsigned] [usertype] block_length
drivers/scsi/gdth.c:2407:33:    got restricted __be32 [usertype] &lt;noident&gt;

Signed-off-by: Harvey Harrison &lt;harvey.harrison&lt; at &gt;gmail.com&gt;
Cc: Boaz Harrosh &lt;bharrosh&lt; at &gt;panasas.com&gt;
Cc: James Bottomley &lt;James.Bottomley&lt; at &gt;HansenPartnership.com&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 drivers/scsi/gdth.c |    2 +-
 drivers/scsi/gdth.h |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff -puN drivers/scsi/gdth.c~scsi-annotate-gdth_rdcap_data-gdth_rdcap16_data-endianness drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~scsi-annotate-gdth_rdcap_data-gdth_rdcap16_data-endianness
+++ a/drivers/scsi/gdth.c
&lt; at &gt;&lt; at &gt; -2391,7 +2391,7 &lt; at &gt;&lt; at &gt; static int gdth_internal_cache_cmd(gdth_
       case READ_CAPACITY:
         TRACE2(("Read capacity hdrive %d\n",t));
         if (ha-&gt;hdr[t].size &gt; (ulong64)0xffffffff)
-            rdc.last_block_no = 0xffffffff;
+            rdc.last_block_no = cpu_to_be32(0xffffffff);
         else
             rdc.last_block_no = cpu_to_be32(ha-&gt;hdr[t].size-1);
         rdc.block_length  = cpu_to_be32(SECTOR_SIZE);
diff -puN drivers/scsi/gdth.h~scsi-annotate-gdth_rdcap_data-gdth_rdcap16_data-endianness drivers/scsi/gdth.h
--- a/drivers/scsi/gdth.h~scsi-annotate-gdth_rdcap_data-gdth_rdcap16_data-endianness
+++ a/drivers/scsi/gdth.h
&lt; at &gt;&lt; at &gt; -968,14 +968,14 &lt; at &gt;&lt; at &gt; typedef struct {
 
 /* READ_CAPACITY data format */
 typedef struct {
-    ulong32     last_block_no;
-    ulong32     block_length;
+__be32 last_block_no;
+__be32 block_length;
 } PACKED gdth_rdcap_data;
 
 /* READ_CAPACITY (16) data format */
 typedef struct {
-    ulong64     last_block_no;
-    ulong32     block_length;
+__be64 last_block_no;
+__be32 block_length;
 } PACKED gdth_rdcap16_data;
 
 /* REQUEST_SENSE data format */
_
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>akpm&lt; at &gt;linux-foundation.org</dc:creator>
    <dc:date>2008-12-01T22:32:14</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46424">
    <title>[patch 09/10] esp: fix section mismatch warning</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46424</link>
    <description>From: Randy Dunlap &lt;randy.dunlap&lt; at &gt;oracle.com&gt;

Not critical.

WARNING: drivers/char/esp.o(.text+0x278): Section mismatch in reference from the function show_serial_version() to the variable .init.data:serial_version
The function show_serial_version() references
the variable __initdata serial_version.
This is often because show_serial_version lacks a __initdata
annotation or the annotation of serial_version is wrong.

WARNING: drivers/char/esp.o(.text+0x27d): Section mismatch in reference from the function show_serial_version() to the variable .init.data:serial_name
The function show_serial_version() references
the variable __initdata serial_name.
This is often because show_serial_version lacks a __initdata
annotation or the annotation of serial_name is wrong.

Signed-off-by: Randy Dunlap &lt;randy.dunlap&lt; at &gt;oracle.com&gt;
Cc: Andrew J. Robinson &lt;arobinso&lt; at &gt;nyx.net&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 drivers/char/esp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/char/esp.c~esp-fix-section-mismatch-warning drivers/char/esp.c
--- a/drivers/char/esp.c~esp-fix-section-mismatch-warning
+++ a/drivers/char/esp.c
&lt; at &gt;&lt; at &gt; -2258,7 +2258,7 &lt; at &gt;&lt; at &gt; static int esp_open(struct tty_struct *t
  * driver.
  */
 
-static void show_serial_version(void)
+static void __init show_serial_version(void)
 {
 printk(KERN_INFO "%s version %s (DMA %u)\n",
 serial_name, serial_version, dma);
_
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>akpm&lt; at &gt;linux-foundation.org</dc:creator>
    <dc:date>2008-12-01T22:32:15</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46423">
    <title>[patch 07/10] scsi: gdth.c use unaligned access helpers</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46423</link>
    <description>From: Harvey Harrison &lt;harvey.harrison&lt; at &gt;gmail.com&gt;

Remove two now unnecessary local vars.

Signed-off-by: Harvey Harrison &lt;harvey.harrison&lt; at &gt;gmail.com&gt;
Cc: Boaz Harrosh &lt;bharrosh&lt; at &gt;panasas.com&gt;
Cc: James Bottomley &lt;James.Bottomley&lt; at &gt;HansenPartnership.com&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 drivers/scsi/gdth.c |   23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff -puN drivers/scsi/gdth.c~scsi-gdthc-use-unaligned-access-helpers drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~scsi-gdthc-use-unaligned-access-helpers
+++ a/drivers/scsi/gdth.c
&lt; at &gt;&lt; at &gt; -131,6 +131,7 &lt; at &gt;&lt; at &gt;
 #include &lt;asm/system.h&gt;
 #include &lt;asm/io.h&gt;
 #include &lt;asm/uaccess.h&gt;
+#include &lt;asm/unaligned.h&gt;
 #include &lt;linux/spinlock.h&gt;
 #include &lt;linux/blkdev.h&gt;
 #include &lt;linux/scatterlist.h&gt;
&lt; at &gt;&lt; at &gt; -2429,8 +2430,8 &lt; at &gt;&lt; at &gt; static int gdth_fill_cache_cmd(gdth_ha_s
 {
     register gdth_cmd_str *cmdp;
     struct gdth_cmndinfo *cmndinfo = gdth_cmnd_priv(scp);
-    ulong32 cnt, blockcnt;
-    ulong64 no, blockno;
+    ulong32 blockcnt;
+    ulong64 blockno;
     int i, cmd_index, read_write, sgcnt, mode64;
 
     cmdp = ha-&gt;pccb;
&lt; at &gt;&lt; at &gt; -2498,19 +2499,15 &lt; at &gt;&lt; at &gt; static int gdth_fill_cache_cmd(gdth_ha_s
 
     if (read_write) {
         if (scp-&gt;cmd_len == 16) {
-            memcpy(&amp;no, &amp;scp-&gt;cmnd[2], sizeof(ulong64));
-            blockno = be64_to_cpu(no);
-            memcpy(&amp;cnt, &amp;scp-&gt;cmnd[10], sizeof(ulong32));
-            blockcnt = be32_to_cpu(cnt);
+blockno = get_unaligned_be64(&amp;scp-&gt;cmnd[2]);
+blockcnt = get_unaligned_be32(&amp;scp-&gt;cmnd[10]);
         } else if (scp-&gt;cmd_len == 10) {
-            memcpy(&amp;no, &amp;scp-&gt;cmnd[2], sizeof(ulong32));
-            blockno = be32_to_cpu(no);
-            memcpy(&amp;cnt, &amp;scp-&gt;cmnd[7], sizeof(ushort));
-            blockcnt = be16_to_cpu(cnt);
+blockno = get_unaligned_be32(&amp;scp-&gt;cmnd[2]);
+blockcnt = get_unaligned_be16(&amp;scp-&gt;cmnd[7]);
         } else {
-            memcpy(&amp;no, &amp;scp-&gt;cmnd[0], sizeof(ulong32));
-            blockno = be32_to_cpu(no) &amp; 0x001fffffUL;
-            blockcnt= scp-&gt;cmnd[4]==0 ? 0x100 : scp-&gt;cmnd[4];
+blockno = get_unaligned_be32(&amp;scp-&gt;cmnd[2]);
+blockno &amp;= 0x001fffffUL;
+blockcnt = scp-&gt;cmnd[4] == 0 ? 0x100 : scp-&gt;cmnd[4];
         }
         if (mode64) {
             cmdp-&gt;u.cache64.BlockNo = blockno;
_
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>akpm&lt; at &gt;linux-foundation.org</dc:creator>
    <dc:date>2008-12-01T22:32:13</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46422">
    <title>[patch 10/10] scsi: fix bad use of udelay in atp870u.c</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46422</link>
    <description>From: Martin Michlmayr &lt;tbm&lt; at &gt;cyrius.com&gt;

The ACARD driver calls udelay() with a value &gt; 2000, which leads to
to the following compilation error on ARM:
  ERROR: "__bad_udelay" [drivers/scsi/atp870u.ko] undefined!
  make[1]: *** [__modpost] Error 1
Fix this by using a combination of mdelay and udelay.

Signed-off-by: Martin Michlmayr &lt;tbm&lt; at &gt;cyrius.com&gt;
Cc: James Bottomley &lt;James.Bottomley&lt; at &gt;HansenPartnership.com&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 drivers/scsi/atp870u.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -puN drivers/scsi/atp870u.c~scsi-fix-bad-use-of-udelay-in-atp870uc drivers/scsi/atp870u.c
--- a/drivers/scsi/atp870u.c~scsi-fix-bad-use-of-udelay-in-atp870uc
+++ a/drivers/scsi/atp870u.c
&lt; at &gt;&lt; at &gt; -1171,7 +1171,8 &lt; at &gt;&lt; at &gt; wait_io1:
 outw(val, tmport);
 outb(2, 0x80);
 TCM_SYNC:
-udelay(0x800);
+mdelay(2);
+udelay(48);
 if ((inb(tmport) &amp; 0x80) == 0x00) {/* bsy ? */
 outw(0, tmport--);
 outb(0, tmport);
_
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>akpm&lt; at &gt;linux-foundation.org</dc:creator>
    <dc:date>2008-12-01T22:32:16</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.scsi/46421">
    <title>[patch 02/10] scsi: replace __inline with inline</title>
    <link>http://comments.gmane.org/gmane.linux.scsi/46421</link>
    <description>From: Harvey Harrison &lt;harvey.harrison&lt; at &gt;gmail.com&gt;

Signed-off-by: Harvey Harrison &lt;harvey.harrison&lt; at &gt;gmail.com&gt;
Cc: James Bottomley &lt;James.Bottomley&lt; at &gt;HansenPartnership.com&gt;
Acked-by: Jeff Garzik &lt;jgarzik&lt; at &gt;redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 drivers/scsi/aic7xxx/aic79xx_core.c   |   12 +-
 drivers/scsi/aic7xxx/aic79xx_inline.h |   32 +++----
 drivers/scsi/aic7xxx/aic79xx_osm.h    |  102 +++++++++++------------
 drivers/scsi/aic7xxx/aic79xx_pci.c    |    2 
 drivers/scsi/aic7xxx/aic7xxx_inline.h |    5 -
 drivers/scsi/aic7xxx/aic7xxx_osm.h    |  104 ++++++++++++------------
 drivers/scsi/aic7xxx/aic7xxx_pci.c    |    2 
 drivers/scsi/aic7xxx/aiclib.h         |    4 
 drivers/scsi/sym53c8xx_2/sym_glue.h   |    6 -
 drivers/scsi/sym53c8xx_2/sym_hipd.c   |    2 
 drivers/scsi/sym53c8xx_2/sym_hipd.h   |    6 -
 drivers/scsi/sym53c8xx_2/sym_malloc.c |    2 
 drivers/scsi/sym53c8xx_2/sym_misc.h   |   18 ++--
 13 files changed, 146 insertions(+), 151 deletions(-)

diff -puN drivers/scsi/aic7xxx/aic79xx_core.c~scsi-replace-__inline-with-inline drivers/scsi/aic7xxx/aic79xx_core.c
--- a/drivers/scsi/aic7xxx/aic79xx_core.c~scsi-replace-__inline-with-inline
+++ a/drivers/scsi/aic7xxx/aic79xx_core.c
&lt; at &gt;&lt; at &gt; -1034,7 +1034,7 &lt; at &gt;&lt; at &gt; ahd_intr(struct ahd_softc *ahd)
 }
 
 /******************************** Private Inlines *****************************/
-static __inline void
+static inline void
 ahd_assert_atn(struct ahd_softc *ahd)
 {
 ahd_outb(ahd, SCSISIGO, ATNO);
&lt; at &gt;&lt; at &gt; -1069,7 +1069,7 &lt; at &gt;&lt; at &gt; ahd_currently_packetized(struct ahd_soft
 return (packetized);
 }
 
-static __inline int
+static inline int
 ahd_set_active_fifo(struct ahd_softc *ahd)
 {
 u_int active_fifo;
&lt; at &gt;&lt; at &gt; -1086,7 +1086,7 &lt; at &gt;&lt; at &gt; ahd_set_active_fifo(struct ahd_softc *ah
 }
 }
 
-static __inline void
+static inline void
 ahd_unbusy_tcl(struct ahd_softc *ahd, u_int tcl)
 {
 ahd_busy_tcl(ahd, tcl, SCB_LIST_NULL);
&lt; at &gt;&lt; at &gt; -1096,7 +1096,7 &lt; at &gt;&lt; at &gt; ahd_unbusy_tcl(struct ahd_softc *ahd, u_
  * Determine whether the sequencer reported a residual
  * for this SCB/transaction.
  */
-static __inline void
+static inline void
 ahd_update_residual(struct ahd_softc *ahd, struct scb *scb)
 {
 uint32_t sgptr;
&lt; at &gt;&lt; at &gt; -1106,7 +1106,7 &lt; at &gt;&lt; at &gt; ahd_update_residual(struct ahd_softc *ah
 ahd_calc_residual(ahd, scb);
 }
 
-static __inline void
+static inline void
 ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb)
 {
 uint32_t sgptr;
&lt; at &gt;&lt; at &gt; -7987,7 +7987,7 &lt; at &gt;&lt; at &gt; ahd_resume(struct ahd_softc *ahd)
  * scbid that should be restored once manipualtion
  * of the TCL entry is complete.
  */
-static __inline u_int
+static inline u_int
 ahd_index_busy_tcl(struct ahd_softc *ahd, u_int *saved_scbid, u_int tcl)
 {
 /*
diff -puN drivers/scsi/aic7xxx/aic79xx_inline.h~scsi-replace-__inline-with-inline drivers/scsi/aic7xxx/aic79xx_inline.h
--- a/drivers/scsi/aic7xxx/aic79xx_inline.h~scsi-replace-__inline-with-inline
+++ a/drivers/scsi/aic7xxx/aic79xx_inline.h
&lt; at &gt;&lt; at &gt; -46,21 +46,20 &lt; at &gt;&lt; at &gt;
 #define _AIC79XX_INLINE_H_
 
 /******************************** Debugging ***********************************/
-static __inline char *ahd_name(struct ahd_softc *ahd);
+static inline char *ahd_name(struct ahd_softc *ahd);
 
-static __inline char *
-ahd_name(struct ahd_softc *ahd)
+static inline char *ahd_name(struct ahd_softc *ahd)
 {
 return (ahd-&gt;name);
 }
 
 /************************ Sequencer Execution Control *************************/
-static __inline void ahd_known_modes(struct ahd_softc *ahd,
+static inline void ahd_known_modes(struct ahd_softc *ahd,
      ahd_mode src, ahd_mode dst);
-static __inline ahd_mode_state ahd_build_mode_state(struct ahd_softc *ahd,
+static inline ahd_mode_state ahd_build_mode_state(struct ahd_softc *ahd,
     ahd_mode src,
     ahd_mode dst);
-static __inline void ahd_extract_mode_state(struct ahd_softc *ahd,
+static inline void ahd_extract_mode_state(struct ahd_softc *ahd,
     ahd_mode_state state,
     ahd_mode *src, ahd_mode *dst);
 
&lt; at &gt;&lt; at &gt; -73,7 +72,7 &lt; at &gt;&lt; at &gt; int  ahd_is_paused(struct ahd_softc *ahd
 void ahd_pause(struct ahd_softc *ahd);
 void ahd_unpause(struct ahd_softc *ahd);
 
-static __inline void
+static inline void
 ahd_known_modes(struct ahd_softc *ahd, ahd_mode src, ahd_mode dst)
 {
 ahd-&gt;src_mode = src;
&lt; at &gt;&lt; at &gt; -82,13 +81,13 &lt; at &gt;&lt; at &gt; ahd_known_modes(struct ahd_softc *ahd, a
 ahd-&gt;saved_dst_mode = dst;
 }
 
-static __inline ahd_mode_state
+static inline ahd_mode_state
 ahd_build_mode_state(struct ahd_softc *ahd, ahd_mode src, ahd_mode dst)
 {
 return ((src &lt;&lt; SRC_MODE_SHIFT) | (dst &lt;&lt; DST_MODE_SHIFT));
 }
 
-static __inline void
+static inline void
 ahd_extract_mode_state(struct ahd_softc *ahd, ahd_mode_state state,
        ahd_mode *src, ahd_mode *dst)
 {
&lt; at &gt;&lt; at &gt; -102,13 +101,12 &lt; at &gt;&lt; at &gt; void*ahd_sg_setup(struct ahd_softc *ahd
       bus_size_t len, int last);
 
 /************************** Memory mapping routines ***************************/
-static __inline size_tahd_sg_size(struct ahd_softc *ahd);
+static inline size_tahd_sg_size(struct ahd_softc *ahd);
 
 voidahd_sync_sglist(struct ahd_softc *ahd,
 struct scb *scb, int op);
 
-static __inline size_t
-ahd_sg_size(struct ahd_softc *ahd)
+static inline size_t ahd_sg_size(struct ahd_softc *ahd)
 {
 if ((ahd-&gt;flags &amp; AHD_64BIT_ADDRESSING) != 0)
 return (sizeof(struct ahd_dma64_seg));
&lt; at &gt;&lt; at &gt; -141,11 +139,9 &lt; at &gt;&lt; at &gt; struct scb *
 ahd_lookup_scb(struct ahd_softc *ahd, u_int tag);
 voidahd_queue_scb(struct ahd_softc *ahd, struct scb *scb);
 
-static __inline uint8_t *
-ahd_get_sense_buf(struct ahd_softc *ahd,
+static inline uint8_t *ahd_get_sense_buf(struct ahd_softc *ahd,
   struct scb *scb);
-static __inline uint32_t
-ahd_get_sense_bufaddr(struct ahd_softc *ahd,
+static inline uint32_t ahd_get_sense_bufaddr(struct ahd_softc *ahd,
       struct scb *scb);
 
 #if 0 /* unused */
&lt; at &gt;&lt; at &gt; -158,13 +154,13 &lt; at &gt;&lt; at &gt; do {\
 
 #endif
 
-static __inline uint8_t *
+static inline uint8_t *
 ahd_get_sense_buf(struct ahd_softc *ahd, struct scb *scb)
 {
 return (scb-&gt;sense_data);
 }
 
-static __inline uint32_t
+static inline uint32_t
 ahd_get_sense_bufaddr(struct ahd_softc *ahd, struct scb *scb)
 {
 return (scb-&gt;sense_busaddr);
diff -puN drivers/scsi/aic7xxx/aic79xx_osm.h~scsi-replace-__inline-with-inline drivers/scsi/aic7xxx/aic79xx_osm.h
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h~scsi-replace-__inline-with-inline
+++ a/drivers/scsi/aic7xxx/aic79xx_osm.h
&lt; at &gt;&lt; at &gt; -395,19 +395,19 &lt; at &gt;&lt; at &gt; struct info_str {
 };
 
 /******************************** Locking *************************************/
-static __inline void
+static inline void
 ahd_lockinit(struct ahd_softc *ahd)
 {
 spin_lock_init(&amp;ahd-&gt;platform_data-&gt;spin_lock);
 }
 
-static __inline void
+static inline void
 ahd_lock(struct ahd_softc *ahd, unsigned long *flags)
 {
 spin_lock_irqsave(&amp;ahd-&gt;platform_data-&gt;spin_lock, *flags);
 }
 
-static __inline void
+static inline void
 ahd_unlock(struct ahd_softc *ahd, unsigned long *flags)
 {
 spin_unlock_irqrestore(&amp;ahd-&gt;platform_data-&gt;spin_lock, *flags);
&lt; at &gt;&lt; at &gt; -490,29 +490,29 &lt; at &gt;&lt; at &gt; void ahd_pci_write_config(ahd_dev_sof
   int reg, uint32_t value,
   int width);
 
-static __inline int ahd_get_pci_function(ahd_dev_softc_t);
-static __inline int
+static inline int ahd_get_pci_function(ahd_dev_softc_t);
+static inline int
 ahd_get_pci_function(ahd_dev_softc_t pci)
 {
 return (PCI_FUNC(pci-&gt;devfn));
 }
 
-static __inline int ahd_get_pci_slot(ahd_dev_softc_t);
-static __inline int
+static inline int ahd_get_pci_slot(ahd_dev_softc_t);
+static inline int
 ahd_get_pci_slot(ahd_dev_softc_t pci)
 {
 return (PCI_SLOT(pci-&gt;devfn));
 }
 
-static __inline int ahd_get_pci_bus(ahd_dev_softc_t);
-static __inline int
+static inline int ahd_get_pci_bus(ahd_dev_softc_t);
+static inline int
 ahd_get_pci_bus(ahd_dev_softc_t pci)
 {
 return (pci-&gt;bus-&gt;number);
 }
 
-static __inline void ahd_flush_device_writes(struct ahd_softc *);
-static __inline void
+static inline void ahd_flush_device_writes(struct ahd_softc *);
+static inline void
 ahd_flush_device_writes(struct ahd_softc *ahd)
 {
 /* XXX Is this sufficient for all architectures??? */
&lt; at &gt;&lt; at &gt; -524,81 +524,81 &lt; at &gt;&lt; at &gt; intahd_linux_proc_info(struct Scsi_Host
     off_t, int, int);
 
 /*********************** Transaction Access Wrappers **************************/
-static __inline void ahd_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t);
-static __inline void ahd_set_transaction_status(struct scb *, uint32_t);
-static __inline void ahd_cmd_set_scsi_status(struct scsi_cmnd *, uint32_t);
-static __inline void ahd_set_scsi_status(struct scb *, uint32_t);
-static __inline uint32_t ahd_cmd_get_transaction_status(struct scsi_cmnd *cmd);
-static __inline uint32_t ahd_get_transaction_status(struct scb *);
-static __inline uint32_t ahd_cmd_get_scsi_status(struct scsi_cmnd *cmd);
-static __inline uint32_t ahd_get_scsi_status(struct scb *);
-static __inline void ahd_set_transaction_tag(struct scb *, int, u_int);
-static __inline u_long ahd_get_transfer_length(struct scb *);
-static __inline int ahd_get_transfer_dir(struct scb *);
-static __inline void ahd_set_residual(struct scb *, u_long);
-static __inline void ahd_set_sense_residual(struct scb *scb, u_long resid);
-static __inline u_long ahd_get_residual(struct scb *);
-static __inline u_long ahd_get_sense_residual(struct scb *);
-static __inline int ahd_perform_autosense(struct scb *);
-static __inline uint32_t ahd_get_sense_bufsize(struct ahd_softc *,
+static inline void ahd_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t);
+static inline void ahd_set_transaction_status(struct scb *, uint32_t);
+static inline void ahd_cmd_set_scsi_status(struct scsi_cmnd *, uint32_t);
+static inline void ahd_set_scsi_status(struct scb *, uint32_t);
+static inline uint32_t ahd_cmd_get_transaction_status(struct scsi_cmnd *cmd);
+static inline uint32_t ahd_get_transaction_status(struct scb *);
+static inline uint32_t ahd_cmd_get_scsi_status(struct scsi_cmnd *cmd);
+static inline uint32_t ahd_get_scsi_status(struct scb *);
+static inline void ahd_set_transaction_tag(struct scb *, int, u_int);
+static inline u_long ahd_get_transfer_length(struct scb *);
+static inline int ahd_get_transfer_dir(struct scb *);
+static inline void ahd_set_residual(struct scb *, u_long);
+static inline void ahd_set_sense_residual(struct scb *scb, u_long resid);
+static inline u_long ahd_get_residual(struct scb *);
+static inline u_long ahd_get_sense_residual(struct scb *);
+static inline int ahd_perform_autosense(struct scb *);
+static inline uint32_t ahd_get_sense_bufsize(struct ahd_softc *,
        struct scb *);
-static __inline void ahd_notify_xfer_settings_change(struct ahd_softc *,
+static inline void ahd_notify_xfer_settings_change(struct ahd_softc *,
      struct ahd_devinfo *);
-static __inline void ahd_platform_scb_free(struct ahd_softc *ahd,
+static inline void ahd_platform_scb_free(struct ahd_softc *ahd,
    struct scb *scb);
-static __inline void ahd_freeze_scb(struct scb *scb);
+static inline void ahd_freeze_scb(struct scb *scb);
 
-static __inline
+static inline
 void ahd_cmd_set_transaction_status(struct scsi_cmnd *cmd, uint32_t status)
 {
 cmd-&gt;result &amp;= ~(CAM_STATUS_MASK &lt;&lt; 16);
 cmd-&gt;result |= status &lt;&lt; 16;
 }
 
-static __inline
+static inline
 void ahd_set_transaction_status(struct scb *scb, uint32_t status)
 {
 ahd_cmd_set_transaction_status(scb-&gt;io_ctx,status);
 }
 
-static __inline
+static inline
 void ahd_cmd_set_scsi_status(struct scsi_cmnd *cmd, uint32_t status)
 {
 cmd-&gt;result &amp;= ~0xFFFF;
 cmd-&gt;result |= status;
 }
 
-static __inline
+static inline
 void ahd_set_scsi_status(struct scb *scb, uint32_t status)
 {
 ahd_cmd_set_scsi_status(scb-&gt;io_ctx, status);
 }
 
-static __inline
+static inline
 uint32_t ahd_cmd_get_transaction_status(struct scsi_cmnd *cmd)
 {
 return ((cmd-&gt;result &gt;&gt; 16) &amp; CAM_STATUS_MASK);
 }
 
-static __inline
+static inline
 uint32_t ahd_get_transaction_status(struct scb *scb)
 {
 return (ahd_cmd_get_transaction_status(scb-&gt;io_ctx));
 }
 
-static __inline
+static inline
 uint32_t ahd_cmd_get_scsi_status(struct scsi_cmnd *cmd)
 {
 return (cmd-&gt;result &amp; 0xFFFF);
 }
 
-static __inline
+static inline
 uint32_t ahd_get_scsi_status(struct scb *scb)
 {
 return (ahd_cmd_get_scsi_status(scb-&gt;io_ctx));
 }
 
-static __inline
+static inline
 void ahd_set_transaction_tag(struct scb *scb, int enabled, u_int type)
 {
 /*
&lt; at &gt;&lt; at &gt; -607,43 +607,43 &lt; at &gt;&lt; at &gt; void ahd_set_transaction_tag(struct scb 
  */
 }
 
-static __inline
+static inline
 u_long ahd_get_transfer_length(struct scb *scb)
 {
 return (scb-&gt;platform_data-&gt;xfer_len);
 }
 
-static __inline
+static inline
 int ahd_get_transfer_dir(struct scb *scb)
 {
 return (scb-&gt;io_ctx-&gt;sc_data_direction);
 }
 
-static __inline
+static inline
 void ahd_set_residual(struct scb *scb, u_long resid)
 {
 scsi_set_resid(scb-&gt;io_ctx, resid);
 }
 
-static __inline
+static inline
 void ahd_set_sense_residual(struct scb *scb, u_long resid)
 {
 scb-&gt;platform_data-&gt;sense_resid = resid;
 }
 
-static __inline
+static inline
 u_long ahd_get_residual(struct scb *scb)
 {
 return scsi_get_resid(scb-&gt;io_ctx);
 }
 
-static __inline
+static inline
 u_long ahd_get_sense_residual(struct scb *scb)
 {
 return (scb-&gt;platform_data-&gt;sense_resid);
 }
 
-static __inline
+static inline
 int ahd_perform_autosense(struct scb *scb)
 {
 /*
&lt; at &gt;&lt; at &gt; -654,20 +654,20 &lt; at &gt;&lt; at &gt; int ahd_perform_autosense(struct scb *sc
 return (1);
 }
 
-static __inline uint32_t
+static inline uint32_t
 ahd_get_sense_bufsize(struct ahd_softc *ahd, struct scb *scb)
 {
 return (sizeof(struct scsi_sense_data));
 }
 
-static __inline void
+static inline void
 ahd_notify_xfer_settings_change(struct ahd_softc *ahd,
 struct ahd_devinfo *devinfo)
 {
 /* Nothing to do here for linux */
 }
 
-static __inline void
+static inline void
 ahd_platform_scb_free(struct ahd_softc *ahd, struct scb *scb)
 {
 ahd-&gt;flags &amp;= ~AHD_RESOURCE_SHORTAGE;
&lt; at &gt;&lt; at &gt; -678,7 +678,7 &lt; at &gt;&lt; at &gt; voidahd_platform_free(struct ahd_softc 
 voidahd_platform_init(struct ahd_softc *ahd);
 voidahd_platform_freeze_devq(struct ahd_softc *ahd, struct scb *scb);
 
-static __inline void
+static inline void
 ahd_freeze_scb(struct scb *scb)
 {
 if ((scb-&gt;io_ctx-&gt;result &amp; (CAM_DEV_QFRZN &lt;&lt; 16)) == 0) {
diff -puN drivers/scsi/aic7xxx/aic79xx_pci.c~scsi-replace-__inline-with-inline drivers/scsi/aic7xxx/aic79xx_pci.c
--- a/drivers/scsi/aic7xxx/aic79xx_pci.c~scsi-replace-__inline-with-inline
+++ a/drivers/scsi/aic7xxx/aic79xx_pci.c
&lt; at &gt;&lt; at &gt; -51,7 +51,7 &lt; at &gt;&lt; at &gt;
 
 #include "aic79xx_pci.h"
 
-static __inline uint64_t
+static inline uint64_t
 ahd_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
 {
 uint64_t id;
diff -puN drivers/scsi/aic7xxx/aic7xxx_inline.h~scsi-replace-__inline-with-inline drivers/scsi/aic7xxx/aic7xxx_inline.h
--- a/drivers/scsi/aic7xxx/aic7xxx_inline.h~scsi-replace-__inline-with-inline
+++ a/drivers/scsi/aic7xxx/aic7xxx_inline.h
&lt; at &gt;&lt; at &gt; -55,10 +55,9 &lt; at &gt;&lt; at &gt; voidahc_sync_sglist(struct ahc_softc *a
 struct scb *scb, int op);
 
 /******************************** Debugging ***********************************/
-static __inline char *ahc_name(struct ahc_softc *ahc);
+static inline char *ahc_name(struct ahc_softc *ahc);
 
-static __inline char *
-ahc_name(struct ahc_softc *ahc)
+static inline char *ahc_name(struct ahc_softc *ahc)
 {
 return (ahc-&gt;name);
 }
diff -puN drivers/scsi/aic7xxx/aic7xxx_osm.h~scsi-replace-__inline-with-inline drivers/scsi/aic7xxx/aic7xxx_osm.h
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.h~scsi-replace-__inline-with-inline
+++ a/drivers/scsi/aic7xxx/aic7xxx_osm.h
&lt; at &gt;&lt; at &gt; -230,7 +230,7 &lt; at &gt;&lt; at &gt; intahc_dmamap_unload(struct ahc_softc *
 #include "aic7xxx.h"
 
 /***************************** Timer Facilities *******************************/
-static __inline void
+static inline void
 ahc_scb_timer_reset(struct scb *scb, u_int usec)
 {
 }
&lt; at &gt;&lt; at &gt; -401,19 +401,19 &lt; at &gt;&lt; at &gt; struct info_str {
 /******************************** Locking *************************************/
 /* Lock protecting internal data structures */
 
-static __inline void
+static inline void
 ahc_lockinit(struct ahc_softc *ahc)
 {
 spin_lock_init(&amp;ahc-&gt;platform_data-&gt;spin_lock);
 }
 
-static __inline void
+static inline void
 ahc_lock(struct ahc_softc *ahc, unsigned long *flags)
 {
 spin_lock_irqsave(&amp;ahc-&gt;platform_data-&gt;spin_lock, *flags);
 }
 
-static __inline void
+static inline void
 ahc_unlock(struct ahc_softc *ahc, unsigned long *flags)
 {
 spin_unlock_irqrestore(&amp;ahc-&gt;platform_data-&gt;spin_lock, *flags);
&lt; at &gt;&lt; at &gt; -493,22 +493,22 &lt; at &gt;&lt; at &gt; void ahc_pci_write_config(ahc_dev_sof
       int reg, uint32_t value,
       int width);
 
-static __inline int ahc_get_pci_function(ahc_dev_softc_t);
-static __inline int
+static inline int ahc_get_pci_function(ahc_dev_softc_t);
+static inline int
 ahc_get_pci_function(ahc_dev_softc_t pci)
 {
 return (PCI_FUNC(pci-&gt;devfn));
 }
 
-static __inline int ahc_get_pci_slot(ahc_dev_softc_t);
-static __inline int
+static inline int ahc_get_pci_slot(ahc_dev_softc_t);
+static inline int
 ahc_get_pci_slot(ahc_dev_softc_t pci)
 {
 return (PCI_SLOT(pci-&gt;devfn));
 }
 
-static __inline int ahc_get_pci_bus(ahc_dev_softc_t);
-static __inline int
+static inline int ahc_get_pci_bus(ahc_dev_softc_t);
+static inline int
 ahc_get_pci_bus(ahc_dev_softc_t pci)
 {
 return (pci-&gt;bus-&gt;number);
&lt; at &gt;&lt; at &gt; -521,8 +521,8 &lt; at &gt;&lt; at &gt; static inline void ahc_linux_pci_exit(vo
 }
 #endif
 
-static __inline void ahc_flush_device_writes(struct ahc_softc *);
-static __inline void
+static inline void ahc_flush_device_writes(struct ahc_softc *);
+static inline void
 ahc_flush_device_writes(struct ahc_softc *ahc)
 {
 /* XXX Is this sufficient for all architectures??? */
&lt; at &gt;&lt; at &gt; -535,81 +535,81 &lt; at &gt;&lt; at &gt; intahc_linux_proc_info(struct Scsi_Host
 
 /*************************** Domain Validation ********************************/
 /*********************** Transaction Access Wrappers *************************/
-static __inline void ahc_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t);
-static __inline void ahc_set_transaction_status(struct scb *, uint32_t);
-static __inline void ahc_cmd_set_scsi_status(struct scsi_cmnd *, uint32_t);
-static __inline void ahc_set_scsi_status(struct scb *, uint32_t);
-static __inline uint32_t ahc_cmd_get_transaction_status(struct scsi_cmnd *cmd);
-static __inline uint32_t ahc_get_transaction_status(struct scb *);
-static __inline uint32_t ahc_cmd_get_scsi_status(struct scsi_cmnd *cmd);
-static __inline uint32_t ahc_get_scsi_status(struct scb *);
-static __inline void ahc_set_transaction_tag(struct scb *, int, u_int);
-static __inline u_long ahc_get_transfer_length(struct scb *);
-static __inline int ahc_get_transfer_dir(struct scb *);
-static __inline void ahc_set_residual(struct scb *, u_long);
-static __inline void ahc_set_sense_residual(struct scb *scb, u_long resid);
-static __inline u_long ahc_get_residual(struct scb *);
-static __inline u_long ahc_get_sense_residual(struct scb *);
-static __inline int ahc_perform_autosense(struct scb *);
-static __inline uint32_t ahc_get_sense_bufsize(struct ahc_softc *,
+static inline void ahc_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t);
+static inline void ahc_set_transaction_status(struct scb *, uint32_t);
+static inline void ahc_cmd_set_scsi_status(struct scsi_cmnd *, uint32_t);
+static inline void ahc_set_scsi_status(struct scb *, uint32_t);
+static inline uint32_t ahc_cmd_get_transaction_status(struct scsi_cmnd *cmd);
+static inline uint32_t ahc_get_transaction_status(struct scb *);
+static inline uint32_t ahc_cmd_get_scsi_status(struct scsi_cmnd *cmd);
+static inline uint32_t ahc_get_scsi_status(struct scb *);
+static inline void ahc_set_transaction_tag(struct scb *, int, u_int);
+static inline u_long ahc_get_transfer_length(struct scb *);
+static inline int ahc_get_transfer_dir(struct scb *);
+static inline void ahc_set_residual(struct scb *, u_long);
+static inline void ahc_set_sense_residual(struct scb *scb, u_long resid);
+static inline u_long ahc_get_residual(struct scb *);
+static inline u_long ahc_get_sense_residual(struct scb *);
+static inline int ahc_perform_autosense(struct scb *);
+static inline uint32_t ahc_get_sense_bufsize(struct ahc_softc *,
        struct scb *);
-static __inline void ahc_notify_xfer_settings_change(struct ahc_softc *,
+static inline void ahc_notify_xfer_settings_change(struct ahc_softc *,
      struct ahc_devinfo *);
-static __inline void ahc_platform_scb_free(struct ahc_softc *ahc,
+static inline void ahc_platform_scb_free(struct ahc_softc *ahc,
    struct scb *scb);
-static __inline void ahc_freeze_scb(struct scb *scb);
+static inline void ahc_freeze_scb(struct scb *scb);
 
-static __inline
+static inline
 void ahc_cmd_set_transaction_status(struct scsi_cmnd *cmd, uint32_t status)
 {
 cmd-&gt;result &amp;= ~(CAM_STATUS_MASK &lt;&lt; 16);
 cmd-&gt;result |= status &lt;&lt; 16;
 }
 
-static __inline
+static inline
 void ahc_set_transaction_status(struct scb *scb, uint32_t status)
 {
 ahc_cmd_set_transaction_status(scb-&gt;io_ctx,status);
 }
 
-static __inline
+static inline
 void ahc_cmd_set_scsi_status(struct scsi_cmnd *cmd, uint32_t status)
 {
 cmd-&gt;result &amp;= ~0xFFFF;
 cmd-&gt;result |= status;
 }
 
-static __inline
+static inline
 void ahc_set_scsi_status(struct scb *scb, uint32_t status)
 {
 ahc_cmd_set_scsi_status(scb-&gt;io_ctx, status);
 }
 
-static __inline
+static inline
 uint32_t ahc_cmd_get_transaction_status(struct scsi_cmnd *cmd)
 {
 return ((cmd-&gt;result &gt;&gt; 16) &amp; CAM_STATUS_MASK);
 }
 
-static __inline
+static inline
 uint32_t ahc_get_transaction_status(struct scb *scb)
 {
 return (ahc_cmd_get_transaction_status(scb-&gt;io_ctx));
 }
 
-static __inline
+static inline
 uint32_t ahc_cmd_get_scsi_status(struct scsi_cmnd *cmd)
 {
 return (cmd-&gt;result &amp; 0xFFFF);
 }
 
-static __inline
+static inline
 uint32_t ahc_get_scsi_status(struct scb *scb)
 {
 return (ahc_cmd_get_scsi_status(scb-&gt;io_ctx));
 }
 
-static __inline
+static inline
 void ahc_set_transaction_tag(struct scb *scb, int enabled, u_int type)
 {
 /*
&lt; at &gt;&lt; at &gt; -618,43 +618,43 &lt; at &gt;&lt; at &gt; void ahc_set_transaction_tag(struct scb 
  */
 }
 
-static __inline
+static inline
 u_long ahc_get_transfer_length(struct scb *scb)
 {
 return (scb-&gt;platform_data-&gt;xfer_len);
 }
 
-static __inline
+static inline
 int ahc_get_transfer_dir(struct scb *scb)
 {
 return (scb-&gt;io_ctx-&gt;sc_data_direction);
 }
 
-static __inline
+static inline
 void ahc_set_residual(struct scb *scb, u_long resid)
 {
 scsi_set_resid(scb-&gt;io_ctx, resid);
 }
 
-static __inline
+static inline
 void ahc_set_sense_residual(struct scb *scb, u_long resid)
 {
 scb-&gt;platform_data-&gt;sense_resid = resid;
 }
 
-static __inline
+static inline
 u_long ahc_get_residual(struct scb *scb)
 {
 return scsi_get_resid(scb-&gt;io_ctx);
 }
 
-static __inline
+static inline
 u_long ahc_get_sense_residual(struct scb *scb)
 {
 return (scb-&gt;platform_data-&gt;sense_resid);
 }
 
-static __inline
+static inline
 int ahc_perform_autosense(struct scb *scb)
 {
 /*
&lt; at &gt;&lt; at &gt; -665,20 +665,20 &lt; at &gt;&lt; at &gt; int ahc_perform_autosense(struct scb *sc
 return (1);
 }
 
-static __inline uint32_t
+static inline uint32_t
 ahc_get_sense_bufsize(struct ahc_softc *ahc, struct scb *scb)
 {
 return (sizeof(struct scsi_sense_data));
 }
 
-static __inline void
+static inline void
 ahc_notify_xfer_settings_change(struct ahc_softc *ahc,
 struct ahc_devinfo *devinfo)
 {
 /* Nothing to do here for linux */
 }
 
-static __inline void
+static inline void
 ahc_platform_scb_free(struct ahc_softc *ahc, struct scb *scb)
 {
 }
&lt; at &gt;&lt; at &gt; -687,7 +687,7 &lt; at &gt;&lt; at &gt; intahc_platform_alloc(struct ahc_softc 
 voidahc_platform_free(struct ahc_softc *ahc);
 voidahc_platform_freeze_devq(struct ahc_softc *ahc, struct scb *scb);
 
-static __inline void
+static inline void
 ahc_freeze_scb(struct scb *scb)
 {
 if ((scb-&gt;io_ctx-&gt;result &amp; (CAM_DEV_QFRZN &lt;&lt; 16)) == 0) {
diff -puN drivers/scsi/aic7xxx/aic7xxx_pci.c~scsi-replace-__inline-with-inline drivers/scsi/aic7xxx/aic7xxx_pci.c
--- a/drivers/scsi/aic7xxx/aic7xxx_pci.c~scsi-replace-__inline-with-inline
+++ a/drivers/scsi/aic7xxx/aic7xxx_pci.c
&lt; at &gt;&lt; at &gt; -54,7 +54,7 &lt; at &gt;&lt; at &gt;
 
 #include "aic7xxx_pci.h"
 
-static __inline uint64_t
+static inline uint64_t
 ahc_compose_id(u_int device, u_int vendor, u_int subdevice, u_int subvendor)
 {
 uint64_t id;
diff -puN drivers/scsi/aic7xxx/aiclib.h~scsi-replace-__inline-with-inline drivers/scsi/aic7xxx/aiclib.h
--- a/drivers/scsi/aic7xxx/aiclib.h~scsi-replace-__inline-with-inline
+++ a/drivers/scsi/aic7xxx/aiclib.h
&lt; at &gt;&lt; at &gt; -133,7 +133,7 &lt; at &gt;&lt; at &gt; struct scsi_sense_data
 #define SCSI_STATUS_TASK_ABORTED0x40
 
 /************************* Large Disk Handling ********************************/
-static __inline int
+static inline int
 aic_sector_div(sector_t capacity, int heads, int sectors)
 {
 /* ugly, ugly sector_div calling convention.. */
&lt; at &gt;&lt; at &gt; -141,7 +141,7 &lt; at &gt;&lt; at &gt; aic_sector_div(sector_t capacity, int he
 return (int)capacity;
 }
 
-static __inline uint32_t
+static inline uint32_t
 scsi_4btoul(uint8_t *bytes)
 {
 uint32_t rv;
diff -puN drivers/scsi/sym53c8xx_2/sym_glue.h~scsi-replace-__inline-with-inline drivers/scsi/sym53c8xx_2/sym_glue.h
--- a/drivers/scsi/sym53c8xx_2/sym_glue.h~scsi-replace-__inline-with-inl