[RFC][PATCH 1/1] aic7xxx: Remove the platform_data->qfrozen logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello,

Since we no longuer do internal queuing, we push the lock
inside ahc_linux_run_command and completly remove the bursted
internal queue freezing machinery.
Based on Hannes Reinecke patch for aic79xxx and Christoph
Hellwig comments.

Signed-off-by: Emmanuel Fuste <emmanuel.fuste@xxxxxxxxxxx>

---

 aic7xxx_osm.c |   82
++++++++++++----------------------------------------------
 aic7xxx_osm.h |    1
 2 files changed, 17 insertions(+), 66 deletions(-)

---



Accédez au courrier électronique de La Poste : www.laposte.net ; 
3615 LAPOSTENET (0,34 ?/mn) ; tél : 08 92 68 13 50 (0,34?/mn)


Subject: [RFC][PATCH 1/1] aic7xxx: Remove the platform_data->qfrozen logic

Since we no longuer do internal queuing, we push the lock inside ahc_linux_run_command
and completly remove the bursted internal queue freezing machinery.
Based on Hannes Reinecke patch for aic79xxx and Christoph Hellwig comments.

Signed-off-by: Emmanuel Fuste <emmanuel.fuste@xxxxxxxxxxx>

---

 aic7xxx_osm.c |   82 ++++++++++++----------------------------------------------
 aic7xxx_osm.h |    1 
 2 files changed, 17 insertions(+), 66 deletions(-)

--- linux-source-2.6.15-orig/drivers/scsi/aic7xxx/aic7xxx_osm.c	2006-02-07 10:48:30.000000000 +0100
+++ linux-source-2.6.15/drivers/scsi/aic7xxx/aic7xxx_osm.c	2006-02-08 13:44:32.000000000 +0100
@@ -373,8 +373,6 @@ static void ahc_linux_handle_scsi_status
 					 struct scb *);
 static void ahc_linux_queue_cmd_complete(struct ahc_softc *ahc,
 					 struct scsi_cmnd *cmd);
-static void ahc_linux_freeze_simq(struct ahc_softc *ahc);
-static void ahc_linux_release_simq(struct ahc_softc *ahc);
 static int  ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag);
 static void ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc);
 static u_int ahc_linux_user_tagdepth(struct ahc_softc *ahc,
@@ -475,18 +473,13 @@ ahc_linux_queue(struct scsi_cmnd * cmd, 
 {
 	struct	 ahc_softc *ahc;
 	struct	 ahc_linux_device *dev = scsi_transport_device_data(cmd->device);
-	int rtn = SCSI_MLQUEUE_HOST_BUSY;
-	unsigned long flags;
+	int	 rtn;
 
 	ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
 
-	ahc_lock(ahc, &flags);
-	if (ahc->platform_data->qfrozen == 0) {
-		cmd->scsi_done = scsi_done;
-		cmd->result = CAM_REQ_INPROG << 16;
-		rtn = ahc_linux_run_command(ahc, dev, cmd);
-	}
-	ahc_unlock(ahc, &flags);
+	cmd->scsi_done = scsi_done;
+	cmd->result = CAM_REQ_INPROG << 16;
+	rtn = ahc_linux_run_command(ahc, dev, cmd);
 
 	return rtn;
 }
@@ -747,14 +740,11 @@ ahc_linux_bus_reset(struct scsi_cmnd *cm
 {
 	struct ahc_softc *ahc;
 	int    found;
-	unsigned long flags;
 
 	ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
 
-	ahc_lock(ahc, &flags);
 	found = ahc_reset_channel(ahc, scmd_channel(cmd) + 'A',
 				  /*initiate reset*/TRUE);
-	ahc_unlock(ahc, &flags);
 
 	if (bootverbose)
 		printf("%s: SCSI bus reset delivered. "
@@ -1167,9 +1157,9 @@ ahc_linux_initialize_scsi_bus(struct ahc
 	ahc_unlock(ahc, &s);
 	/* Give the bus some time to recover */
 	if ((ahc->flags & (AHC_RESET_BUS_A|AHC_RESET_BUS_B)) != 0) {
-		ahc_linux_freeze_simq(ahc);
+		scsi_block_requests(ahc->platform_data->host);
 		msleep(AIC7XXX_RESET_DELAY);
-		ahc_linux_release_simq(ahc);
+		scsi_unblock_requests(ahc->platform_data->host);
 	}
 }
 
@@ -1406,13 +1396,9 @@ ahc_linux_run_command(struct ahc_softc *
 	struct	 ahc_tmode_tstate *tstate;
 	uint16_t mask;
 	struct scb_tailq *untagged_q = NULL;
+	unsigned long flags;
 
-	/*
-	 * Schedule us to run later.  The only reason we are not
-	 * running is because the whole controller Q is frozen.
-	 */
-	if (ahc->platform_data->qfrozen != 0)
-		return SCSI_MLQUEUE_HOST_BUSY;
+	ahc_lock(ahc, &flags);
 
 	/*
 	 * We only allow one untagged transaction
@@ -1426,18 +1412,22 @@ ahc_linux_run_command(struct ahc_softc *
 
 		target_offset = cmd->device->id + cmd->device->channel * 8;
 		untagged_q = &(ahc->untagged_queues[target_offset]);
-		if (!TAILQ_EMPTY(untagged_q))
+		if (!TAILQ_EMPTY(untagged_q)) {
 			/* if we're already executing an untagged command
 			 * we're busy to another */
+			ahc_unlock(ahc, &flags);
 			return SCSI_MLQUEUE_DEVICE_BUSY;
+		}
 	}
 
 	/*
 	 * Get an scb to use.
 	 */
 	scb = ahc_get_scb(ahc);
-	if (!scb)
+	if (!scb) {
+		ahc_unlock(ahc, &flags);
 		return SCSI_MLQUEUE_HOST_BUSY;
+	}
 
 	scb->io_ctx = cmd;
 	scb->platform_data->dev = dev;
@@ -1588,6 +1578,9 @@ ahc_linux_run_command(struct ahc_softc *
 		scb->flags |= SCB_UNTAGGEDQ;
 	}
 	ahc_queue_scb(ahc, scb);
+
+	ahc_unlock(ahc, &flags);
+
 	return 0;
 }
 
@@ -2022,47 +2015,6 @@ ahc_linux_queue_cmd_complete(struct ahc_
 	cmd->scsi_done(cmd);
 }
 
-static void
-ahc_linux_freeze_simq(struct ahc_softc *ahc)
-{
-	unsigned long s;
-
-	ahc_lock(ahc, &s);
-	ahc->platform_data->qfrozen++;
-	if (ahc->platform_data->qfrozen == 1) {
-		scsi_block_requests(ahc->platform_data->host);
-
-		/* XXX What about Twin channels? */
-		ahc_platform_abort_scbs(ahc, CAM_TARGET_WILDCARD, ALL_CHANNELS,
-					CAM_LUN_WILDCARD, SCB_LIST_NULL,
-					ROLE_INITIATOR, CAM_REQUEUE_REQ);
-	}
-	ahc_unlock(ahc, &s);
-}
-
-static void
-ahc_linux_release_simq(struct ahc_softc *ahc)
-{
-	u_long s;
-	int    unblock_reqs;
-
-	unblock_reqs = 0;
-	ahc_lock(ahc, &s);
-	if (ahc->platform_data->qfrozen > 0)
-		ahc->platform_data->qfrozen--;
-	if (ahc->platform_data->qfrozen == 0)
-		unblock_reqs = 1;
-	ahc_unlock(ahc, &s);
-	/*
-	 * There is still a race here.  The mid-layer
-	 * should keep its own freeze count and use
-	 * a bottom half handler to run the queues
-	 * so we can unblock with our own lock held.
-	 */
-	if (unblock_reqs)
-		scsi_unblock_requests(ahc->platform_data->host);
-}
-
 static int
 ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
 {
--- linux-source-2.6.15-orig/drivers/scsi/aic7xxx/aic7xxx_osm.h	2006-02-07 10:48:38.000000000 +0100
+++ linux-source-2.6.15/drivers/scsi/aic7xxx/aic7xxx_osm.h	2006-02-08 13:28:43.000000000 +0100
@@ -368,7 +368,6 @@ struct ahc_platform_data {
 	struct scsi_target *starget[AHC_NUM_TARGETS]; 
 
 	spinlock_t		 spin_lock;
-	u_int			 qfrozen;
 	struct completion	*eh_done;
 	struct Scsi_Host        *host;		/* pointer to scsi host */
 #define AHC_LINUX_NOIRQ	((uint32_t)~0)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux