linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, alan@lxorguk.ukuu.org.uk, axboe@suse.de,
	albertcc@tw.ibm.com, forrest.zhao@intel.com, efalk@google.com,
	linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH] libata: fix irq-pio merge
Date: Thu, 11 May 2006 22:33:24 +0900	[thread overview]
Message-ID: <11473544043357-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <11473544041507-git-send-email-htejun@gmail.com>

* kill ata_poll_qc_complete() and implement/use ata_hsm_qc_complete()
  which completes qcs in new EH compliant manner from HSM

* don't print error message from ata_hsm_move().  it's responsibility
  of EH.

* kill ATA_FLAG_NOINTR usage in bmdma EH

---

 drivers/scsi/libata-bmdma.c |    1 
 drivers/scsi/libata-core.c  |   98 +++++++++++++++++++++++--------------------
 2 files changed, 52 insertions(+), 47 deletions(-)

1bb4c2efb606a5b746997b0ceabbdadbda5d3f26
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c
index 751ec18..741ddc4 100644
--- a/drivers/scsi/libata-bmdma.c
+++ b/drivers/scsi/libata-bmdma.c
@@ -726,7 +726,6 @@ void ata_bmdma_drive_eh(struct ata_port 
 	/* reset PIO HSM and stop DMA engine */
 	spin_lock_irqsave(&host_set->lock, flags);
 
-	ap->flags &= ~ATA_FLAG_NOINTR;
 	ap->hsm_task_state = HSM_ST_IDLE;
 
 	if (qc && (qc->tf.protocol == ATA_PROT_DMA ||
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index b230856..6d28722 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -3461,40 +3461,6 @@ skip_map:
 }
 
 /**
- *	ata_poll_qc_complete - turn irq back on and finish qc
- *	@qc: Command to complete
- *	@err_mask: ATA status register content
- *
- *	LOCKING:
- *	None.  (grabs host lock)
- */
-void ata_poll_qc_complete(struct ata_queued_cmd *qc)
-{
-	struct ata_port *ap = qc->ap;
-	unsigned long flags;
-
-	spin_lock_irqsave(&ap->host_set->lock, flags);
-
-	if (ap->ops->error_handler) {
-		/* EH might have kicked in while host_set lock is released */
-		qc = ata_qc_from_tag(ap, qc->tag);
-		if (qc) {
-			if (!(qc->err_mask & AC_ERR_HSM)) {
-				ata_irq_on(ap);
-				ata_qc_complete(qc);
-			} else
-				ata_port_freeze(ap);
-		}
-	} else {
-		/* old EH */
-		ata_irq_on(ap);
-		ata_qc_complete(qc);
-	}
-
-	spin_unlock_irqrestore(&ap->host_set->lock, flags);
-}
-
-/**
  *	swap_buf_le16 - swap halves of 16-bit words in place
  *	@buf:  Buffer to swap
  *	@buf_words:  Number of 16-bit words in buffer.
@@ -3917,6 +3883,56 @@ static inline int ata_hsm_ok_in_wq(struc
 }
 
 /**
+ *	ata_hsm_qc_complete - finish a qc running on standard HSM
+ *	@qc: Command to complete
+ *	@in_wq: 1 if called from workqueue, 0 otherwise
+ *
+ *	Finish @qc which is running on standard HSM.
+ *
+ *	LOCKING:
+ *	If @in_wq is zero, spin_lock_irqsave(host_set lock).
+ *	Otherwise, none on entry and grabs host lock.
+ */
+static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
+{
+	struct ata_port *ap = qc->ap;
+	unsigned long flags;
+
+	if (ap->ops->error_handler) {
+		if (in_wq) {
+			spin_lock_irqsave(&ap->host_set->lock, flags);
+
+			/* EH might have kicked in while host_set lock
+			 * is released.
+			 */
+			qc = ata_qc_from_tag(ap, qc->tag);
+			if (qc) {
+				if (likely(!(qc->err_mask & AC_ERR_HSM))) {
+					ata_irq_on(ap);
+					ata_qc_complete(qc);
+				} else
+					ata_port_freeze(ap);
+			}
+
+			spin_unlock_irqrestore(&ap->host_set->lock, flags);
+		} else {
+			if (likely(!(qc->err_mask & AC_ERR_HSM)))
+				ata_qc_complete(qc);
+			else
+				ata_port_freeze(ap);
+		}
+	} else {
+		if (in_wq) {
+			spin_lock_irqsave(&ap->host_set->lock, flags);
+			ata_irq_on(ap);
+			ata_qc_complete(qc);
+			spin_unlock_irqrestore(&ap->host_set->lock, flags);
+		} else
+			ata_qc_complete(qc);
+	}
+}
+
+/**
  *	ata_hsm_move - move the HSM to the next state.
  *	@ap: the target ata_port
  *	@qc: qc on going
@@ -4107,19 +4123,12 @@ fsm_start:
 		ap->hsm_task_state = HSM_ST_IDLE;
 
 		/* complete taskfile transaction */
-		if (in_wq)
-			ata_poll_qc_complete(qc);
-		else
-			ata_qc_complete(qc);
+		ata_hsm_qc_complete(qc, in_wq);
 
 		poll_next = 0;
 		break;
 
 	case HSM_ST_ERR:
-		if (qc->tf.command != ATA_CMD_PACKET)
-			printk(KERN_ERR "ata%u: dev %u command error, drv_stat 0x%x\n",
-			       ap->id, qc->dev->devno, status);
-
 		/* make sure qc->err_mask is available to
 		 * know what's wrong and recover
 		 */
@@ -4128,10 +4137,7 @@ fsm_start:
 		ap->hsm_task_state = HSM_ST_IDLE;
 
 		/* complete taskfile transaction */
-		if (in_wq)
-			ata_poll_qc_complete(qc);
-		else
-			ata_qc_complete(qc);
+		ata_hsm_qc_complete(qc, in_wq);
 
 		poll_next = 0;
 		break;
-- 
1.2.4



  reply	other threads:[~2006-05-11 13:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-11 13:33 [PATCHSET 04/11] merge irq-pio Tejun Heo
2006-05-11 13:33 ` Tejun Heo [this message]
2006-05-11 13:33 ` [PATCH] libata: " Tejun Heo
2006-05-23 10:05   ` Albert Lee
2006-05-23 10:12     ` [PATCH 1/1] libata: minor fix for irq-pio merge Albert Lee
2006-05-23 20:09     ` [PATCH] libata: merge irq-pio Jeff Garzik
2006-05-26  8:14       ` Albert Lee
2006-05-27  0:53     ` Tejun Heo
2006-05-13 22:11 ` [PATCHSET 04/11] " Jeff Garzik
2006-05-16 10:00   ` Albert Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11473544043357-git-send-email-htejun@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=axboe@suse.de \
    --cc=efalk@google.com \
    --cc=forrest.zhao@intel.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).