lkml.org 
[lkml]   [1998]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: arca-1-against-pre-2.1.127-3
On Mon, 2 Nov 1998, Gerard Roudier wrote:

>Here is the bug report:

I just put out a new arca-6 with a more high level (and fixed) approch to
check if the timer is pending.

Here the interesting part of the new patch. Tell me if you don' t like it:

Index: linux/drivers/scsi/aic7xxx.c
diff -u linux/drivers/scsi/aic7xxx.c:1.1.1.3 linux/drivers/scsi/aic7xxx.c:1.1.1.2.4.4
--- linux/drivers/scsi/aic7xxx.c:1.1.1.3 Sat Oct 24 15:40:46 1998
+++ linux/drivers/scsi/aic7xxx.c Mon Nov 2 00:40:27 1998
@@ -3429,7 +3429,7 @@
* here so that we can delay all re-sent commands for this device for the
* 4 seconds and then have our timer routine pick them back up.
*/
- if(p->dev_timer[i].expires)
+ if( timer_pending(&p->dev_timer[i]) )
{
del_timer(&p->dev_timer[i]);
}
@@ -3482,11 +3482,8 @@
scbq_init(&p->delayed_scbs[i]);
}
if ( (p->delayed_scbs[i].head == NULL) &&
- (p->dev_timer[i].expires) )
- {
+ timer_pending(&p->dev_timer[i]) )
del_timer(&p->dev_timer[i]);
- p->dev_timer[i].expires = 0;
- }
}
}

@@ -4007,7 +4004,7 @@
}
if ( (p->dev_active_cmds[tindex] >=
p->dev_temp_queue_depth[tindex]) ||
- (p->dev_last_reset[tindex] >= (jiffies - (4 * HZ))) )
+ time_after_eq(p->dev_last_reset[tindex], jiffies - 4 * HZ) )
{
#ifdef AIC7XXX_VERBOSE_DEBUGGING
if (aic7xxx_verbose > 0xffff)
@@ -4015,7 +4012,7 @@
p->host_no, CTL_OF_SCB(scb));
#endif
scbq_insert_tail(&p->delayed_scbs[tindex], scb);
- if ( !(p->dev_timer[tindex].expires) &&
+ if ( !timer_pending(&p->dev_timer[tindex]) &&
!(p->dev_active_cmds[tindex]) )
{
p->dev_timer[tindex].expires = p->dev_last_reset[tindex] + (4 * HZ);
@@ -4154,15 +4151,10 @@
#endif
for(i=0; i<MAX_TARGETS; i++)
{
- if ( (p->dev_timer[i].expires) &&
- (p->dev_timer[i].expires <= jiffies) )
+ if ( timer_pending(&p->dev_timer[i]) &&
+ time_before_eq(p->dev_timer[i].expires, jiffies) )
{
- p->dev_timer[i].expires = 0;
- if ( (p->dev_timer[i].prev != NULL) ||
- (p->dev_timer[i].next != NULL) )
- {
- del_timer(&p->dev_timer[i]);
- }
+ del_timer(&p->dev_timer[i]);
p->dev_temp_queue_depth[i] = p->dev_max_queue_depth[i];
j = 0;
while ( ((scb = scbq_remove_head(&p->delayed_scbs[i])) != NULL) &&
@@ -4895,7 +4887,7 @@
p->activescbs--;
scb->flags |= SCB_WAITINGQ | SCB_WAS_BUSY;

- if (p->dev_timer[tindex].expires == 0)
+ if ( !timer_pending(&p->dev_timer[tindex]) )
{
if ( p->dev_active_cmds[tindex] )
{
@@ -7462,7 +7454,7 @@
}

p->host = host;
- p->last_reset = 0;
+ p->last_reset = jiffies;
p->host_no = host->host_no;
host->unique_id = p->instance;
p->isr_count = 0;
@@ -7489,7 +7481,7 @@
p->dev_commands_sent[i] = 0;
p->dev_flags[i] = 0;
p->dev_active_cmds[i] = 0;
- p->dev_last_reset[i] = 0;
+ p->dev_last_reset[i] = jiffies;
p->dev_last_queue_full[i] = 0;
p->dev_last_queue_full_count[i] = 0;
p->dev_max_queue_depth[i] = 1;
@@ -7497,7 +7489,6 @@
p->dev_mid_level_queue_depth[i] = 3;
scbq_init(&p->delayed_scbs[i]);
init_timer(&p->dev_timer[i]);
- p->dev_timer[i].expires = 0;
p->dev_timer[i].data = (unsigned long)p;
p->dev_timer[i].function = (void *)aic7xxx_timer;
}
Index: linux/drivers/scsi/scsi_obsolete.c
diff -u linux/drivers/scsi/scsi_obsolete.c:1.1.1.3 linux/drivers/scsi/scsi_obsolete.c:1.1.1.2.4.5
--- linux/drivers/scsi/scsi_obsolete.c:1.1.1.3 Sat Oct 24 15:40:59 1998
+++ linux/drivers/scsi/scsi_obsolete.c Mon Nov 2 00:41:06 1998
@@ -607,8 +607,10 @@
if ((++SCpnt->retries) < SCpnt->allowed)
{
if ((SCpnt->retries >= (SCpnt->allowed >> 1))
- && !(SCpnt->host->last_reset > 0 &&
- jiffies < SCpnt->host->last_reset + MIN_RESET_PERIOD)
+ /* FIXME: last_reset == 0 is allowed
+ * && !(SCpnt->host->last_reset > 0 */ &&
+ time_before(jiffies, SCpnt->host->last_reset
+ + MIN_RESET_PERIOD)
&& !(SCpnt->flags & WAS_RESET))
{
printk("scsi%d channel %d : resetting for second half of retries.\n",
@@ -954,8 +956,8 @@
host->last_reset = jiffies;
SCpnt->flags |= (WAS_RESET | IS_RESETTING);
temp = host->hostt->reset(SCpnt, reset_flags);
- if ((host->last_reset < jiffies) ||
- (host->last_reset > (jiffies + 20 * HZ)))
+ if (time_before(host->last_reset, jiffies) ||
+ (time_after(host->last_reset, jiffies + 20 * HZ)))
host->last_reset = jiffies;
if (!host->block) host->host_busy--;
}
@@ -1070,7 +1072,7 @@
* timers for timeout.
*/

- if( SCset->eh_timeout.expires == 0 )
+ if( !timer_pending(&SCset->eh_timeout) )
{
rtn = 0;
}
Index: linux/include/linux/timer.h
diff -u linux/include/linux/timer.h:1.1.1.1 linux/include/linux/timer.h:1.1.1.1.14.2
--- linux/include/linux/timer.h:1.1.1.1 Fri Oct 2 19:22:40 1998
+++ linux/include/linux/timer.h Mon Nov 2 00:41:21 1998
@@ -84,9 +84,24 @@
return((long)((a) - (b)) < 0L);
}

+extern inline int time_before_eq(unsigned long a, unsigned long b)
+{
+ return((long)((a) - (b)) <= 0L);
+}
+
extern inline int time_after(unsigned long a, unsigned long b)
{
return((long)((a) - (b)) > 0L);
+}
+
+extern inline int time_after_eq(unsigned long a, unsigned long b)
+{
+ return((long)((a) - (b)) >= 0L);
+}
+
+extern inline int timer_pending(struct timer_list * timer)
+{
+ return timer->prev || timer->next;
}

#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.119 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site