Commit Graph

320 Commits

Author SHA1 Message Date
Greg Lehey
37669c86d4 requeststatus: Correct check for striped plex.
Submitted-by:	Matthew Reimer <mreimer@vpop.net>
2000-05-04 07:46:45 +00:00
Greg Lehey
16a3348dbf Don't hide bio structure behind macros like b_ioflags.
Get counting volume I/Os right.

launch_requests: Be macho, throw away the safety net and walk the
tightrope with no splbio().

Add some comments explaining the smoke and mirrors.

Remove some redundant braces.

sdio: Set the state of an accessed but down subdisk correctly.  This
appears to duplicate an earlier commit that I hadn't seen.
2000-05-04 07:44:23 +00:00
Greg Lehey
bf7dfe61ab expand_table: Avoid a race condition which may have been contributing
to the random corruption, panics and hangs we've been seeing in RAID-5
plexes, particularly with ata drives.

Eagerly-awaited-by: sos
2000-05-04 07:38:47 +00:00
Greg Lehey
9702452a12 lockrange: Avoid a race condition which was causing random corruption,
panics and hangs in RAID-5 plexes, particularly with ata drives.

Original-code-by:   Bernd Walter <ticso@cicely.de>
Eagerly-awaited-by: sos
2000-05-04 07:37:11 +00:00
Greg Lehey
46aebdeaea remove_drive: correctly obliterate the magic number.
Reported-by: 	phk
2000-05-04 07:35:03 +00:00
Greg Lehey
cf53cf132b Don't hide bio structure behind macros like b_ioflags.
Get counting volume I/Os right.

Count buffer sizes correctly for architectures where ints are not 32 bits.

complete_rqe: Move decrementing active count until after call to
complete_raid5_write, thus possibly avoiding a race condition.

Suggested-by:	      dillon

Rename user bp to ubp to avoid confusion.

Tidy up comments.
2000-05-04 07:33:40 +00:00
Greg Lehey
c626587322 Only wake up one process when we're done configuring.
Suggested-by:	msmith
2000-05-04 07:29:55 +00:00
Poul-Henning Kamp
87150cb06d s/biowait/bufwait/g
Prodded by: several.
2000-04-29 16:25:22 +00:00
Greg Lehey
b3fce61714 initsd(): Complete the intention of revision 1.25 and write init data to disk.
Sleuthwork-by:	alfred
2000-04-22 09:05:16 +00:00
Poul-Henning Kamp
ed6aff7387 Remove unneeded <sys/buf.h> includes.
Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.
2000-04-18 15:15:39 +00:00
Poul-Henning Kamp
896402f402 Make vinum compile again using the "cast to buf" workaround.
Approved by:	grog
2000-04-16 07:18:08 +00:00
Greg Lehey
409875e46d open_drive: Add kludges for vn and md.
Submitted-by:	dillon (vn)
Requested-by:	phk (md)
2000-04-06 07:25:35 +00:00
Greg Lehey
6165ec2aad (finally!) add keywords raid4 and partition. 2000-04-06 07:13:44 +00:00
Greg Lehey
bd131be7d1 complete_rqe: Remove a race condition in RAID-4 and RAID-5 where a
request could be deallocated before the top half had finished
	issuing it.  The problem seems only to happen with IDE drives
	and vn devices, but theoretically it could happen with any
	drive.  This is the most important part of a possible series
	of fixes designed to remove race conditions without locking
	out interrupts for longer than absolutely necessary.

Reported-by:	       sos
Fix-supplied-by:       dillon
2000-04-06 03:03:31 +00:00
Poul-Henning Kamp
c244d2de43 Move B_ERROR flag to b_ioflags and call it BIO_ERROR.
(Much of this done by script)

Move B_ORDERED flag to b_ioflags and call it BIO_ORDERED.

Move b_pblkno and b_iodone_chain to struct bio while we transition, they
will be obsoleted once bio structs chain/stack.

Add bio_queue field for struct bio aware disksort.

Address a lot of stylistic issues brought up by bde.
2000-04-02 15:24:56 +00:00
Alfred Perlstein
4bb4aee894 repair half-Danish b.b_iocmd damage where writes/reads weren't getting
set properly in the struct buf with vinum:

  Fix locations where B_READ was cleared in the old code but
    b.b_iocmd wasn't set to BIO_WRITE
  Fix propogation of b_iocmd
  Correct comments to reflect reality
  Don't compare b_flags with BIO_READ, it's in b_iocmd.

Submitted by: Bernd Walter <ticso@cicely.de>
2000-03-26 23:06:12 +00:00
Alfred Perlstein
fe3f12377c rqe->b.b_flags |= B_READ; became
rqe->b.b_iocmd == BIO_READ instead of
rqe->b.b_iocmd = BIO_READ;
fix it.
2000-03-26 09:20:33 +00:00
Poul-Henning Kamp
b99c307a21 Rename the existing BUF_STRATEGY() to DEV_STRATEGY()
substitute BUF_WRITE(foo) for VOP_BWRITE(foo->b_vp, foo)

substitute BUF_STRATEGY(foo) for VOP_STRATEGY(foo->b_vp, foo)

This patch is machine generated except for the ccd.c and buf.h parts.
2000-03-20 11:29:10 +00:00
Poul-Henning Kamp
21144e3bf1 Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new
field in struct buf: b_iocmd.  The b_iocmd is enforced to have
exactly one bit set.

B_WRITE was bogusly defined as zero giving rise to obvious coding
mistakes.

Also eliminate the redundant struct buf flag B_CALL, it can just
as efficiently be done by comparing b_iodone to NULL.

Should you get a panic or drop into the debugger, complaining about
"b_iocmd", don't continue.  It is likely to write on your disk
where it should have been reading.

This change is a step in the direction towards a stackable BIO capability.

A lot of this patch were machine generated (Thanks to style(9) compliance!)

Vinum users:  Greg has not had time to test this yet, be careful.
2000-03-20 10:44:49 +00:00
Greg Lehey
b6c7afd32c sdio: If sd I/O fails because of an I/O error, set the sd state
correctly.

Reported-by:	phk
Approved-by:	jkh
2000-03-12 05:05:41 +00:00
Greg Lehey
e7a1a7d809 Fix a problem with device number parsing, which caused da10 to map to
da1, and da11 to da2.

Reported by:  Dan Nelson <dnelson@emsphone.com>

Implicitly-approved-by:	 jkh
2000-03-02 07:46:10 +00:00
Greg Lehey
2903a30d77 Set default revive block size to 64 kB.
Implicitly-sanctioned-by:	jkh
2000-03-01 07:25:46 +00:00
Greg Lehey
c6dd6dd0d0 Tidy up splbio() protection.
Tidy up locking.  Previously we were taking two locks for a parity
block, and only releasing one of them.

Implicitly-sanctioned-by:	jkh
2000-03-01 07:25:07 +00:00
Greg Lehey
bd685df802 vinumstrategy: Don't count the read and written bytes before they're
transferred, do it in complete_rqe instead.

launch_requests: Replace the inadvertently removed splbio() around the
                 main loop.  It may not be necessary, but the biggest
                 test of this stuff are IDE disks, which I'm not
                 using.

                 Remove throttling code, I'm pretty sure it's not
                 needed any more.

		 Don't set B_ORDERED, it's not necessary either.

Objected-to-by: alfred

build_rq_buffer: Don't lose the B_ORDERED bit, it still has some
		 residual meaning.  To do this right, Vinum needs to
		 look at the B_ORDERED bit and order the transfer
		 across all disks involved.  That's an exercise for
		 another day.

Objected-to-by: alfred

Implicitly-sanctioned-by:	jkh
2000-03-01 07:24:26 +00:00
Greg Lehey
38a54177c5 Add keywords raid4 and partition.
Implicitly-sanctioned-by:	jkh
2000-03-01 07:23:40 +00:00
Greg Lehey
7d6abd1af3 complete_rqe: Handle volume read stats here with other objects.
Previously vinumstrategy counted the bytes before they were hatched,
giving rise to strangenesses when a read failed.

Implicitly-sanctioned-by:	jkh
2000-03-01 07:23:13 +00:00
Greg Lehey
2cd253ad0f Replace the preprocessor variable names BDEV_MAJOR and CDEV_MAJOR with
VINUM_BDEV_MAJOR and VINUM_CDEV_MAJOR respectively.

Set DRIVE_MAXACTIVE and VINUM_MAXACTIVE to 30000, effectively
disabling the request limitation code.  This code was added as an
attempt to escape from a bug which seems to have gone away, and it's
very likely I'll remove the code Real Soon Now, but I don't want to do
it just yet.

struct drive: Remove references to vnode pointers, including debug
output.  Vinum now talks directly to the device driver.  Instead, add
a dev_t.

enum plexorg: Add an instance for RAID-4.

Change checks for striped or RAID-5 plexes to a macro 'isstriped',
which now also includes RAID-4.

Change checks for RAID-5 plexes to a macro 'isparity', which now also
includes RAID-4.

Approved-by:  jkh
2000-02-29 06:17:26 +00:00
Greg Lehey
536aceefa2 plex_org: Add case for RAID-4.
Approved-by:  jkh
2000-02-29 06:16:44 +00:00
Greg Lehey
5823cef910 set_drive_state: update subdisk states more correctly.
set_sd_state: update the state of a subdisk in a multi-plex volume
more correctly.

update_plex_state: Bring the plex up correctly when the last subdisk
comes up.

checksdstate: Update comments.

vpstate: Don't return an "up" state on a degraded, unattached plex.

start_object: Return a sensible error message when trying to revive a
subdisk whose drive is down.  Previously it returned EBUSY.

Approved-by:  jkh
2000-02-29 06:16:06 +00:00
Greg Lehey
ea77bd8579 Fix horrible, embarrassing breakage which caused occasional panics and
data corruption.  It's a wonder it worked at all.

Led-on-the-right-path-by:  dillon

revive_block: Add treatment for RAID-4.

Add function parityrebuild, called by revive_block and parityops.

Approved-by:  jkh
2000-02-29 06:15:26 +00:00
Greg Lehey
25ac879b0c launch_requests: If too many requests are active, include PCATCH in
the tsleep call flags.

Submitted-by:  Bernd Walter <ticso@cicely.de>

Remove references to vnode pointers, including debug output.  Vinum
now talks directly to the device driver.

bre: Add case for RAID-4.

sdio: Don't try to write to a down drive.  Set the sd state instead.

Approved-by:  jkh
2000-02-29 06:14:44 +00:00
Greg Lehey
857b0d4e21 Add support for RAID-4. This is the only change which is needed for
RAID-4 support: the rest is just configuration management.

Requested-by:	peter
Approved-by:	jkh
2000-02-29 06:14:06 +00:00
Greg Lehey
e08bedf9bf Malloc: Save the caller's file name in the correct entry. 2000-02-29 06:13:24 +00:00
Greg Lehey
6992cfe973 Add keywords 'partition' and 'raid4'.
Approved-by:  jkh
2000-02-29 06:13:02 +00:00
Greg Lehey
74a2966a34 Modify comments to indicate that RAID-5 functions also apply to
RAID-4.

Approved-by:  jkh
2000-02-29 06:12:34 +00:00
Greg Lehey
e862b9e36a open_drive: open drives directly rather than going via namei and
vn_open.  This is necessary in order to be able to open drives before
the root file system is mounted.  This also involves restructuring the
drive struct, which no longer contains a vnode pointer.  Instead,
open_drive sets an open flag.  It's a horrible kludge, and I'll gladly
borrow a Danish axe and hack it in little pieces when devfs comes.

read_drive, write_drive, drive_io_done: Replace with driveio.  The
function names are now macros.

driveio: Fix horrible, embarrassing breakage which was the reason why
read_drive and write_drive existed in the first place.

Code-torn-to-shreds-by:  dillon

format_config: Don't save config of objects in referenced state.  They
get rebuilt automatically.

Change checks for striped or RAID-5 plexes to a macro 'isstriped',
which now also includes RAID-4.

Change checks for RAID-5 plexes to a macro 'isparity', which now also
includes RAID-4.

Replace the preprocessor variable names BDEV_MAJOR and CDEV_MAJOR with
VINUM_BDEV_MAJOR and VINUM_CDEV_MAJOR respectively.

vinum_scandisk: Don't free memory twice on error, once is enough.

Approved-by:  jkh
2000-02-29 06:11:13 +00:00
Greg Lehey
09ebc38020 Remove references to vnode pointers, including debug output. Vinum
now talks directly to the device driver.

Approved-by:  jkh
2000-02-29 06:10:21 +00:00
Greg Lehey
3e0311b705 Remove declarations of read_drive and write_drive and replace them
with macros.

Add declaration for parityrebuild, a new function.

Approved-by:  jkh
2000-02-29 06:09:41 +00:00
Greg Lehey
e435b3206e Add support for RAID-4, even though it is inferior in almost every way
to RAID-5.  peter claims that it might be faster for sequential
reading, since the drive caches don't trip over the parity blocks.  I
have seen no evidence to support this, but it's a trivial change.

Requested-by:	peter

Change checks for striped or RAID-5 plexes to a macro 'isstriped',
which now also includes RAID-4.

Change checks for RAID-5 plexes to a macro 'isparity', which now also
includes RAID-4.

atoi(): Remove, nobody was talking to it.

give_sd_to_drive: If no space is available, make the subdisk down,
don't delete it.

Change the manner in which the subdisk count was maintained to avoid
cases where the count was not adjusted correctly.

config_drive: Check if we have subdisks referencing us, and add them
if so.  This fixes problems which arose when a drive is replaced in a
running system.

config_sd: Add support for a keyword 'partition', whose meaning will
	   be revealed in the fullness of time.

Cosmetic: Shorten some console messages.

Approved-by:  jkh
2000-02-29 06:08:33 +00:00
Greg Lehey
7a7d8290f0 Change the startup sequence of the vinum volume from SI_SUB_DRIVERS
to SI_SUB_VINUM, thus making it possible for Vinum to access I/O
devices and start.

Replace the preprocessor variable names BDEV_MAJOR and CDEV_MAJOR with
VINUM_BDEV_MAJOR and VINUM_CDEV_MAJOR respectively.

Style fixes: replace NULL with 0 where appropriate.

Submitted-by: Charlie Root <root@sms-1.follo.net> (yup, that's all I
	      have to go on).

Approved-by:	jkh
2000-02-29 06:07:39 +00:00
Greg Lehey
cb357bf915 Cosmetic changes.
Approved-by:	jkh
2000-02-29 06:07:01 +00:00
Poul-Henning Kamp
ba4ad1fcea Give vn_isdisk() a second argument where it can return a suitable errno.
Suggested by:	bde
2000-01-10 12:04:27 +00:00
Alfred Perlstein
a9dd30b96b revision 1.40 backed out the removal of PCATCH in a tsleep allowing
an infinite loop if a signal is delivered here.
remove it again, this still ought to be revisited as the error should
probably be returned.
2000-01-10 10:24:47 +00:00
Greg Lehey
b51b6b8a7b Don't tsleep with PCATCH, it's a wonderful way to hang the system.
Reported-by:	Bernd Walter <ticso@cicely.de>
2000-01-05 22:59:36 +00:00
Greg Lehey
3bd2a0a10c Add missing header file.
Not-reported-by:	peter
2000-01-05 22:58:39 +00:00
Greg Lehey
ffa258b0aa Explicitly type large scalar parameters to avoid compilation warnings
on alpha.

Submitted-by:	      Bernd Walter <ticso@cicely.de>

struct sd: Add a field for the pid of the reviver when the subdisk is
reviving.

Replace block device macros with generalized device macros.
2000-01-05 06:13:01 +00:00
Greg Lehey
a7482aa7d5 When attaching a plex to a volume with 'up' subdisks, make the plexes
subdisks 'stale', not 'reviving'.
2000-01-05 06:12:25 +00:00
Greg Lehey
b110a1e60b Correct printf format for pointers to avoid compilation warnings on
alpha.

Explicitly type large scalar parameters to avoid compilation warnings
on alpha.

Submitted-by:	      Bernd Walter <ticso@cicely.de>

Make better checks that the revive block size is valid, silently set
it to the defaults if not.

Replace block device macros with generalized device macros.
2000-01-05 06:11:46 +00:00
Greg Lehey
0ea9d6fbc7 Correct printf format for pointers to avoid compilation warnings on
alpha.

Modify the manner in which we lock RAID-5 plexes.  This appears to
solve some of the elusive panics we have seen with corrupted buffer
headers (specifically the zeroed-out b_iodone field).

Submitted-by:	      Bernd Walter <ticso@cicely.de>
2000-01-05 06:10:52 +00:00
Greg Lehey
984e8b9ada Modify the manner in which we lock RAID-5 plexes. This appears to
solve some of the elusive panics we have seen with corrupted buffer
headers (specifically the zeroed-out b_iodone field).

Submitted-by:	      Bernd Walter <ticso@cicely.de>
2000-01-05 06:09:43 +00:00