diff options
author | Tejun Heo <htejun@gmail.com> | 2006-03-31 06:41:11 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-31 10:14:42 -0500 |
commit | 8e0e694a3a48212bfe29a9ad3cd592bf68dfec81 (patch) | |
tree | 82f2b114160c8f1a6537c471fea7b41e50a80814 | |
parent | e4a70e76add280db6068426716a9b2a74099144f (diff) |
[PATCH] libata: make ata_qc_issue complete failed qcs
There is no reason for the issuer to diddle with a failed qc as the
issuer has complete control over when a qc gets freed (usually in
->complete_fn). Make ata_qc_issue() responsible for completing qcs
which failed to issue.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/scsi/libata-core.c | 20 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 8 | ||||
-rw-r--r-- | drivers/scsi/libata.h | 2 |
3 files changed, 12 insertions, 18 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index eb4df01d9fa0..63ae23b5c078 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -989,9 +989,7 @@ ata_exec_internal(struct ata_port *ap, struct ata_device *dev, | |||
989 | qc->private_data = &wait; | 989 | qc->private_data = &wait; |
990 | qc->complete_fn = ata_qc_complete_internal; | 990 | qc->complete_fn = ata_qc_complete_internal; |
991 | 991 | ||
992 | qc->err_mask = ata_qc_issue(qc); | 992 | ata_qc_issue(qc); |
993 | if (qc->err_mask) | ||
994 | ata_qc_complete(qc); | ||
995 | 993 | ||
996 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 994 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
997 | 995 | ||
@@ -3997,12 +3995,8 @@ static inline int ata_should_dma_map(struct ata_queued_cmd *qc) | |||
3997 | * | 3995 | * |
3998 | * LOCKING: | 3996 | * LOCKING: |
3999 | * spin_lock_irqsave(host_set lock) | 3997 | * spin_lock_irqsave(host_set lock) |
4000 | * | ||
4001 | * RETURNS: | ||
4002 | * Zero on success, AC_ERR_* mask on failure | ||
4003 | */ | 3998 | */ |
4004 | 3999 | void ata_qc_issue(struct ata_queued_cmd *qc) | |
4005 | unsigned int ata_qc_issue(struct ata_queued_cmd *qc) | ||
4006 | { | 4000 | { |
4007 | struct ata_port *ap = qc->ap; | 4001 | struct ata_port *ap = qc->ap; |
4008 | 4002 | ||
@@ -4023,14 +4017,18 @@ unsigned int ata_qc_issue(struct ata_queued_cmd *qc) | |||
4023 | 4017 | ||
4024 | ap->ops->qc_prep(qc); | 4018 | ap->ops->qc_prep(qc); |
4025 | 4019 | ||
4026 | return ap->ops->qc_issue(qc); | 4020 | qc->err_mask |= ap->ops->qc_issue(qc); |
4021 | if (unlikely(qc->err_mask)) | ||
4022 | goto err; | ||
4023 | return; | ||
4027 | 4024 | ||
4028 | sg_err: | 4025 | sg_err: |
4029 | qc->flags &= ~ATA_QCFLAG_DMAMAP; | 4026 | qc->flags &= ~ATA_QCFLAG_DMAMAP; |
4030 | return AC_ERR_SYSTEM; | 4027 | qc->err_mask |= AC_ERR_SYSTEM; |
4028 | err: | ||
4029 | ata_qc_complete(qc); | ||
4031 | } | 4030 | } |
4032 | 4031 | ||
4033 | |||
4034 | /** | 4032 | /** |
4035 | * ata_qc_issue_prot - issue taskfile to device in proto-dependent manner | 4033 | * ata_qc_issue_prot - issue taskfile to device in proto-dependent manner |
4036 | * @qc: command to issue to device | 4034 | * @qc: command to issue to device |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 628191bfd990..53f5b0d9161c 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1431,9 +1431,7 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev, | |||
1431 | goto early_finish; | 1431 | goto early_finish; |
1432 | 1432 | ||
1433 | /* select device, send command to hardware */ | 1433 | /* select device, send command to hardware */ |
1434 | qc->err_mask = ata_qc_issue(qc); | 1434 | ata_qc_issue(qc); |
1435 | if (qc->err_mask) | ||
1436 | ata_qc_complete(qc); | ||
1437 | 1435 | ||
1438 | VPRINTK("EXIT\n"); | 1436 | VPRINTK("EXIT\n"); |
1439 | return; | 1437 | return; |
@@ -2199,9 +2197,7 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) | |||
2199 | 2197 | ||
2200 | qc->complete_fn = atapi_sense_complete; | 2198 | qc->complete_fn = atapi_sense_complete; |
2201 | 2199 | ||
2202 | qc->err_mask = ata_qc_issue(qc); | 2200 | ata_qc_issue(qc); |
2203 | if (qc->err_mask) | ||
2204 | ata_qc_complete(qc); | ||
2205 | 2201 | ||
2206 | DPRINTK("EXIT\n"); | 2202 | DPRINTK("EXIT\n"); |
2207 | } | 2203 | } |
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 65f52beea884..1c755b14521a 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -47,7 +47,7 @@ extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
47 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 47 | extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
48 | extern void ata_port_flush_task(struct ata_port *ap); | 48 | extern void ata_port_flush_task(struct ata_port *ap); |
49 | extern void ata_qc_free(struct ata_queued_cmd *qc); | 49 | extern void ata_qc_free(struct ata_queued_cmd *qc); |
50 | extern unsigned int ata_qc_issue(struct ata_queued_cmd *qc); | 50 | extern void ata_qc_issue(struct ata_queued_cmd *qc); |
51 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); | 51 | extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); |
52 | extern void ata_dev_select(struct ata_port *ap, unsigned int device, | 52 | extern void ata_dev_select(struct ata_port *ap, unsigned int device, |
53 | unsigned int wait, unsigned int can_sleep); | 53 | unsigned int wait, unsigned int can_sleep); |