Cleanup struct Scsi_Host
Subsystems (3)
cover Cleanup struct Scsi_Host
The 'Scsi_Host' structure has two fields 'resetting' and 'last_reset' which are basically unused. There are only
4 drivers referencing 'last_reset' (dpt_i2o, tmscsim, dc395, and advansys), and only dpt_i2o makes usage of both fields.
However, dpt_i2o does _not_ require a delay after reset,
so even there the usage is questionable.
So move the 'last_reset' field into the internal host structure where needed and remove both fields from struct Scsi_Host.
Hannes Reinecke (5):
scsi: remove 'resetting' field from struct Scsi_Host
tmscsim: Move 'last_reset' into host structure
dc395: Move 'last_reset' into internal host structure
advansys: Remove references to 'last_reset'
scsi: Remove 'last_reset' for struct Scsi_Host
drivers/scsi/advansys.c | 8 ++++---- drivers/scsi/dc395x.c | 24 +++++++++++++----------- drivers/scsi/dpt_i2o.c | 22 +++------------------- drivers/scsi/scsi.c | 25 +------------------------ drivers/scsi/tmscsim.c | 12 ++++++------ drivers/scsi/tmscsim.h | 1 + include/scsi/scsi_host.h | 4 +--- 7 files changed, 29 insertions(+), 67 deletions(-)
Signature · 1 line
1.7.12.4
PATCH 1/5 scsi: remove 'resetting' field from struct Scsi_Host
struct Scsi_Host has a field 'resetting' which is only ever used in dpt_i2o. And even there the usage is questionable. So remove the field and have dpt_i2o use the standard mechanism for delaying I/O.
--- drivers/scsi/dpt_i2o.c | 22 +++------------------- drivers/scsi/scsi.c | 25 +------------------------ include/scsi/scsi_host.h | 1 - 3 files changed, 4 insertions(+), 44 deletions(-)
drivers/scsi/dpt_i2o.c +3 -19
@@ -448,18 +448,8 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd }rmb (); -/* -* TODO: I need to block here if I am processing ioctl cmds -* but if the outstanding cmds all finish before the ioctl, -* the scsi-core will not know to start sending cmds to me again. -* I need to a way to restart the scsi-cores queues or should I block -* calling scsi_done on the outstanding cmds instead -* for now we don't set the IOCTL state -*/ -if (((pHba->state) &DPTI_STATE_IOCTL ) || ((pHba->state) &DPTI_STATE_RESET )) { - pHba->host->last_reset = jiffies; - pHba->host->resetting =1 ; -return 1 ; +if (((pHba->state) &DPTI_STATE_RESET )) { +return SCSI_MLQUEUE_HOST_BUSY ; }// TODO if the cmd->device if offline then I may need to issue a bus rescan
@@ -1813,19 +1803,13 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)do {if (pHba->host)spin_lock_irqsave (pHba->host->host_lock, flags); -// This state stops any new commands from enterring the -// controller while processing the ioctl -// pHba->state |= DPTI_STATE_IOCTL; -// We can't set this now - The scsi subsystem sets host_blocked and -// the queue empties and stops. We need a way to restart the queue rcode =adpt_i2o_post_wait (pHba, msg, size,FOREVER );if (rcode !=0 )printk ("adpt_i2o_passthru: post wait failed %d %p\n" , rcode, reply); -// pHba->state &= ~DPTI_STATE_IOCTL; if (pHba->host)spin_unlock_irqrestore (pHba->host->host_lock, flags); - }while (rcode == -ETIMEDOUT ); + }while (rcode == -ETIMEDOUT );if (rcode){ goto cleanup;
drivers/scsi/scsi.c +1 -24
@@ -658,7 +658,6 @@ EXPORT_SYMBOL(scsi_cmd_get_serial);int scsi_dispatch_cmd (struct scsi_cmnd *cmd) {struct Scsi_Host *host = cmd->device->host; -unsigned long timeout;int rtn =0 ;atomic_inc (&cmd->device->iorequest_cnt);
@@ -695,7 +694,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) goto out; } -/* +/* * If SCSI-2 or lower, store the LUN value in cmnd. */ if (cmd->device->scsi_level <= SCSI_2 &&
@@ -704,28 +703,6 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) (cmd->device->lun <<5 &0xe0 ); } -/* -* We will wait MIN_RESET_DELAY clock ticks after the last reset so -* we can avoid the drive not being ready. -*/ - timeout = host->last_reset +MIN_RESET_DELAY ; - -if (host->resetting &&time_before (jiffies, timeout)) { -int ticks_remaining = timeout - jiffies; -/* -* NOTE: This may be executed from within an interrupt -* handler! This is bad, but for now, it'll do. The irq -* level of the interrupt handler has been masked out by the -* platform dependent interrupt handling code already, so the -* sti() here will not cause another call to the SCSI host's -* interrupt handler (assuming there is one irq-level per -* host). -*/ -while (--ticks_remaining >=0 ) -mdelay (1 +999 /HZ ); - host->resetting =0 ; - } -scsi_log_send (cmd);/*
include/scsi/scsi_host.h +0 -1
@@ -598,7 +598,6 @@ struct Scsi_Host {unsigned int host_eh_scheduled;/* EH scheduled without command */ unsigned int host_no;/* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ -int resetting;/* if set, it means that last_reset is a valid value */ unsigned long last_reset;/*
Signature · 1 line
1.7.12.4
PATCH 2/5 tmscsim: Move 'last_reset' into host structure
In reply to Hannes ReineckeThe 'last_reset' value is only used internally, so move it into the internal host structure.
--- drivers/scsi/tmscsim.c | 12 ++++++------ drivers/scsi/tmscsim.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/scsi/tmscsim.c +6 -6
@@ -521,7 +521,7 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr pACB->SelConn++;return 1 ; } -if (time_before (jiffies, pACB->pScsiHost->last_reset)) +if (time_before (jiffies, pACB->last_reset)) {DEBUG0 (printk ("DC390: We were just reset and don't accept commands yet!\n" ));return 1 ;
@@ -1863,7 +1863,7 @@ dc390_ScsiRstDetect( struct dc390_acb* pACB )/* delay half a second */ udelay (1000 );DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD ); - pACB->pScsiHost->last_reset = jiffies +5 *HZ /2 + pACB->last_reset = jiffies +5 *HZ /2 +HZ * dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY ]; pACB->Connected =0 ;
@@ -2048,7 +2048,7 @@ static int DC390_bus_reset (struct scsi_cmnd *cmd)dc390_ResetDevParam (pACB);mdelay (1 ); - pACB->pScsiHost->last_reset = jiffies +3 *HZ /2 + pACB->last_reset = jiffies +3 *HZ /2 +HZ * dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY ];DC390_write8 (ScsiCmd,CLEAR_FIFO_CMD );
@@ -2383,7 +2383,7 @@ static void dc390_init_hw(struct dc390_acb *pACB, u8 index)if (pACB->Gmode2 &RST_SCSI_BUS ) {dc390_ResetSCSIBus (pACB);udelay (1000 ); - shost->last_reset = jiffies +HZ /2 + + pACB->last_reset = jiffies +HZ /2 +HZ * dc390_eepromBuf[pACB->AdapterIndex][EE_DELAY ]; }
@@ -2455,8 +2455,8 @@ static int dc390_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) shost->irq = pdev->irq; shost->base = io_port; shost->unique_id = io_port; - shost->last_reset = jiffies; - + + pACB->last_reset = jiffies; pACB->pScsiHost = shost; pACB->IOPortBase = (u16 ) io_port; pACB->IRQLevel = pdev->irq;
drivers/scsi/tmscsim.h +1 -0
@@ -143,6 +143,7 @@ u8 Ignore_IRQ; /* Not used */struct pci_dev *pdev; +unsigned long last_reset;unsigned long Cmds;u32 SelLost;u32 SelConn;
Signature · 1 line
1.7.12.4
PATCH 3/5 dc395: Move 'last_reset' into internal host structure
In reply to Hannes Reinecke'last_reset' is only used internally, so move it into the internal host structure.
--- drivers/scsi/dc395x.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/scsi/dc395x.c +13 -11
@@ -308,6 +308,8 @@ struct AdapterCtlBlk {struct timer_list waiting_timer;struct timer_list selto_timer; +unsigned long last_reset; +u16 srb_count;u8 sel_timeout;
@@ -860,9 +862,9 @@ static void waiting_set_timer(struct AdapterCtlBlk *acb, unsigned long to)init_timer (&acb->waiting_timer); acb->waiting_timer.function = waiting_timeout; acb->waiting_timer.data = (unsigned long ) acb; -if (time_before (jiffies + to, acb->scsi_host->last_reset -HZ /2 )) +if (time_before (jiffies + to, acb->last_reset -HZ /2 )) acb->waiting_timer.expires = - acb->scsi_host->last_reset -HZ /2 +1 ; + acb->last_reset -HZ /2 +1 ;else acb->waiting_timer.expires = jiffies + to +1 ;add_timer (&acb->waiting_timer);
@@ -1319,7 +1321,7 @@ static int __dc395x_eh_bus_reset(struct scsi_cmnd *cmd)udelay (500 );/* We may be in serious trouble. Wait some seconds */ - acb->scsi_host->last_reset = + acb->last_reset = jiffies +3 *HZ /2 +HZ * acb->eeprom.delay_time;
@@ -1462,9 +1464,9 @@ static void selto_timer(struct AdapterCtlBlk *acb) acb->selto_timer.function = selection_timeout_missed; acb->selto_timer.data = (unsigned long ) acb;if (time_before - (jiffies +HZ , acb->scsi_host->last_reset +HZ /2 )) + (jiffies +HZ , acb->last_reset +HZ /2 )) acb->selto_timer.expires = - acb->scsi_host->last_reset +HZ /2 +1 ; + acb->last_reset +HZ /2 +1 ;else acb->selto_timer.expires = jiffies +HZ +1 ;add_timer (&acb->selto_timer);
@@ -1535,7 +1537,7 @@ static u8 start_scsi(struct AdapterCtlBlk* acb, struct DeviceCtlBlk* dcb, }/* Allow starting of SCSI commands half a second before we allow the mid-level * to queue them again after a reset */ -if (time_before (jiffies, acb->scsi_host->last_reset -HZ /2 )) { +if (time_before (jiffies, acb->last_reset -HZ /2 )) {dprintkdbg (DBG_KG ,"start_scsi: Refuse cmds (reset wait)\n" );return 1 ; }
@@ -3031,7 +3033,7 @@ static void disconnect(struct AdapterCtlBlk *acb)dprintkl (KERN_ERR ,"disconnect: No such device\n" );udelay (500 );/* Suspend queue for a while */ - acb->scsi_host->last_reset = + acb->last_reset = jiffies +HZ /2 +HZ * acb->eeprom.delay_time;clear_fifo (acb,"disconnectEx" );
@@ -3053,7 +3055,7 @@ static void disconnect(struct AdapterCtlBlk *acb)waiting_process_next (acb); }else if (srb->state &SRB_ABORT_SENT ) { dcb->flag &= ~ABORT_DEV_ ; - acb->scsi_host->last_reset = jiffies +HZ /2 +1 ; + acb->last_reset = jiffies +HZ /2 +1 ;dprintkl (KERN_ERR ,"disconnect: SRB_ABORT_SENT\n" );doing_srb_done (acb,DID_ABORT , srb->cmd,1 );waiting_process_next (acb);
@@ -3649,7 +3651,7 @@ static void scsi_reset_detect(struct AdapterCtlBlk *acb)/*DC395x_write8(acb, TRM_S1040_DMA_CONTROL,STOPDMAXFER); */ udelay (500 );/* Maybe we locked up the bus? Then lets wait even longer ... */ - acb->scsi_host->last_reset = + acb->last_reset = jiffies +5 *HZ /2 +HZ * acb->eeprom.delay_time;
@@ -4426,7 +4428,7 @@ static void adapter_init_scsi_host(struct Scsi_Host *host) host->dma_channel =-1 ; host->unique_id = acb->io_port_base; host->irq = acb->irq_level; - host->last_reset = jiffies; + acb->last_reset = jiffies; host->max_id =16 ;if (host->max_id -1 == eeprom->scsi_id)
@@ -4484,7 +4486,7 @@ static void adapter_init_chip(struct AdapterCtlBlk *acb)/*spin_unlock_irq (&io_request_lock); */ udelay (500 ); - acb->scsi_host->last_reset = + acb->last_reset = jiffies +HZ /2 +HZ * acb->eeprom.delay_time;
Signature · 1 line
1.7.12.4
PATCH 4/5 advansys: Remove references to 'last_reset'
In reply to Hannes ReineckeThe 'last_reset' field is only displayed in logging messages but never actually used. Remove references to it.
--- drivers/scsi/advansys.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/advansys.c +4 -4
@@ -2511,8 +2511,8 @@ static void asc_prt_scsi_host(struct Scsi_Host *s)struct asc_board *boardp =shost_priv (s);printk ("Scsi_Host at addr 0x%p, device %s\n" , s,dev_name (boardp->dev)); -printk (" host_busy %u, host_no %d, last_reset %d,\n" , - s->host_busy, s->host_no, (unsigned )s->last_reset); +printk (" host_busy %u, host_no %d,\n" , + s->host_busy, s->host_no);printk (" base 0x%lx, io_port 0x%lx, irq %d,\n" , (ulong )s->base, (ulong )s->io_port, boardp->irq);
@@ -3345,8 +3345,8 @@ static void asc_prt_driver_conf(struct seq_file *m, struct Scsi_Host *shost) shost->host_no);seq_printf (m, -" host_busy %u, last_reset %lu, max_id %u, max_lun %u, max_channel %u\n" , - shost->host_busy, shost->last_reset, shost->max_id, +" host_busy %u, max_id %u, max_lun %u, max_channel %u\n" , + shost->host_busy, shost->max_id, shost->max_lun, shost->max_channel); seq_printf(m,
Signature · 1 line
1.7.12.4
PATCH 5/5 scsi: Remove 'last_reset' for struct Scsi_Host
In reply to Hannes ReineckeField is now unused, so remove it.
--- include/scsi/scsi_host.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/scsi/scsi_host.h +1 -2
@@ -596,9 +596,8 @@ struct Scsi_Host {unsigned int host_busy;/* commands actually active on low-level */ unsigned int host_failed;/* commands that failed. */ unsigned int host_eh_scheduled;/* EH scheduled without command */ - +unsigned int host_no;/* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ -unsigned long last_reset;/* * These three parameters can be used to allow for wide scsi,
Signature · 1 line
1.7.12.4