linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: Playing with SATA NCQ
Date: Fri, 27 May 2005 09:33:08 +0200	[thread overview]
Message-ID: <20050527073307.GP1435@suse.de> (raw)
In-Reply-To: <4296CC5C.5000807@pobox.com>

On Fri, May 27 2005, Jeff Garzik wrote:
> Jens Axboe wrote:
> >I double checked this. If you agree to move the setting of QCFLAG_ACTIVE
> >_after_ successful ap->ops->qc_issue(qc) and clear it _after_
> >__ata_qc_complete(qc) then I can just use that bit and kill
> >ATA_QCFLAG_ACCOUNT.
> >
> >What do you think?
> 
> Fine with me.
> 
> Keep in mind that the attached patch was applied recently...

Yeah, the two hunks from the ncq patch would look like this then. Ok?

Index: drivers/scsi/libata-core.c
===================================================================
--- 3ac9a34948049bff79a2b2ce49c0a3c84e35a748/drivers/scsi/libata-core.c  (mode:100644)
+++ uncommitted/drivers/scsi/libata-core.c  (mode:100644)
@@ -2812,15 +2893,15 @@
 
 	/* call completion callback */
 	rc = qc->complete_fn(qc, drv_stat);
-	qc->flags &= ~ATA_QCFLAG_ACTIVE;
 
 	/* if callback indicates not to complete command (non-zero),
 	 * return immediately
 	 */
-	if (rc != 0)
+	if (unlikely(rc != 0))
 		return;
 
 	__ata_qc_complete(qc);
+	qc->flags &= ~ATA_QCFLAG_ACTIVE;
 
 	VPRINTK("EXIT\n");
 }
@@ -2884,12 +3026,25 @@
 	ap->ops->qc_prep(qc);
 
 	qc->ap->active_tag = qc->tag;
+
+	rc = ap->ops->qc_issue(qc);
+	if (rc != ATA_QC_ISSUE_OK)
+		goto err_out;
+
 	qc->flags |= ATA_QCFLAG_ACTIVE;
 
-	return ap->ops->qc_issue(qc);
+	if (qc->flags & ATA_QCFLAG_NCQ) {
+		assert(ap->ncq_depth < ATA_MAX_QUEUE)
+		ap->ncq_depth++;
+	} else {
+		assert(!ap->depth);
+		ap->depth++;
+	}
 
+	return ATA_QC_ISSUE_OK;
 err_out:
-	return -1;
+	ata_qc_free(qc);
+	return rc;
 }
 
 /**


-- 
Jens Axboe


  reply	other threads:[~2005-05-27  7:32 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-26 14:00 Playing with SATA NCQ Jens Axboe
2005-05-26 16:25 ` Jeff Garzik
2005-05-26 17:07   ` Jens Axboe
2005-05-26 17:11     ` Jens Axboe
2005-05-26 17:15       ` Jeff Garzik
2005-05-26 17:33         ` Jens Axboe
2005-05-26 19:49     ` Jeff Garzik
2005-05-26 20:30       ` Jens Axboe
2005-05-27  7:20   ` Jens Axboe
2005-05-27  7:29     ` Jeff Garzik
2005-05-27  7:33       ` Jens Axboe [this message]
2005-05-27  7:51         ` Jeff Garzik
2005-05-27  8:00           ` Jens Axboe
2005-05-27  8:23             ` Jeff Garzik
2005-05-26 21:50 ` Mark Lord
2005-05-27  6:28   ` Jens Axboe
2005-05-27  6:58     ` Jeff Garzik
2005-05-27  7:15       ` Jens Axboe
2005-05-27  4:41 ` Jeff Garzik
2005-05-27  6:39   ` Jens Axboe
2005-05-27 21:40 ` Michael Thonke
2005-05-27 22:16   ` Jeff Garzik
2005-05-27 22:30     ` Michael Thonke
2005-05-28 12:12       ` Jens Axboe
2005-05-29 13:01         ` Michael Thonke
2005-05-29 14:09           ` Mark Lord
2005-05-29 14:24             ` Tyler
2005-05-29 15:22               ` Eric D. Mudama
2005-05-29 19:04             ` Jens Axboe
2005-05-29 19:05               ` Jeff Garzik
2005-05-29 19:21                 ` Jens Axboe
2005-05-29 19:03           ` Jens Axboe
2005-05-29 20:12             ` Michael Thonke
2005-05-29 20:17               ` Jeff Garzik
2005-05-30  6:05                 ` Jens Axboe
2005-05-30  6:07               ` Jens Axboe
2005-05-29 18:10         ` Michael Thonke
2005-05-29 19:06           ` Jens Axboe
2005-05-29 16:03 ` Erik Slagter
2005-05-29 16:34   ` Jeff Garzik
2005-05-29 16:50     ` Erik Slagter
2005-05-29 16:59       ` Jeff Garzik
2005-05-29 17:23         ` Erik Slagter
2005-05-29 17:29           ` Jeff Garzik
2005-05-29 17:45             ` Erik Slagter
2005-05-29 18:01               ` Jeff Garzik
2005-05-29 18:10                 ` Erik Slagter
2005-05-29 18:14                   ` Jeff Garzik
2005-05-29 18:27                 ` Michael Thonke
2005-05-29 18:31                   ` Jeff Garzik
2005-05-29 16:57   ` Michael Thonke
2005-05-29 17:26     ` Erik Slagter
2005-05-30  0:06       ` Mark Lord
2005-05-30  7:29         ` Erik Slagter
2005-05-30 18:09           ` Mark Lord
2005-05-30 18:22             ` Erik Slagter
2005-05-30 18:25               ` Mark Lord
2005-05-30 18:34                 ` Michael Thonke
2005-05-30 18:51                   ` Jeff Garzik
2005-05-30 18:48                 ` Jeff Garzik
2005-05-30 18:50               ` Jeff Garzik
2005-05-30 20:03                 ` Erik Slagter
2005-05-30 20:19                   ` Jeff Garzik
2005-05-31  7:44                     ` Erik Slagter
2005-05-30 23:14                 ` Mark Lord
2005-05-31  7:48                   ` Erik Slagter
2005-05-31  8:05                     ` Patrick McFarland
2005-05-29 21:49 ` Michael Thonke

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=20050527073307.GP1435@suse.de \
    --to=axboe@suse.de \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@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).