Commit Graph

485 Commits

Author SHA1 Message Date
Greg Lehey
108b696afe ioctl VINUM_READCONFIG: Don't lock configuration here. vinum_scandisk
needs to do it anyway to handle the startup case.  This is
            part of a fix for the recently reported hangs.

Approved by:  re (scottl)
2003-05-08 00:36:20 +00:00
David E. O'Brien
2875867356 Fix usages of %ll[dx] with typedef'ed created types.
In the kernel it is wrong 99.9 times out of 100 to use %ll rather than cast
to intmax_t and use %j.
2003-05-05 16:56:44 +00:00
Greg Lehey
3cff2a7306 Add sector size member to subdisk, plex and volume objects. 2003-05-05 08:43:15 +00:00
Greg Lehey
7f55835e9c Remove an accidental #include.
Maintain sector sizes for all objects, not just for drives.  Some of
this could do with improvement: in particular, we get an error if the
components of an object have different sector sizes.

Clean up some comments.
2003-05-05 08:42:42 +00:00
Greg Lehey
63deaeffac Implement DIOCGSECTORSIZE and DIOCGMEDIASIZE ioctls. It appears that
they are now necessary to use newfs(8).
2003-05-05 08:41:53 +00:00
Greg Lehey
2154a1eed3 Correct failed checkin. Only one of the hunks in the last checkin
seems to have made it.
2003-05-05 07:50:15 +00:00
Greg Lehey
e4d5ded9c8 Clarify comments. 2003-05-05 05:35:52 +00:00
Greg Lehey
3f49535d38 Add "preferred" keyword. 2003-05-05 05:35:28 +00:00
Greg Lehey
8b2087987e White space fixes. 2003-05-05 05:34:39 +00:00
Greg Lehey
e802b7f05e Remove DIOCGDINFO ioctl. This almost makes newfs work again without
the -v option, though it's not clear that it won't bite us elsewhere.

Forgotten by: phk

Implement setreadpol() function for the VINUM_READPOL ioctl.

Submitted by:  Allan Saddi <allan@saddi.com>
2003-05-05 05:33:59 +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
780bedeaa5 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

give_plex_to_volume: set preferred plex if specified on plex
definition entry.  This involves adding a parameter to the function to
specify the preferred plex.

config_plex: Implement preferred keyword.
2003-05-05 05:32:15 +00:00
Greg Lehey
d1cbfb622b free_vinum: Rearrange sequence of actions to avoid potential race
condition when shutting down.
2003-05-05 05:28:15 +00:00
Greg Lehey
af5e35e6ad Update declaration of vinum_scandisk (only one parameter). 2003-05-04 05:19:48 +00:00
Greg Lehey
f911210e72 Rewrite of startup code:
Add ioctl VINUM_READCONFIG which implements both the "read" and
"start" commands in vinum(8).  Aim for marginally better error
messages when something goes wrong.
2003-05-04 05:16:02 +00:00
Greg Lehey
8ffac9562e Rewrite of startup code:
Add ioctl VINUM_READCONFIG which implements both the "read" and
"start" commands in vinum(8).
2003-05-04 05:15:32 +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
60500a5ca2 Rewrite of startup code:
vinumattach: Move the startup code to vinum_scandisk.
2003-05-04 05:13:45 +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
b69195b182 White space changes. 2003-05-02 01:39:11 +00:00
Greg Lehey
9db2b74e40 Note when we issue a request to the disk driver, so that we can
measure the time it spends.
2003-05-01 13:06:00 +00:00
Greg Lehey
03c03f6cf4 Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).
2003-05-01 01:35:03 +00:00
Greg Lehey
bf7cea1cc0 For consistency's sake, on command failure, throw 1, not -1.
Rewrite minor number decoding.  Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).
2003-05-01 01:34:38 +00:00
Greg Lehey
0910419967 Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).

Correct formats for some error messages.  Don't cast the value to
match the format.
2003-05-01 01:34:05 +00:00
Greg Lehey
9ebe817222 Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).

Tidy up comments.

Check for null rqgs.  This continue to be reported, though I can't
work out why.

Correct formats for some error messages.  Don't cast the value to
match the format.

Use microtime, not getmicrotime, for timing debug entries.
2003-05-01 01:33:34 +00:00
Greg Lehey
f77547fbbb Terminate a comment. 2003-05-01 01:33:01 +00:00
Greg Lehey
9351e5dbcc Don't make definition of kw_debug dependent on VINUMDEBUG. In
userland, define the keyword even if the kernel module doesn't have
debug code.
2003-05-01 01:32:31 +00:00
Greg Lehey
25d8d1f1a9 Use strrchr, not rindex. This is for compatibility with other
systems, and requires a #define.
2003-05-01 01:32:08 +00:00
Greg Lehey
130101dd9d #ifdef VINUMDEBUG, not #if VINUMDEBUG. 2003-05-01 01:31:48 +00:00
Greg Lehey
de7d0dd0eb Don't make definition of kw_debug dependent on VINUMDEBUG. It's only
an enum value, and dropping it can lead to some spectacular surprises
in userland.
2003-05-01 01:31:20 +00:00
Greg Lehey
01fbffad0e Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).

As a result of the minor number changes, split out the superdevice
handling into a separate function, vinum_super_ioctl.  This was most
of the code of vinumioctl.

attachobject: Improve error checking.
2003-05-01 01:30:59 +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
Greg Lehey
d55f8bc42e Remove "to do" comments.
get_emppty_drive: Fix a day one bug with strcpy parameters.

Change name of find_drive_by_dev to the more descriptive
find_drive_by_name.

Rewrite minor number decoding.  Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).
2003-05-01 01:29:52 +00:00
Greg Lehey
47f9c49661 Rewrite minor number decoding. Now we have only three types of
object: subdisks, plexes and volumes.  The encoding for plexes and
subdisks no longer reflects the object to which they belong.  The
super devices are high-order volume numbers.  This gives vastly more
potential volumes (4 million instead of 256).

Remove an unnecessary goto.

vinumopen: Return EINVAL, not ENXIO, on an attempt to open a
referenced plex.
2003-05-01 01:28:42 +00:00
John Baldwin
7b5e3e1239 Keep the proc locked while we set PS_INMEM so that either of the proc lock
or sched_lock are sufficient to test this flag.

XXX: vinum should really be using a kernel process via kthread_create()
instead of this hack.  I'm not even sure PS_INMEM can be clear at this
point anyways.
2003-04-22 19:45:26 +00:00
Poul-Henning Kamp
60794e0478 Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Poul-Henning Kamp
78b7591cc5 Format the cdevsw like all other drivers do it for improved grepability. 2003-03-02 15:32:03 +00:00
Poul-Henning Kamp
e8e018a984 NO_GEOM cleanup:
Remove cdevsw->d_psize() implementation.  It is no longer needed.
2003-03-02 14:42:52 +00:00
Jeff Roberson
17661e5ac4 - Add an interlock argument to BUF_LOCK and BUF_TIMELOCK.
- Remove the buftimelock mutex and acquire the buf's interlock to protect
   these fields instead.
 - Hold the vnode interlock while locking bufs on the clean/dirty queues.
   This reduces some cases from one BUF_LOCK with a LK_NOWAIT and another
   BUF_LOCK with a LK_TIMEFAIL to a single lock.

Reviewed by:	arch, mckusick
2003-02-25 03:37:48 +00:00
Poul-Henning Kamp
c3dbde2864 NO_GEOM cleanup: unifdef -UNO_GEOM 2003-02-22 09:36:40 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Poul-Henning Kamp
f341ca9891 Remove #include <sys/dkstat.h> 2003-02-16 14:13:23 +00:00
Joerg Wunsch
1e35598c3a Deregister the dev_clone event handler when unloading the module. Bad
things might happen otherwise.

Noticed by:	Michael Reifenberger <root@nihil.reifenberger.com>
2003-02-11 21:12:43 +00:00
Poul-Henning Kamp
936cc4614b Rename bio_linkage to the more obvious bio_parent.
Add bio_t0 timestamp, and include <sys/time.h> where needed
2003-02-07 21:09:51 +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
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Joerg Wunsch
652dfa8341 Make vinum disk-related devices readable by group "operator" to match
the configuration of any other disk-like devices.

(This is the DEVFS-only part, so no need to MFC.)

PR:		bin/28294, bin/32588
2003-01-16 23:47:04 +00:00