From: Tejun Heo <htejun@gmail.com>
To: jgarzik@pobox.com, alan@lxorguk.ukuu.org.uk, axboe@suse.de,
albertcc@tw.ibm.com, lkosewsk@gmail.com,
linux-ide@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 03/15] libata-ncq: pass ata_scsi_translate() return value to SCSI midlayer
Date: Tue, 11 Apr 2006 22:53:36 +0900 [thread overview]
Message-ID: <11447636161898-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <1144763616819-git-send-email-htejun@gmail.com>
ata_scsi_translate() will need to return SCSI_ML_QUEUE_DEVICE_BUSY to
achieve exlusion between NCQ and non-NCQ commands or among non-NCQ
commands. Pass its return value upward to SCSI midlayer.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
drivers/scsi/libata-scsi.c | 34 +++++++++++++++++++++-------------
1 files changed, 21 insertions(+), 13 deletions(-)
3fd6c2e278004c2fddf09099560b9630a352fba4
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 1c1b510..c978a5d 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1251,9 +1251,12 @@ static void ata_scsi_qc_complete(struct
*
* LOCKING:
* spin_lock_irqsave(host_set lock)
+ *
+ * RETURNS:
+ * 0 on success, SCSI_ML_QUEUE_DEVICE_BUSY if the command
+ * needs to be deferred.
*/
-
-static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev,
+static int ata_scsi_translate(struct ata_port *ap, struct ata_device *dev,
struct scsi_cmnd *cmd,
void (*done)(struct scsi_cmnd *),
ata_xlat_func_t xlat_func)
@@ -1294,13 +1297,13 @@ static void ata_scsi_translate(struct at
ata_qc_issue(qc);
VPRINTK("EXIT\n");
- return;
+ return 0;
early_finish:
ata_qc_free(qc);
done(cmd);
DPRINTK("EXIT - early finish (good or error)\n");
- return;
+ return 0;
err_did:
ata_qc_free(qc);
@@ -1308,7 +1311,7 @@ err_mem:
cmd->result = (DID_ERROR << 16);
done(cmd);
DPRINTK("EXIT - internal\n");
- return;
+ return 0;
}
/**
@@ -2459,19 +2462,23 @@ static inline void ata_scsi_dump_cdb(str
#endif
}
-static inline void __ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
- struct ata_port *ap, struct ata_device *dev)
+static inline int __ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
+ struct ata_port *ap, struct ata_device *dev)
{
+ int rc = 0;
+
if (dev->class == ATA_DEV_ATA) {
ata_xlat_func_t xlat_func = ata_get_xlat_func(dev,
cmd->cmnd[0]);
if (xlat_func)
- ata_scsi_translate(ap, dev, cmd, done, xlat_func);
+ rc = ata_scsi_translate(ap, dev, cmd, done, xlat_func);
else
ata_scsi_simulate(ap, dev, cmd, done);
} else
- ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);
+ rc = ata_scsi_translate(ap, dev, cmd, done, atapi_xlat);
+
+ return rc;
}
/**
@@ -2490,15 +2497,16 @@ static inline void __ata_scsi_queuecmd(s
* Releases scsi-layer-held lock, and obtains host_set lock.
*
* RETURNS:
- * Zero.
+ * Return value from __ata_scsi_queuecmd() if @cmd can be queued,
+ * 0 otherwise.
*/
-
int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
{
struct ata_port *ap;
struct ata_device *dev;
struct scsi_device *scsidev = cmd->device;
struct Scsi_Host *shost = scsidev->host;
+ int rc = 0;
ap = (struct ata_port *) &shost->hostdata[0];
@@ -2509,7 +2517,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *
dev = ata_scsi_find_dev(ap, scsidev);
if (likely(dev))
- __ata_scsi_queuecmd(cmd, done, ap, dev);
+ rc = __ata_scsi_queuecmd(cmd, done, ap, dev);
else {
cmd->result = (DID_BAD_TARGET << 16);
done(cmd);
@@ -2517,7 +2525,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *
spin_unlock(&ap->host_set->lock);
spin_lock(shost->host_lock);
- return 0;
+ return rc;
}
/**
--
1.2.4
next prev parent reply other threads:[~2006-04-11 13:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-11 13:53 [PATCHSET 7/9] add NCQ support, take 2 Tejun Heo
2006-04-11 13:53 ` [PATCH 06/15] libata-ncq: implement NCQ command translation Tejun Heo
2006-04-11 13:53 ` Tejun Heo [this message]
2006-04-11 13:53 ` [PATCH 07/15] libata-ncq: implement ata_eh_read_log_10h() Tejun Heo
2006-04-11 13:53 ` [PATCH 05/15] libata-ncq: implement command exclusion Tejun Heo
2006-04-11 13:53 ` [PATCH 01/15] libata-ncq: add NCQ related ATA constants and id macros Tejun Heo
2006-04-11 13:53 ` [PATCH 02/15] libata-ncq: add NCQ related libata flags Tejun Heo
2006-04-11 13:53 ` [PATCH 04/15] libata-ncq: implement ap->sactive Tejun Heo
2006-04-11 13:53 ` [PATCH 12/15] ahci: add HOST_CAP_NCQ constant Tejun Heo
2006-04-11 13:53 ` [PATCH 11/15] ahci: clean up AHCI constants in preparation for NCQ Tejun Heo
2006-04-11 13:53 ` [PATCH 15/15] sata_sil24: implement NCQ support Tejun Heo
2006-04-11 13:53 ` [PATCH 10/15] libata-ncq: implement ata_ncq_complete() Tejun Heo
2006-04-11 13:53 ` [PATCH 13/15] ahci: kill pp->cmd_tbl_sg Tejun Heo
2006-04-11 13:53 ` [PATCH 09/15] libata-ncq: implement NCQ device configuration Tejun Heo
2006-04-11 13:53 ` [PATCH 14/15] ahci: implement NCQ suppport Tejun Heo
2006-04-11 13:53 ` [PATCH 08/15] libata-ncq: update EH to handle NCQ Tejun Heo
2006-04-27 9:11 ` [PATCHSET 7/9] add NCQ support, take 2 Jeff Garzik
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=11447636161898-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=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=lkosewsk@gmail.com \
/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).