From: Tejun Heo <htejun@gmail.com>
To: James.Bottomley@steeleye.com, axboe@suse.de,
Christoph Hellwig <hch@infradead.org>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH scsi-misc-2.6 05/07] scsi: unexport scsi_{add|delete}_timer()
Date: Mon, 11 Apr 2005 03:45:31 +0900 (KST) [thread overview]
Message-ID: <20050410184214.B4CD5D43@htj.dyndns.org> (raw)
In-Reply-To: <20050410184214.4AAD0992@htj.dyndns.org>
05_scsi_timer_unexport_timer_functions.patch
SCSI cmd timer has specific synchronization/semantic
requirements and shouldn't be directly used outside SCSI
midlayer. With aic7xxx driver updated, there's no user left.
This patch unexports scsi_{add|delete}_timer() routines and
also removes @complete argument from scsi_add_timer(). The
change makes the use of scsi_times_out() confined in
scsi_error.c, so move it upward such that no prototype is
needed and make it static.
Signed-off-by: Tejun Heo <htejun@gmail.com>
drivers/scsi/scsi.c | 2 -
drivers/scsi/scsi_error.c | 80 +++++++++++++++++++++-------------------------
drivers/scsi/scsi_priv.h | 3 +
include/scsi/scsi_eh.h | 3 -
4 files changed, 41 insertions(+), 47 deletions(-)
Index: scsi-reqfn-export/drivers/scsi/scsi.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi.c 2005-04-11 03:42:12.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi.c 2005-04-11 03:42:12.000000000 +0900
@@ -600,7 +600,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *
* AK: unlikely race here: for some reason the timer could
* expire before the serial number is set up below.
*/
- scsi_add_timer(cmd, cmd->timeout_per_command, scsi_times_out);
+ scsi_add_timer(cmd, cmd->timeout_per_command);
scsi_log_send(cmd);
Index: scsi-reqfn-export/drivers/scsi/scsi_error.c
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_error.c 2005-04-11 03:42:12.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_error.c 2005-04-11 03:42:12.000000000 +0900
@@ -88,6 +88,42 @@ int scsi_eh_scmd_add(struct scsi_cmnd *s
}
/**
+ * scsi_times_out - Timeout function for normal scsi commands.
+ * @scmd: Cmd that is timing out.
+ *
+ * Notes:
+ * We do not need to lock this. There is the potential for a race
+ * only in that the normal completion handling might run, but if the
+ * normal completion function determines that the timer has already
+ * fired, then it mustn't do anything.
+ **/
+static void scsi_times_out(struct scsi_cmnd *scmd)
+{
+ scsi_log_completion(scmd, TIMEOUT_ERROR);
+
+ if (scmd->device->host->hostt->eh_timed_out)
+ switch (scmd->device->host->hostt->eh_timed_out(scmd)) {
+ case EH_HANDLED:
+ __scsi_done(scmd);
+ return;
+ case EH_RESET_TIMER:
+ /* This allows a single retry even of a command
+ * with allowed == 0 */
+ if (scmd->retries++ > scmd->allowed)
+ break;
+ scsi_add_timer(scmd, scmd->timeout_per_command);
+ return;
+ case EH_NOT_HANDLED:
+ break;
+ }
+
+ if (unlikely(!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) {
+ panic("Error handler thread not present at %p %p %s %d",
+ scmd, scmd->device->host, __FILE__, __LINE__);
+ }
+}
+
+/**
* scsi_add_timer - Start timeout timer for a single scsi command.
* @scmd: scsi command that is about to start running.
* @timeout: amount of time to allow this command to run.
@@ -98,8 +134,7 @@ int scsi_eh_scmd_add(struct scsi_cmnd *s
* has its own timer, and as it is added to the queue, we set up the
* timer. When the command completes, we cancel the timer.
**/
-void scsi_add_timer(struct scsi_cmnd *scmd, int timeout,
- void (*complete)(struct scsi_cmnd *))
+void scsi_add_timer(struct scsi_cmnd *scmd, int timeout)
{
/*
@@ -112,7 +147,7 @@ void scsi_add_timer(struct scsi_cmnd *sc
scmd->eh_timeout.data = (unsigned long)scmd;
scmd->eh_timeout.expires = jiffies + timeout;
- scmd->eh_timeout.function = (void (*)(unsigned long)) complete;
+ scmd->eh_timeout.function = (void (*)(unsigned long))scsi_times_out;
SCSI_LOG_ERROR_RECOVERY(5, printk("%s: scmd: %p, time:"
" %d, (%p)\n", __FUNCTION__,
@@ -120,7 +155,6 @@ void scsi_add_timer(struct scsi_cmnd *sc
add_timer(&scmd->eh_timeout);
}
-EXPORT_SYMBOL(scsi_add_timer);
/**
* scsi_delete_timer - Delete/cancel timer for a given function.
@@ -148,44 +182,6 @@ int scsi_delete_timer(struct scsi_cmnd *
return rtn;
}
-EXPORT_SYMBOL(scsi_delete_timer);
-
-/**
- * scsi_times_out - Timeout function for normal scsi commands.
- * @scmd: Cmd that is timing out.
- *
- * Notes:
- * We do not need to lock this. There is the potential for a race
- * only in that the normal completion handling might run, but if the
- * normal completion function determines that the timer has already
- * fired, then it mustn't do anything.
- **/
-void scsi_times_out(struct scsi_cmnd *scmd)
-{
- scsi_log_completion(scmd, TIMEOUT_ERROR);
-
- if (scmd->device->host->hostt->eh_timed_out)
- switch (scmd->device->host->hostt->eh_timed_out(scmd)) {
- case EH_HANDLED:
- __scsi_done(scmd);
- return;
- case EH_RESET_TIMER:
- /* This allows a single retry even of a command
- * with allowed == 0 */
- if (scmd->retries++ > scmd->allowed)
- break;
- scsi_add_timer(scmd, scmd->timeout_per_command,
- scsi_times_out);
- return;
- case EH_NOT_HANDLED:
- break;
- }
-
- if (unlikely(!scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) {
- panic("Error handler thread not present at %p %p %s %d",
- scmd, scmd->device->host, __FILE__, __LINE__);
- }
-}
/**
* scsi_block_when_processing_errors - Prevent cmds from being queued.
Index: scsi-reqfn-export/drivers/scsi/scsi_priv.h
===================================================================
--- scsi-reqfn-export.orig/drivers/scsi/scsi_priv.h 2005-04-11 03:42:11.000000000 +0900
+++ scsi-reqfn-export/drivers/scsi/scsi_priv.h 2005-04-11 03:42:12.000000000 +0900
@@ -84,7 +84,8 @@ extern int __init scsi_init_devinfo(void
extern void scsi_exit_devinfo(void);
/* scsi_error.c */
-extern void scsi_times_out(struct scsi_cmnd *cmd);
+extern void scsi_add_timer(struct scsi_cmnd *scmd, int timeout);
+extern int scsi_delete_timer(struct scsi_cmnd *scmd);
extern int scsi_error_handler(void *host);
extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
extern void scsi_eh_wakeup(struct Scsi_Host *shost);
Index: scsi-reqfn-export/include/scsi/scsi_eh.h
===================================================================
--- scsi-reqfn-export.orig/include/scsi/scsi_eh.h 2005-04-11 03:42:10.000000000 +0900
+++ scsi-reqfn-export/include/scsi/scsi_eh.h 2005-04-11 03:42:12.000000000 +0900
@@ -27,9 +27,6 @@ struct scsi_sense_hdr { /* See SPC-3 se
};
-extern void scsi_add_timer(struct scsi_cmnd *, int,
- void (*)(struct scsi_cmnd *));
-extern int scsi_delete_timer(struct scsi_cmnd *);
extern void scsi_report_bus_reset(struct Scsi_Host *, int);
extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
extern int scsi_block_when_processing_errors(struct scsi_device *);
next prev parent reply other threads:[~2005-04-10 18:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-10 18:45 [PATCH scsi-misc-2.6 00/07] scsi: timer updates Tejun Heo
2005-04-10 18:45 ` [PATCH scsi-misc-2.6 01/07] scsi: make aic7xxx use its own timer instead of scmd->eh_timeout Tejun Heo
2005-04-10 18:45 ` [PATCH scsi-misc-2.6 02/07] scsi: make scsi_send_eh_cmnd " Tejun Heo
2005-04-18 15:33 ` James Bottomley
2005-04-18 22:31 ` Tejun Heo
2005-04-18 22:55 ` James Bottomley
2005-04-18 23:25 ` Tejun Heo
2005-04-10 18:45 ` [PATCH scsi-misc-2.6 03/07] scsi: remove a timer race in scsi_queue_insert() Tejun Heo
2005-04-10 18:45 ` [PATCH scsi-misc-2.6 04/07] scsi: remove unnecessary scsi_delete_timer() call in scsi_reset_provider() Tejun Heo
2005-04-10 18:45 ` Tejun Heo [this message]
2005-04-10 18:45 ` [PATCH scsi-misc-2.6 06/07] scsi: Delete scsi_{add|delete}_timer() from scsi_mid_low_api.txt Tejun Heo
2005-04-10 18:45 ` [PATCH scsi-misc-2.6 07/07] scsi: make reuse of SCSI cmd timer strict Tejun Heo
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=20050410184214.B4CD5D43@htj.dyndns.org \
--to=htejun@gmail.com \
--cc=James.Bottomley@steeleye.com \
--cc=axboe@suse.de \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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
all inboxes | Powered by JetHome®