[PATCH] move ->eh_strategy_handler to the transport class
authorChristoph Hellwig <hch@lst.de>
Sat, 1 Apr 2006 17:21:04 +0000 (19:21 +0200)
committerJeff Garzik <jeff@garzik.org>
Mon, 10 Apr 2006 18:15:47 +0000 (14:15 -0400)
Overriding the whole EH code is a per-transport, not per-host thing.
Move ->eh_strategy_handler to the transport class, same as
->eh_timed_out.

Downside is that scsi_host_alloc can't check for the total lack of EH
anymore, but the transition period from old EH where we needed it is
long gone already.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
26 files changed:
Documentation/DocBook/libata.tmpl
Documentation/scsi/scsi_eh.txt
Documentation/scsi/scsi_mid_low_api.txt
drivers/scsi/ahci.c
drivers/scsi/ata_piix.c
drivers/scsi/hosts.c
drivers/scsi/libata-core.c
drivers/scsi/libata-scsi.c
drivers/scsi/libata.h
drivers/scsi/pdc_adma.c
drivers/scsi/sata_mv.c
drivers/scsi/sata_nv.c
drivers/scsi/sata_promise.c
drivers/scsi/sata_qstor.c
drivers/scsi/sata_sil.c
drivers/scsi/sata_sil24.c
drivers/scsi/sata_sis.c
drivers/scsi/sata_svw.c
drivers/scsi/sata_sx4.c
drivers/scsi/sata_uli.c
drivers/scsi/sata_via.c
drivers/scsi/sata_vsc.c
drivers/scsi/scsi_error.c
include/linux/libata.h
include/scsi/scsi_host.h
include/scsi/scsi_transport.h

index 5bcbb6ee3bc03cf1632bd345a7b28bc2a610e033..f869b03929db44fa6a5c391bf9d1fd09a4e7ea0d 100644 (file)
@@ -705,7 +705,7 @@ and other resources, etc.
 
        <sect1><title>ata_scsi_error()</title>
        <para>
-       ata_scsi_error() is the current hostt->eh_strategy_handler()
+       ata_scsi_error() is the current transportt->eh_strategy_handler()
        for libata.  As discussed above, this will be entered in two
        cases - timeout and ATAPI error completion.  This function
        calls low level libata driver's eng_timeout() callback, the
index 331afd791cbb474f774d10a008493459cce77886..ce767b90bb0dd288118fbee62df7176fcc9260fd 100644 (file)
@@ -19,9 +19,9 @@ TABLE OF CONTENTS
        [2-1-1] Overview
        [2-1-2] Flow of scmds through EH
        [2-1-3] Flow of control
-    [2-2] EH through hostt->eh_strategy_handler()
-       [2-2-1] Pre hostt->eh_strategy_handler() SCSI midlayer conditions
-       [2-2-2] Post hostt->eh_strategy_handler() SCSI midlayer conditions
+    [2-2] EH through transportt->eh_strategy_handler()
+       [2-2-1] Pre transportt->eh_strategy_handler() SCSI midlayer conditions
+       [2-2-2] Post transportt->eh_strategy_handler() SCSI midlayer conditions
        [2-2-3] Things to consider
 
 
@@ -413,9 +413,9 @@ scmd->allowed.
            layer of failure of the scmds.
 
 
-[2-2] EH through hostt->eh_strategy_handler()
+[2-2] EH through transportt->eh_strategy_handler()
 
hostt->eh_strategy_handler() is invoked in the place of
transportt->eh_strategy_handler() is invoked in the place of
 scsi_unjam_host() and it is responsible for whole recovery process.
 On completion, the handler should have made lower layers forget about
 all failed scmds and either ready for new commands or offline.  Also,
@@ -424,7 +424,7 @@ SCSI midlayer.  IOW, of the steps described in [2-1-2], all steps
 except for #1 must be implemented by eh_strategy_handler().
 
 
-[2-2-1] Pre hostt->eh_strategy_handler() SCSI midlayer conditions
+[2-2-1] Pre transportt->eh_strategy_handler() SCSI midlayer conditions
 
  The following conditions are true on entry to the handler.
 
@@ -437,7 +437,7 @@ except for #1 must be implemented by eh_strategy_handler().
  - shost->host_failed == shost->host_busy
 
 
-[2-2-2] Post hostt->eh_strategy_handler() SCSI midlayer conditions
+[2-2-2] Post transportt->eh_strategy_handler() SCSI midlayer conditions
 
  The following conditions must be true on exit from the handler.
 
index 8bbae3e1abdfa1c1a35f9c00f4b118cae9afdbf2..75a535a975c361986b40aa881cda3a49997455ae 100644 (file)
@@ -804,7 +804,6 @@ Summary:
    eh_bus_reset_handler - issue SCSI bus reset
    eh_device_reset_handler - issue SCSI device reset
    eh_host_reset_handler - reset host (host bus adapter)
-   eh_strategy_handler - driver supplied alternate to scsi_unjam_host()
    info - supply information about given host
    ioctl - driver can respond to ioctls
    proc_info - supports /proc/scsi/{driver_name}/{host_no}
@@ -969,24 +968,6 @@ Details:
      int eh_host_reset_handler(struct scsi_cmnd * scp)
 
 
-/**
- *      eh_strategy_handler - driver supplied alternate to scsi_unjam_host()
- *      @shp: host on which error has occurred
- *
- *      Returns TRUE if host unjammed, else FALSE.
- *
- *      Locks: none
- *
- *      Calling context: kernel thread
- *
- *      Notes: Invoked from scsi_eh thread. LLD supplied alternate to 
- *      scsi_unjam_host() found in scsi_error.c
- *
- *      Optionally defined in: LLD
- **/
-     int eh_strategy_handler(struct Scsi_Host * shp)
-
-
 /**
  *      info - supply information about given host: driver name plus data
  *             to distinguish given host
index 1bd82c4e52a0da80d1939a3b92ccce98fb222bf1..b4f8fb1d628b9d95ec70a28ffb81008eefb8f4d0 100644 (file)
@@ -207,7 +207,6 @@ static struct scsi_host_template ahci_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = AHCI_MAX_SG,
index 24e71b5551722221a7c8a2ee86b66a04f2b08ecb..6dc88149f9f1537e0e20b708696a2949f053bac2 100644 (file)
@@ -209,7 +209,6 @@ static struct scsi_host_template piix_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index ef57f253031c60043d6ac72d24697f46254a1c5c..dfcb96f3e60ce2782a39fffc415010ef54c272d0 100644 (file)
@@ -294,18 +294,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
        if (sht->unchecked_isa_dma && privsize)
                gfp_mask |= __GFP_DMA;
 
-        /* Check to see if this host has any error handling facilities */
-        if (!sht->eh_strategy_handler && !sht->eh_abort_handler &&
-           !sht->eh_device_reset_handler && !sht->eh_bus_reset_handler &&
-            !sht->eh_host_reset_handler) {
-               printk(KERN_ERR "ERROR: SCSI host `%s' has no error handling\n"
-                               "ERROR: This is not a safe way to run your "
-                                       "SCSI host\n"
-                               "ERROR: The error handling must be added to "
-                               "this driver\n", sht->proc_name);
-               dump_stack();
-        }
-
        shost = kzalloc(sizeof(struct Scsi_Host) + privsize, gfp_mask);
        if (!shost)
                return NULL;
index e63c1ff1e10256ed2b023341c098978a690ad0b8..bd147207f25d4ea8b216102f260b95911938e0d3 100644 (file)
@@ -4938,7 +4938,6 @@ EXPORT_SYMBOL_GPL(ata_busy_sleep);
 EXPORT_SYMBOL_GPL(ata_port_queue_task);
 EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
 EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
-EXPORT_SYMBOL_GPL(ata_scsi_error);
 EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
 EXPORT_SYMBOL_GPL(ata_scsi_release);
 EXPORT_SYMBOL_GPL(ata_host_intr);
index 53f5b0d9161c002c141d525c8fe3bae44a51b6af..a0289ec3e283bd532c802c05c5cba0958305828a 100644 (file)
@@ -53,6 +53,7 @@
 typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc, const u8 *scsicmd);
 static struct ata_device *
 ata_scsi_find_dev(struct ata_port *ap, const struct scsi_device *scsidev);
+static void ata_scsi_error(struct Scsi_Host *host);
 enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd);
 
 #define RW_RECOVERY_MPAGE 0x1
@@ -99,6 +100,7 @@ static const u8 def_control_mpage[CONTROL_MPAGE_LEN] = {
  * It just needs the eh_timed_out hook.
  */
 struct scsi_transport_template ata_scsi_transport_template = {
+       .eh_strategy_handler    = ata_scsi_error,
        .eh_timed_out           = ata_scsi_timed_out,
 };
 
@@ -772,12 +774,9 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
  *
  *     LOCKING:
  *     Inherited from SCSI layer (none, can sleep)
- *
- *     RETURNS:
- *     Zero.
  */
 
-int ata_scsi_error(struct Scsi_Host *host)
+static void ata_scsi_error(struct Scsi_Host *host)
 {
        struct ata_port *ap;
        unsigned long flags;
@@ -805,7 +804,6 @@ int ata_scsi_error(struct Scsi_Host *host)
        spin_unlock_irqrestore(&ap->host_set->lock, flags);
 
        DPRINTK("EXIT\n");
-       return 0;
 }
 
 static void ata_eh_scsidone(struct scsi_cmnd *scmd)
index 1c755b14521a9ecf71f228e202f8485983552917..bac8cbae06fe9a99aed6f996c230215881d34d3d 100644 (file)
@@ -60,7 +60,6 @@ extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
 extern struct scsi_transport_template ata_scsi_transport_template;
 
 extern void ata_scsi_scan_host(struct ata_port *ap);
-extern int ata_scsi_error(struct Scsi_Host *host);
 extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
                               unsigned int buflen);
 
index 3c85c4b66e195c2e3f7c169710cbf1fad945e55f..5cda16cfacb030be42d043761ba16d076e145e3d 100644 (file)
@@ -143,7 +143,6 @@ static struct scsi_host_template adma_ata_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index fa901fd650856e8f7b241ff5285bcc3ab84c4c6e..0ebf13668f51c211baf9a6fd272dcdf28522983e 100644 (file)
@@ -378,8 +378,6 @@ static struct scsi_host_template mv_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
-       .can_queue              = MV_USE_Q_DEPTH,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = MV_MAX_SG_CT / 2,
        .cmd_per_lun            = ATA_SHT_CMD_PER_LUN,
index f77bf183dfab81de3fbd3aa4f61140fa95b47fb7..9f553081b5e832525c8fde6fd33cea2c9058004e 100644 (file)
@@ -201,7 +201,6 @@ static struct scsi_host_template nv_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index cc928c68a4790e26621214919d0b9db4f1e11918..7eb67a6bdc64ca4a08f3fb3739e63b0b4c6d706d 100644 (file)
@@ -111,7 +111,6 @@ static struct scsi_host_template pdc_ata_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index 9ffe1ef0d20511eb158fa34a17d05bb672a96877..886f3447dd48b25c669c8d0d99e13181c14e16b1 100644 (file)
@@ -132,7 +132,6 @@ static struct scsi_host_template qs_ata_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = QS_MAX_PRD,
index 18c296c56899151ee966e6dddd25d380bc9d495f..106627299d55f002530bf12ef9e6105614c99175 100644 (file)
@@ -146,7 +146,6 @@ static struct scsi_host_template sil_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index 068c98a4111bc264401009cbf3cbf4258bdbc48a..f7264fd611c2226bc71e6d8e552478a8eaaf2748 100644 (file)
@@ -281,7 +281,6 @@ static struct scsi_host_template sil24_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index acc8439dea233dba04dc5cd95633761617c92760..728530df2e0751d3f498a2a96c49b1cd6d3a2cb6 100644 (file)
@@ -87,7 +87,6 @@ static struct scsi_host_template sis_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = ATA_MAX_PRD,
index 724f0ed6a52d210f3d3b5ba99be12e7040887888..53b0d5c0a61f45b4c25f78326c7aad38ff441c42 100644 (file)
@@ -290,7 +290,6 @@ static struct scsi_host_template k2_sata_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index ae70f60c7c0d03de0733d1eac795eb41debe4f59..4139ad4b1df065fb00d51510207c9e13dfe41332 100644 (file)
@@ -182,7 +182,6 @@ static struct scsi_host_template pdc_sata_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index 7ac5a5f5a905000d7c4962dad11c81221de753a4..38b52bd3fa3f1d5772ca83a8cb3341c9fad24862 100644 (file)
@@ -81,7 +81,6 @@ static struct scsi_host_template uli_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index 791bf652ba632905b27271c453a701a87a7932b6..9e7ae4e0db324535b3f34fbe648173abe7dd83de 100644 (file)
@@ -94,7 +94,6 @@ static struct scsi_host_template svia_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index 836bbbb26ff2c1c37cb76608821156babd9d776c..8a29ce340b472019b914e32ebfbebaa7f9463dc9 100644 (file)
@@ -263,7 +263,6 @@ static struct scsi_host_template vsc_sata_sht = {
        .name                   = DRV_NAME,
        .ioctl                  = ata_scsi_ioctl,
        .queuecommand           = ata_scsi_queuecmd,
-       .eh_strategy_handler    = ata_scsi_error,
        .can_queue              = ATA_DEF_QUEUE,
        .this_id                = ATA_SHT_THIS_ID,
        .sg_tablesize           = LIBATA_MAX_PRD,
index 5f0fdfb2618ca40910fb185fd00fb4bdaed770a5..1c75646f9689da6a9d2160744e7e402f8ac27b50 100644 (file)
@@ -1537,8 +1537,8 @@ int scsi_error_handler(void *data)
                 * what we need to do to get it up and online again (if we can).
                 * If we fail, we end up taking the thing offline.
                 */
-               if (shost->hostt->eh_strategy_handler) 
-                       shost->hostt->eh_strategy_handler(shost);
+               if (shost->transportt->eh_strategy_handler)
+                       shost->transportt->eh_strategy_handler(shost);
                else
                        scsi_unjam_host(shost);
 
index 0d61357604d5b24726c9dd2fd410b264a75182bb..b80d2e7fa6d25ba608c11d5bd0ca790c0653dfe1 100644 (file)
@@ -523,7 +523,6 @@ extern void ata_host_set_remove(struct ata_host_set *host_set);
 extern int ata_scsi_detect(struct scsi_host_template *sht);
 extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
 extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
-extern int ata_scsi_error(struct Scsi_Host *host);
 extern void ata_eh_qc_complete(struct ata_queued_cmd *qc);
 extern void ata_eh_qc_retry(struct ata_queued_cmd *qc);
 extern int ata_scsi_release(struct Scsi_Host *host);
index dc6862d09e535d630bbbaee2f2f00afbf3f4011d..de6ce541a046c551b065fa6737b949c4bee6fff2 100644 (file)
@@ -140,7 +140,6 @@ struct scsi_host_template {
         *
         * Status: REQUIRED     (at least one of them)
         */
-       int (* eh_strategy_handler)(struct Scsi_Host *);
        int (* eh_abort_handler)(struct scsi_cmnd *);
        int (* eh_device_reset_handler)(struct scsi_cmnd *);
        int (* eh_bus_reset_handler)(struct scsi_cmnd *);
index b3657f111937a32d159ff1d99b48d0c19ed73604..cca1d4926d2aa47333749967577087df93b9ec52 100644 (file)
@@ -49,6 +49,11 @@ struct scsi_transport_template {
         */
        unsigned int create_work_queue : 1;
 
+       /*
+        * Allows a transport to override the default error handler.
+        */
+       void (* eh_strategy_handler)(struct Scsi_Host *);
+
        /*
         * This is an optional routine that allows the transport to become
         * involved when a scsi io timer fires. The return value tells the