From: Matthew Wilcox <matthew@wil.cx>
To: linux-scsi@vger.kernel.org
Cc: Matthew Wilcox <matthew@wil.cx>, Matthew Wilcox <willy@linux.intel.com>
Subject: [PATCH 6/17] sym53c8xx: Stop overriding scsi_done
Date: Fri, 5 Oct 2007 15:55:03 -0400 [thread overview]
Message-ID: <1191614114683-git-send-email-matthew@wil.cx> (raw)
In-Reply-To: <11916141143747-git-send-email-matthew@wil.cx>
Instead of telling the reset routine that the command completed from
sym_eh_done, do it from sym_xpt_done. The 'to_do' element of the ucmd
is redundant -- it serves only to tell whether eh_done is valid or not,
and we can tell this by checking to see if it's NULL.
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
drivers/scsi/sym53c8xx_2/sym_glue.c | 60 ++++++++++------------------------
1 files changed, 18 insertions(+), 42 deletions(-)
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 4d49a9b..6bc8789 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -134,8 +134,6 @@ static struct scsi_transport_template *sym2_transport_template = NULL;
* Driver private area in the SCSI command structure.
*/
struct sym_ucmd { /* Override the SCSI pointer structure */
- unsigned char to_do; /* For error handling */
- void (*old_done)(struct scsi_cmnd *); /* For error handling */
struct completion *eh_done; /* For error handling */
};
@@ -147,6 +145,12 @@ struct sym_ucmd { /* Override the SCSI pointer structure */
*/
void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd)
{
+ struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
+ BUILD_BUG_ON(sizeof(struct scsi_pointer) < sizeof(struct sym_ucmd));
+
+ if (ucmd->eh_done)
+ complete(ucmd->eh_done);
+
scsi_dma_unmap(cmd);
cmd->scsi_done(cmd);
}
@@ -586,26 +590,6 @@ static void sym53c8xx_timer(unsigned long npref)
#define SYM_EH_HOST_RESET 3
/*
- * What we will do regarding the involved SCSI command.
- */
-#define SYM_EH_DO_IGNORE 0
-#define SYM_EH_DO_WAIT 2
-
-/*
- * scsi_done() alias when error recovery is in progress.
- */
-static void sym_eh_done(struct scsi_cmnd *cmd)
-{
- struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
- BUILD_BUG_ON(sizeof(struct scsi_pointer) < sizeof(struct sym_ucmd));
-
- cmd->scsi_done = ucmd->old_done;
-
- if (ucmd->to_do == SYM_EH_DO_WAIT)
- complete(ucmd->eh_done);
-}
-
-/*
* Generic method for our eh processing.
* The 'op' argument tells what we have to do.
*/
@@ -615,7 +599,7 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
struct Scsi_Host *host = cmd->device->host;
SYM_QUEHEAD *qp;
- int to_do = SYM_EH_DO_IGNORE;
+ int cmd_queued = 0;
int sts = -1;
struct completion eh_done;
@@ -626,19 +610,11 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) {
struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq);
if (cp->cmd == cmd) {
- to_do = SYM_EH_DO_WAIT;
+ cmd_queued = 1;
break;
}
}
- if (to_do == SYM_EH_DO_WAIT) {
- init_completion(&eh_done);
- ucmd->old_done = cmd->scsi_done;
- ucmd->eh_done = &eh_done;
- wmb();
- cmd->scsi_done = sym_eh_done;
- }
-
/* Try to proceed the operation we have been asked for */
sts = -1;
switch(op) {
@@ -662,21 +638,21 @@ static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
}
/* On error, restore everything and cross fingers :) */
- if (sts) {
- cmd->scsi_done = ucmd->old_done;
- to_do = SYM_EH_DO_IGNORE;
- }
-
- ucmd->to_do = to_do;
- spin_unlock_irq(host->host_lock);
+ if (sts)
+ cmd_queued = 0;
- if (to_do == SYM_EH_DO_WAIT) {
+ if (cmd_queued) {
+ init_completion(&eh_done);
+ ucmd->eh_done = &eh_done;
+ spin_unlock_irq(host->host_lock);
if (!wait_for_completion_timeout(&eh_done, 5*HZ)) {
- ucmd->to_do = SYM_EH_DO_IGNORE;
- wmb();
+ ucmd->eh_done = NULL;
sts = -2;
}
+ } else {
+ spin_unlock_irq(host->host_lock);
}
+
dev_warn(&cmd->device->sdev_gendev, "%s operation %s.\n", opname,
sts==0 ? "complete" :sts==-2 ? "timed-out" : "failed");
return sts ? SCSI_FAILED : SCSI_SUCCESS;
--
1.4.4.2
next prev parent reply other threads:[~2007-10-05 19:55 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-05 19:54 [PATCH 1/17] sym53c8xx: Work around 53c896 erratum Matthew Wilcox
2007-10-05 19:54 ` [PATCH 2/17] sym53c8xx: Use pci_dev irq number Matthew Wilcox
2007-10-05 20:51 ` Jeff Garzik
2007-10-05 19:55 ` [PATCH 3/17] sym53c8xx: Remove data_mapping and data_mapped Matthew Wilcox
2007-10-05 20:52 ` Jeff Garzik
2007-10-05 19:55 ` [PATCH 4/17] sym53c8xx: Remove unnecessary check in queuecommand Matthew Wilcox
2007-10-05 19:55 ` [PATCH 5/17] sym53c8xx: Don't disable interrupts in the interrupt handler Matthew Wilcox
2007-10-05 19:55 ` Matthew Wilcox [this message]
2007-10-05 19:55 ` [PATCH 7/17] sym53c8xx: PCI Error Recovery support Matthew Wilcox
2007-10-05 20:54 ` Jeff Garzik
2007-10-05 19:55 ` [PATCH 8/17] sym53c8xx: Use pdev->revision Matthew Wilcox
2007-10-05 19:55 ` [PATCH 9/17] sym53c8xx: Remove ->device_id Matthew Wilcox
2007-10-05 19:55 ` [PATCH 10/17] sym53c8xx: Remove io_ws, mmio_ws and ram_ws elements Matthew Wilcox
2007-10-05 20:55 ` Jeff Garzik
2007-10-05 19:55 ` [PATCH 11/17] sym53c8xx: Remove tag_ctrl module parameter Matthew Wilcox
2007-10-05 20:56 ` Jeff Garzik
2007-10-09 15:35 ` Matthew Wilcox
2007-10-05 19:55 ` [PATCH 12/17] sym53c8xx: Simplify DAC DMA handling Matthew Wilcox
2007-10-05 19:55 ` [PATCH 13/17] sym53c8xx: Use scmd_printk where appropriate Matthew Wilcox
2007-10-05 20:59 ` Jeff Garzik
2007-10-05 19:55 ` [PATCH 14/17] sym53c8xx: Get rid of IRQ_FMT and IRQ_PRM Matthew Wilcox
2007-10-05 20:59 ` Jeff Garzik
2007-10-09 15:28 ` Matthew Wilcox
2007-10-09 15:35 ` Jeff Garzik
2007-10-09 15:44 ` Matthew Wilcox
2007-10-09 15:47 ` Jeff Garzik
2007-10-05 19:55 ` [PATCH 15/17] sym53c8xx: Make interrupt handler capable of returning IRQ_NONE Matthew Wilcox
2007-10-05 21:04 ` Jeff Garzik
2007-10-05 19:55 ` [PATCH 16/17] sym53c8xx: Remove pci_dev pointer from sym_shcb Matthew Wilcox
2007-10-05 21:07 ` Jeff Garzik
2007-10-09 15:27 ` Matthew Wilcox
2007-10-05 19:55 ` [PATCH 17/17] sym53c8xx: Remove sym_xpt_async_sent_bdr Matthew Wilcox
2007-10-05 21:07 ` 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=1191614114683-git-send-email-matthew@wil.cx \
--to=matthew@wil.cx \
--cc=linux-scsi@vger.kernel.org \
--cc=willy@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.