2000-11-30 02:52:02

by Matthew Jacob

[permalink] [raw]
Subject: [ PATCH ] externalize (new) scsi timer functions (fwd)

Late in the game, and possibly questionable, but it would be helpful to have
the (new) scsi timer functions externalized so that loadable HBA modules can
easily see them.

This is needed because, particularly for Fibre Channel, it's only the HBA that
knows when a command is actually sent to the device as opposed to being
(temporarily) queued up locally while some Fibre Channel or SCSI reset
wreckage is being cleared. The time limit for a command should be while it's
actually active- not while it's waiting to be started.

The alternative of returning commands as having not been queued doesn't work
as well because of race conditions. You can, with several type os HBA, get
cases of having queued up one or more commands and after returning success to
the midlayer, still get an interrupt that says, "that command you thought I
started? Ooops... Sorry. I lied. I couldn't get it started, but it's really
okay to start it now...".

At any rate- it's a minor change, which I've been using for a bit, which
really only is an aid to the case that you have a loadable module that wants
this symbol (natuarally, resident drivers don't care). The only real downside
to any of this is that effectively use the scsi_add_timer to restart a timer
is that you have to use a portion of the Scsi_Cmnd that is not marked as
public. An alternative could be to change the midlayer to add a function to
pause and restart the timer.


--- linux.orig/drivers/scsi/scsi_syms.c Wed Nov 29 18:19:45 2000
+++ linux/drivers/scsi/scsi_syms.c Wed Nov 29 18:18:35 2000
@@ -91,3 +91,10 @@

+ * Externalize timers so that HBAs can safely start/restart commands.
+ */
+extern void scsi_add_timer(Scsi_Cmnd *, int, void ((*) (Scsi_Cmnd *)));
+extern int scsi_delete_timer(Scsi_Cmnd *);