Badblock reporting and timeout fixes for wd.c, interm hacks.
authorBrett Lymn <blymn@mulga.awadi.com.AU>
Mon, 17 May 1993 00:00:00 +0000 (00:00 +0000)
committerBrett Lymn <blymn@mulga.awadi.com.AU>
Mon, 17 May 1993 00:00:00 +0000 (00:00 +0000)
commitc8274f234703ac5d50553ddf853cbe9791d5525f
tree38fb1a5d3d1623bbc42a72813a683c9b5525df87
parent42d414703b3ab6f26b923db2b6357664eadf5b94
Badblock reporting and timeout fixes for wd.c, interm hacks.

Right now, if the user executes dd if=/dev/rwd0c of=/dev/null
bs=conv,noerror, the kernel will not report any bad blocks it encounters.
The version of bad144 by Jim Bevier will not work without this patch.

Looking at the affected code, it seems that the wd driver should only
be turning off kernel error messages on partition d (WDRAW is 3), but that is
not the case.  My guess is that the kernel is calling wdopen on partition d
even if one is trying to dd from wd0a.  Actually, can you think of any valid
cases where the DKFL_QUIET flag should be set?  It seems to me that the user
would always want to know when an umapped bad block is encountered.  Because
checking the DKFL_QUIET flag does take some cycles, we might as well remove it
complete from wd.c if we think we would always want error messages enabled.  If
you think that is a good idea, then I can produce another patch to do that.

Terry
Date: Tue, 6 Apr 1993 13:05:03 -0500

The Problem:
        On my 486/25 with a DTC controller and Seagate Wren ESDI disk
I would sometimes experience a system lockup where the computer would
just sit there with the disk controller led on all the time.  This
lock up would occur usually when I was doing some disk intensive
activity like making /usr/src or committing things to CVS.

The Fix:
        In wd.c there is a function called wdstart that has three
while loops that loop waiting for the controller/disk to come ready.
In my case the disk sometimes would never become ready so the system
would hang in wdstart.  I have inserted timeout code into all the
while loops in wdstart so that if the controller or disk are busy for
too long then the controller is reset and the command is restarted.
The code is written so that you can override the default timeout by
putting the WDCTIMEOUT option in the kernel config file with the
approriate number.

Brett Lymn                              | "Hey, you can't do that here"
Date: Sat, 10 Apr 1993 16:35:34 +0930 (CST)

Additional fixes:
There where still several spin wait loops that used a hard
coded constant of 1000000, these have been replaced with WDCTIMEOUT.
I also increased WDCTIMEOUT to 10000000 per Bruce Evans as now that
the spl code is so fast it seems to be needed.

Rod Grimes
Date: Mon May 17 10:01:50 PDT 1993

AUTHOR: Terry Lee <terry@uivlsisd.csl.uiuc.edu>
AUTHOR: Brett Lymn (blymn@mulga.awadi.com.AU)
AUTHOR: Rodney W. Grimes (rgrimes@agora.rain.com)
386BSD-Patchkit: patch00155
usr/src/sys.386bsd/i386/isa/wd.c