aic7xxx: user scsi_device host private data
Subsystems (2)
PATCH 1/1 aic7xxx: user scsi_device host private data
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) +10 -37
@@ -610,10 +610,8 @@ static int ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) { - struct ahc_softc *ahc; - struct ahc_linux_device *dev; - - ahc = *(struct ahc_softc **)cmd->device->host->hostdata; + struct ahc_softc *ahc = *(struct ahc_softc **)cmd->device->host->hostdata; + struct ahc_linux_device *dev = cmd->device->hostdata; /* * Save the callback on completion function.
@@ -629,10 +627,6 @@ if (ahc->platform_data->qfrozen != 0) return SCSI_MLQUEUE_HOST_BUSY; - dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id, - cmd->device->lun); - BUG_ON(dev == NULL); - cmd->result = CAM_REQ_INPROG << 16; return ahc_linux_run_command(ahc, dev, cmd);
@@ -707,6 +701,8 @@ if (dev == NULL) goto out; } + + device->hostdata = dev; retval = 0; out:
@@ -717,16 +713,12 @@ static int ahc_linux_slave_configure(struct scsi_device *device) { - struct ahc_softc *ahc; - struct ahc_linux_device *dev; - - ahc = *((struct ahc_softc **)device->host->hostdata); + struct ahc_softc *ahc = *((struct ahc_softc **)device->host->hostdata); + struct ahc_linux_device *dev = device->hostdata; if (bootverbose) printf("%s: Slave Configure %d\n", ahc_name(ahc), device->id); - dev = ahc_linux_get_device(ahc, device->channel, device->id, - device->lun); dev->scsi_device = device; ahc_linux_device_queue_depth(ahc, dev);
@@ -740,16 +732,11 @@ static void ahc_linux_slave_destroy(struct scsi_device *device) { - struct ahc_softc *ahc; - struct ahc_linux_device *dev; + struct ahc_softc *ahc = *((struct ahc_softc **)device->host->hostdata); + struct ahc_linux_device *dev = device->hostdata; - ahc = *((struct ahc_softc **)device->host->hostdata); if (bootverbose) printf("%s: Slave Destroy %d\n", ahc_name(ahc), device->id); - dev = ahc_linux_get_device(ahc, device->channel, - device->id, device->lun); - - BUG_ON(dev->active); ahc_linux_free_device(ahc, dev); }
@@ -1401,6 +1388,7 @@ devinfo->lun); if (dev == NULL) return; + was_queuing = dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED); switch (alg) { default:
@@ -2330,7 +2318,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) { struct ahc_softc *ahc; - struct ahc_linux_device *dev; + struct ahc_linux_device *dev = cmd->device->hostdata; struct scb *pending_scb; u_int saved_scbptr; u_int active_scb_index;
@@ -2365,21 +2353,6 @@ * at all, and the system wanted us to just abort the * command, return success. */ - dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id, - cmd->device->lun); - - if (dev == NULL) { - /* - * No target device for this command exists, - * so we must not still own the command. - */ - printf("%s:%d:%d:%d: Is not an active device\n", - ahc_name(ahc), cmd->device->channel, cmd->device->id, - cmd->device->lun); - retval = SUCCESS; - goto no_cmd; - } - if ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED)) == 0 && ahc_search_untagged_queues(ahc, cmd, cmd->device->id, cmd->device->channel + 'A',
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) line 634
Quoted 1 line · Christoph Hellwig
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) +0
-1- BUG_ON(dev == NULL);
Leave that one, just in case ... I think it's completely impossible now, but I'm still suspicious of the aic untagged queues and whether they can spit back a command.
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) line 752
Quoted 1 line
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) +0
-1- BUG_ON(dev->active);
Ditto this one .. although I'm less sanguine that this won't be tripped.
James
Quoted 6 lines · James Bottomley
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) line 634
Quoted 1 line · Christoph Hellwig
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) +0
-1- BUG_ON(dev == NULL);Leave that one, just in case ... I think it's completely impossible now, but I'm still suspicious of the aic untagged queues and whether they can spit back a command.
This doesn't make sense as we never reset the hostdata, so this is a real can't happen.
Quoted 3 lines
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) line 752
Quoted 1 line
drivers/scsi/aic7xxx/aic7xxx_osm.c (mode:100644) +0
-1- BUG_ON(dev->active);Ditto this one .. although I'm less sanguine that this won't be tripped.
this makes a tiny little bit more sense to keep
Quoted 2 lines · Christoph Hellwig
This doesn't make sense as we never reset the hostdata, so this is a real can't happen.
Then you should ... at the place where the old code released the device in slave_destroy.
James