linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata-dev-2.6-ncq: rewrite __ata_qc_complete
@ 2005-06-26 14:41 Tejun Heo
  2005-06-26 17:27 ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2005-06-26 14:41 UTC (permalink / raw)
  To: Jeff Garzik, axboe, linux-ide

 Hello, Jeff.
 Hello, Jens.

 This is the fource, no, fourth (dang, that starwars) of six misc
updates to ncq.

 This patch rewrites __ata_qc_complete() to make it look more sane.
Also, remove spurious clearing of ATA_QCFLAG_ACTIVE from
ata_qc_complete().

 Signed-off-by: Tejun Heo <htejun@gmail.com>

Index: work/drivers/scsi/libata-core.c
===================================================================
--- work.orig/drivers/scsi/libata-core.c	2005-06-26 21:20:43.000000000 +0900
+++ work/drivers/scsi/libata-core.c	2005-06-26 21:20:47.000000000 +0900
@@ -3069,7 +3069,8 @@ static int ata_qc_complete_noop(struct a
 static void __ata_qc_complete(struct ata_queued_cmd *qc)
 {
 	struct ata_port *ap = qc->ap;
-	unsigned int tag, do_clear = 0;
+	struct completion *waiting = qc->waiting;
+	unsigned int tag = ata_qc_to_tag(qc);
 
 	if (likely(qc->flags & ATA_QCFLAG_ACTIVE)) {
 		assert(ap->queue_depth);
@@ -3077,26 +3078,19 @@ static void __ata_qc_complete(struct ata
 
 		if (!ap->queue_depth)
 			ap->flags &= ~ATA_FLAG_NCQ_QUEUED;
-	}
-
-	qc->flags = 0;
-	tag = ata_qc_to_tag(qc);
-	if (likely(ata_tag_valid(tag))) {
 		if (tag == ap->active_tag)
 			ap->active_tag = ATA_TAG_POISON;
-		do_clear = 1;
 	}
 
-	if (qc->waiting) {
-		struct completion *waiting = qc->waiting;
-		qc->waiting = NULL;
-		complete(waiting);
-	}
+	qc->flags = 0;
+	qc->waiting = NULL;
+	ap->qactive &= ~(1 << tag);
 
-	if (likely(do_clear))
-		ap->qactive &= ~(1 << tag);
 	if (ap->cmd_waiters)
 		wake_up(&ap->cmd_wait_queue);
+
+	if (waiting)
+		complete(waiting);
 }
 
 /**
@@ -3151,7 +3145,6 @@ void ata_qc_complete(struct ata_queued_c
 		return;
 
 	__ata_qc_complete(qc);
-	qc->flags &= ~ATA_QCFLAG_ACTIVE;
 
 	VPRINTK("EXIT\n");
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-06-27 13:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-26 14:41 [PATCH] libata-dev-2.6-ncq: rewrite __ata_qc_complete Tejun Heo
2005-06-26 17:27 ` Jeff Garzik
2005-06-27  8:27   ` Jens Axboe
2005-06-27  9:27     ` Albert Lee
2005-06-27 11:13       ` Tejun Heo
2005-06-27 12:30         ` Jeff Garzik
2005-06-27 13:21           ` Tejun Heo

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).