Commit Graph

94 Commits

Author SHA1 Message Date
Greg Lehey
76ffeff6bd Initalize buffer headers correctly for current version of bio subsystem.
Not mentioned by: phk
Approved by:	  re (scottl)

This makes Vinum work again, at least in my testing.
2003-11-24 04:06:56 +00:00
Scott Long
8427f795da Fix vinum by correctly setting the b_offset bio filed when doing I/O.
Submitted by:	grog
2003-11-23 17:10:58 +00:00
Robert Watson
4ac9fbcf79 #ifdef __i386__ the "int slice" definition that became i386-only with
recent Vinum changes.  Fixes non-i386 build on vinumio.c.

Accidental oversight of:	grog
Fix hopefully not minded by:	grog
2003-08-15 17:56:44 +00:00
Greg Lehey
d4bd229fa5 vinum_scandisk:
Correctly handle additional disks without BIOS partition tables.
  Previously, vinum_scandisk stopped scanning additional disks for
  native partitions after any good partition was found.  This applies
  to all platforms, but was a particular problem on systems without
  BIOS partition tables.

Submitted by: harti
2003-08-15 04:36:53 +00:00
Greg Lehey
5466a9cb4c Drop Giant when calling the disk drivers directly, and reacquire
afterwards.  This fixes the Vinum breakage in -CURRENT.

Breakage explained by: phk
2003-08-15 03:57:15 +00:00
Hartmut Brandt
1232acdba3 Check compatibility partitions on all archs. This makes vinum
work on sparc64 again, because on sparc i386-compatibility
partitions just happen to have the same name as sparc native partitions.

Okay-ed by: grog@
2003-06-23 14:49:57 +00:00
Greg Lehey
be05126e24 check_drive: If the partition isn't a Vinum drive, release it again
and return NULL.

vinum_scandisk: Don't handle NULL device pointers.
	        Only look at compatibility partition for i386.  This
	        is a kludge which should go away once I have adequate
	        documentation for the New World Order.

Together, these fixes remove occasional error messages about
non-existent drives.  They may also fix a number of problems that have
been reported without a PR.

PRs: None
2003-06-15 01:42:01 +00:00
Greg Lehey
00ee3bf535 Remove write_volume_label, the implementation of VINUM_LABEL ioctl.
It has been deprecated since December 1998, and recent changes broke
it altogether.

Prompted by:  phk
2003-06-12 05:32:00 +00:00
Greg Lehey
4555a3de62 print_config:
Change config format slightly to save plex preferences correctly.

vinum_scandisk: reinitialise volatile pointer after function call.
This is the "deafc0de" bug.

Approved by: re (scottl)
2003-05-19 02:21:31 +00:00
Greg Lehey
fdfcec3b7c vinum_scandisk: Make sure the config is locked before we mess around
with it.

Finally implement read policies.  The previous "implementation" didn't
work because it referred to plexes which were almost invariably when
referred to.  Instead, deprecate the "prefer" keyword for volumes
(though it's still there for the moment) and add a keyword "preferred"
to the plex definition.  The relationship is like this:

Old:

  vol foo ... prefer foo.p3

New:

  plex foo.p3 volume foo preferred

print_config: Print "preferred" where appropriate.
	      No longer print "prefer" on volume config entries.
2003-05-05 05:32:52 +00:00
Greg Lehey
acf0d9331b Rewrite of startup code:
parse_config: Remove kw_read case.  It's not used any more.

parse_user_config: Remove check for failed read.
2003-05-04 05:15:07 +00:00
Greg Lehey
5fb5b1b5ca check_drive: If we find an existing drive which is "up" or "down",
just return it.  Don't try to reinitialize it.  This should fix a
number of inconsistencies that some people encountered with "vinum
start".

PR:  30588
PR:  43475
2003-05-02 06:04:19 +00:00
Greg Lehey
9488925d66 Use microtime, not getmicrotime, for timing debug entries.
init_drive: Rephrase error message text.
	    Remove dead code (inside #if 0).

Change name of find_drive_by_dev to the more descriptive
find_drive_by_name.

Tidy up comments.
2003-05-01 01:30:31 +00:00
Poul-Henning Kamp
c3dbde2864 NO_GEOM cleanup: unifdef -UNO_GEOM 2003-02-22 09:36:40 +00:00
Joerg Wunsch
e1df235292 Finally make vinum ready for the root filesystem in FreeBSD 5.x. (A
similar patch has been in 4.x for a while, but is more hacky there.)

For this to work, vinum has to be loaded early (e. g. from
boot/loader), for obvious reasons.  If the kernel env variable
(aka. loader variable) "vinum.autostart" is set, vinum then asks the
sysctl kern.disks for all available disks in the system, and scans
them for possible vinum headers.

For statically compiled kernels, this behaviour can be obtained even
without boot/loader by using "options VINUM_AUTOSTART" (though this is
not the recommended way).

Alternatively, the 4.x way to specify "vinum.drives" is also supported.

No further hacks (like the 4.x "vinum.root" variable) are needed,
since in 5.x, mountroot() asks back at the drivers to have them
resolve the name of the root FS into a dev_t (using the dev_clone
eventhandler).

(The MFC reminder below is for a partial MFC for vinum.autostart, the
rest is already there in 4.x.)

Timed out on:	grog
MFC after:	2 weeks
2003-02-05 21:02:56 +00:00
Poul-Henning Kamp
e70e846243 Put use of DIOCWLABEL under #ifdef NO_GEOM 2003-01-26 11:28:56 +00:00
Joerg Wunsch
d50ea522c1 Make the arguments to d_close() match the arguments to d_open(), since
otherwise the close operation is void, and the underlying device remains
marked as being busy.

Thanks to phk for finding this.

MFC after:	3 days
2003-01-22 14:06:46 +00:00
Poul-Henning Kamp
e2a3ea1c45 Remove unused second argument from DEV_STRATEGY(). 2003-01-03 05:57:35 +00:00
Robert Watson
6d4d944e33 Get Vinum up and running with GEOM:
(1) Use namei() and devfs to discover devices rather than a hard-coded
    MAKEDEV implementation.  Once rootfs is in place, this will allow
    Vinum to be used for the root file system partition.

(2) Pass FREAD to device opens so that GEOM will return sector size
    rather than an error on attempts to read label data.

(3) Avoid clobbering return values from close_drive() and masking this
    failure, resulting in a later divide by zero due to not having
    updated the Vinum-cached sector size.

(4) Ignore failures from DIOCWLABEL as that appears not to be required
    in the GEOM environment.

We've done testing in simple Vinum environments, but those with more
complex environments might want to give this a spin in DP2 and make
sure everything is up to speed.

Fixes in collaboration with:	iedowse
Reviewed by:			grog
2002-10-05 03:44:00 +00:00
Archie Cobbs
55f7c614fd Don't use "NULL" when "0" is really meant. 2002-08-21 23:39:52 +00:00
Tom Rhodes
d394511de3 More s/file system/filesystem/g 2002-05-16 21:28:32 +00:00
Poul-Henning Kamp
77068a7fe2 Retire the bogus uses of the disklabel field d_sbsize and begin to
initialize it to zero so we don't have to have everbody and their
aunt including FFS specific header files.

Sponsored by: DARPA & NAI Labs.
2002-05-12 20:49:41 +00:00
Greg Lehey
a182065f27 vinum_open: recognize twed device.
Submitted by:	Holger Kipp <holger.kipp@alogis.com>
PR:		37458
MFC after: 	5 days
		(to get 4.6 code freeze)
2002-04-26 04:23:19 +00:00
Poul-Henning Kamp
13c0a6f45e Stop using the bogus DIOCGPART ioctl, use DIOCGSECTORSIZE and
DIOCGMEDIASIZE instead.

The partition type check has been XXX'ed out since we cannot expect
that a BSD disklabel with a type field be available on all platforms.
2002-04-02 11:40:45 +00:00
Jeff Roberson
421e6a659e Remove unused include. 2002-03-20 09:55:07 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Greg Lehey
d505403792 open_device: Recognize ar device.
Submitted by:  Valery Kotchiev <valery@rudiment.dk>
2001-08-01 04:35:28 +00:00
Greg Lehey
7b4bf18baa Change #if VINUMDEBUG to #ifdef VINUMDEBUG. This is a flag, not a variable. 2001-05-23 23:24:05 +00:00
Greg Lehey
acac8659d7 format_config: Replace long format lines.
Requested by:  bde

Add retryerrors keyword.

vinum_scandisk: Print a different message if an inadvertent start
command did not find any additional drives.  The previous message "no
drives found" confused and worried many people.

MFS:

vinum_open: Recognize Mylex devices as storage devices.
2001-05-22 02:32:22 +00:00
Greg Lehey
9cd8b5cf0d Correct check for partition c. Previously the check was for drive 2,
which did not exactly have the desired result.

Submitted by:	Akira Watanabe <akira@myaw.ei.meisei-u.ac.jp>
2001-01-20 03:46:19 +00:00
Greg Lehey
96f2d202a1 format_config: If a subdisk loses its drive (due to a bug which has
not yet been caught), don't save the config with a null drive
   	name (which causes the drive to be renamed "plex" on the next
   	start), put in the text "*invalid*" instead.

	This is damage control, not a fix.

Experienced by:	peter

Break some long format strings so that they fit in style(9)-sized
lines.

Remove some "outdentation".
2001-01-14 06:33:10 +00:00
Greg Lehey
8684adf5cd open_drive: Refuse to open partition c of a disk device.
This should eliminate one case of foot shooting .

vinum_scandisk: If a drive in the partition table is downed, free it.
This duplicates code for the compatibility partition, which for some
reason was omitted here.
2001-01-10 05:02:44 +00:00
Greg Lehey
ed4963f8e1 open_drive: Add support for more than 32 devices of a particular kind.
Requested by:	Bernd Walter <ticso@cicely8.cicely.de>
		Cor Bosman <cor@xs4all.net>
		Kai Storbeck <kai@xs4all.net>
		Joe Greco <jgreco@ns.sol.net>

	     Add support for Compaq SMART-2 RAID (idad) as storage
	     device for Vinum subdisks.

Reported by:	Aaron Hill <hillaa@hotmail.com>
2000-12-20 05:15:50 +00:00
Greg Lehey
7a598eabdd open_drive:
Add support for AMD RAID controllers as "disks".

Requested-by:  Marius Bendiksen <mbendiks@eunet.no>

  Remove potential panic when attempting to open non-existent drivers.

init_drive: Return error codes correctly.  Previously it would
            occasionally return 0.  The error was redetected
            elsewhere, but this was causing a number of confusing
            error messages.
2000-08-16 04:31:37 +00:00
Greg Lehey
c9180b28e7 open_drive: Recognize "wd" device type. This is going away, but it's
not gone yet.

format_config: print correct text when a volume has a preferred plex.
This is still broken, but not quite as badly.

Reported-by: Phil Regnauld <regnauld@ftf.net>

Change a rather silly comment.
2000-06-02 04:03:13 +00:00
Greg Lehey
a0f3ae4e0b vinum_scandisk: Correct error recovery if a configuration is munged. 2000-05-11 07:24:41 +00:00
Greg Lehey
46aebdeaea remove_drive: correctly obliterate the magic number.
Reported-by: 	phk
2000-05-04 07:35:03 +00:00
Poul-Henning Kamp
87150cb06d s/biowait/bufwait/g
Prodded by: several.
2000-04-29 16:25:22 +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
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
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
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
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
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
Greg Lehey
3bd2a0a10c Add missing header file.
Not-reported-by:	peter
2000-01-05 22:58:39 +00:00
Greg Lehey
f54047e7f4 Explicitly type large scalar parameters to avoid compilation warnings
on alpha.

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

Remove #include of vm/vm_zone.h.

Submitted-by:	Someone, I'm sure, but I seem to have lost the
		attribution.  Sorry.

Get the check for disk devices correct, and return an appropriate
message if the check fails.
2000-01-05 06:05:33 +00:00
Eivind Eklund
762e6b856c Introduce NDFREE (and remove VOP_ABORTOP) 1999-12-15 23:02:35 +00:00
Poul-Henning Kamp
b9fcd4a616 Look for disk devices rather than bdevs.
Approved by:	grog
1999-12-12 17:43:12 +00:00
Greg Lehey
c46d09a85b Fix another instance of vinum_scandisk giving a request to the daemon
and then doing it itself, resulting in a panic downed drives.

Sleuth-work-by:	  Christopher Masto <chris@netmonger.net>

Remove dummy function initsd, which is now (implemented) in
vinumrevive.c

vinum_scandisk: Check that a drive is up before reading from it.  This
is probably excessive paranoia.
1999-10-13 03:17:59 +00:00