Commit Graph

82 Commits

Author SHA1 Message Date
Julian Elischer
3745c395ec Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0  so that we can eventually MFC the
new kthread_xxx() calls.
2007-10-20 23:23:23 +00:00
Lukas Ertl
a2237c41fc -) Correct sdcount for a plex when removing or adding subdisks.
-) Set correct sizes for plexes and volumes a subdisk has been removed.

Submitted by:   Ulf Lilleengen <lulf_AT_freebsd.org>
2007-04-12 17:54:35 +00:00
Lukas Ertl
9e357b05da Avoid infinite loop if the device string given for a drive
only consists of "/".

Submitted by:  Ulf Lilleengen <lulf_AT_freebsd.org>
2007-04-12 17:40:44 +00:00
Warner Losh
1a3c917f9d while (0); -> while (0) in multi-line macros 2006-08-17 22:50:33 +00:00
Lukas Ertl
ff91880e5d Protect from creating striped and RAID5 plexes with unequally sized
subdisks.
2006-03-30 14:01:25 +00:00
Lukas Ertl
5c391fb60c Fix whitespace. 2006-03-23 20:01:13 +00:00
Lukas Ertl
7b5264faa1 Implement the 'resetconfig' command.
PR:            kern/94835
Submitted by:  Ulf Lilleengen <lulf@stud.ntnu.no>
2006-03-23 19:58:43 +00:00
Lukas Ertl
d9a7dc858a Catch the case when a subdisk has no provider or no consumer
attached to it.
2006-02-08 21:32:45 +00:00
Lukas Ertl
d5817a5009 Get rid of the gv_bioq hack in most parts of the I/O path and
use the standard bioq structures.
2006-01-06 18:03:17 +00:00
Maxim Sobolev
b53a1cf306 Don't pass error value pointer to g_read_data(9) at all if we don't
have any use of it.

Suggested by:	pjd
2005-11-30 22:15:00 +00:00
Maxim Sobolev
8a4a44b5aa Check for g_read_data(9) errors properly:
o The only indication of error condition is NULL value returned by
  the function;

o value pointed to by error argument is undefined in the case when
  operation completes successfully.

Discussed with: phk
2005-11-30 19:24:51 +00:00
Lukas Ertl
e30534d50b Since we want a vinum geom created anytime the module loads, move
the geom creation to a seperate init function and ignore the tasting.

The config is now parsed only in the vinumdrive geom, which hopefully
fixes the problem, that the drive class tasted before the vinum class
had a chance, for good.

Also restore the behaviour that the module can be loaded at boot time
and on a running system.
2005-11-24 15:11:41 +00:00
Lukas Ertl
8eb116b96e Whitespace. 2005-11-20 12:14:18 +00:00
Lukas Ertl
2e42895a97 Always declare variables at the start of the function.
Don't allocate potentially large variables on the stack.
Check strsep() return values when the string comes from userland.
Shorten variable names for lucidity's sake.

most of the stuff:
Pointed out by:    njl@
2005-11-20 12:12:31 +00:00
Lukas Ertl
47517eab34 Fix whitespace issue.
Pointed out by:   joel@
2005-11-20 10:40:06 +00:00
Lukas Ertl
57335408d4 Finally bring in what was produced during Google SoC 2005:
Add functions to rename objects and to move a subdisk from one drive
to another.

Obtained from:  Chris Jones <chris.jones@ualberta.ca>
Sponsored by:   Google Summer of Code 2005
MFC in:         1 week
2005-11-19 20:25:18 +00:00
Lukas Ertl
fcac1be89a Set the G_PF_WITHER flag on the subdisk provider that is about to
be destroyed.  That way the GEOM system handles all deallocations
and we don't have to do it ourselves.
2005-09-08 20:08:46 +00:00
Lukas Ertl
1f710312a2 Prevent that sync operations can be started when they are already
in progress, and be a bit more user friendly in terms of error
messages returned from the kernel.
2005-08-28 18:16:31 +00:00
Lukas Ertl
df5175af0f Shuffle around the order in which the components are compiled.
This way, the VINUMDRIVE class is loaded before the VINUM class,
but since geom does the tasting for newly arrived classes
last-in-first-out, the VINUM class tastes first.

This removes the need to call gv_parse_config() in the drive
taste path.
2005-08-26 14:40:32 +00:00
Lukas Ertl
fdb9eda84f Correct the check if a plex is accessible in case it is not up.
This makes degraded RAID5 plexes actually work.
2005-08-22 23:24:26 +00:00
Lukas Ertl
664a97517f Make it possible to remove stale, left-over subdisks. 2005-08-16 15:12:44 +00:00
Lukas Ertl
8cc5eb98ad Fix a stupid logic bug introduced in geom_vinum_drive.c rev 1.18:
When a drive is newly created, it's state is initially set to 'down',
so it won't allow saving the config to it (thus it will never know of
itself being created).  Work around this by adding a new flag, that's
also checked when saving the config to a drive.
2005-08-15 17:07:47 +00:00
Lukas Ertl
7ad68986b8 *) Implement round-robin reads for multiplex volumes.
*) Plug a possible memory leak. [1]

[1] obtained from: pjd@.
2005-07-15 13:38:06 +00:00
Lukas Ertl
0164489c96 When a drive dies, don't call g_wither_geom() directly, but instead
post an event to the geom event queue that will take care of it,
letting outstanding bios finish, and closing the consumers.

Plus some cosmetic clean ups.
2005-05-17 16:38:30 +00:00
Lukas Ertl
bc2d4d6784 Only allow RAID5 plexes to be parity checked.
PR:           kern/80427
Submitty by:  Stijn Hoop <stijn@win.tue.nl>
2005-04-28 13:09:00 +00:00
Lukas Ertl
cf01c54cda Remove test for zero sectorsize when tasting. This check doesn't
seem to be necessary anymore, and it prevents tasting a valid drive
when booting with geom_vinum already loaded, since SCSI disks set their
sectorsize not until first opening them.
2005-03-07 19:58:58 +00:00
Lukas Ertl
9954331c23 Don't allow to synchronize a plex that is already sychronizing.
Reset the 'syncing' flag in case of errors, too.

Some cosmetics.
2005-03-04 16:43:40 +00:00
Lukas Ertl
d8688e1117 Correctly calculate what to do and how to retry a request to a plex when
the previous one failed and there are more than one plex in the volume.

This could have led to a flood of error messages on the console and
probably a deadlock in certain situations.
2005-02-23 14:59:14 +00:00
Lukas Ertl
3608f72533 In case of drive errors, don't close the associated consumer and
detach it, but instead let the geom wither away.

Bump copyright year.
2005-02-17 16:08:36 +00:00
Lukas Ertl
f9b7569c09 Only report state changes of subdisks and plexes when there's
really a state change.

Reword the info a bit.
2005-01-21 18:27:23 +00:00
Lukas Ertl
0d93122102 Don't initialize error with ENXIO as we might end up here when
the plex has no more consumers (e.g. orphaning).
2005-01-21 18:24:20 +00:00
Lukas Ertl
eba5b9dfce Rename synchronization and initialization threads and prefix them
with 'gv_' for consistency.
2005-01-19 14:49:26 +00:00
Lukas Ertl
f11c507c45 Although an object may already be known in the configuration, it's
worker thread may have been destroyed (e.g. during orphaning).

Make sure that objects get back their worker threads when they get a
new geom.
2005-01-19 14:08:16 +00:00
Lukas Ertl
3b6cdf438a Reset object flags after killing off an object's worker thread. 2005-01-19 13:57:09 +00:00
Warner Losh
fa521b0366 /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 18:27:30 +00:00
Lukas Ertl
997337fd20 Implement 'setstate' to allow setting the state of drives and subdisks
for debugging and emergency purposes.
2004-11-26 12:31:36 +00:00
Lukas Ertl
fb5885af37 Implement checkparity/rebuildparity. 2004-11-26 12:01:00 +00:00
Lukas Ertl
fb4e65d035 Move RAID5 offset calculation into a separate function to avoid
code duplication.
2004-11-15 13:04:55 +00:00
Lukas Ertl
94175098f1 Share gv_roughlength() between kernel and userland, as we will need it
there later.
2004-11-15 12:30:59 +00:00
Lukas Ertl
6c39d46363 Give each plex a separate queue where held back bios are put on.
This lowers the CPU usage of the worker thread and prevents a
possible live lock on non-SMP machines.

MFC candidate.
2004-10-26 21:01:42 +00:00
Lukas Ertl
4cb1b18827 Don't allow to create a drive that already exists. 2004-10-02 20:50:21 +00:00
Lukas Ertl
d9d3a74c87 Correctly skip the '/dev/' part when creating new drives and prefix
a drive's provider with '/dev/' when printing the config.

Reported by:  will@
2004-10-02 20:12:20 +00:00
Lukas Ertl
c3aadfb9d6 Make it possible to rebuild degraded RAID5 plexes. Note that it is
currently not possible to do this while the volume is mounted.

MFC in:  1 week
2004-09-30 12:57:35 +00:00
Lukas Ertl
b916fcec4d Single concat or striped plexes don't need no special initialization
if their subdisks are all available, so let them be brought up.
2004-09-18 18:03:20 +00:00
Lukas Ertl
67e3ab6ee5 Re-vamp how I/O is handled in volumes and plexes.
Analogous to the drive level, give each volume and plex a worker thread
that picks up and processes incoming and completed BIOs.

This should fix the data corruption issues that have come up a few
weeks ago and improve performance, especially of RAID5 plexes.

The volume level needs a little work, though.
2004-09-18 13:44:43 +00:00
Lukas Ertl
12653dec9d Give the DRIVE geom a worker thread that picks up incoming bios,
sends them down, and takes care of the finished bios.  This makes it
easier to handle I/O errors at drive level.
2004-09-13 21:01:36 +00:00
Lukas Ertl
fce2deb197 Rename gv_kill_thread() to gv_kill_plex_thread(), since there are more
threads to come.
2004-09-13 17:44:47 +00:00
Lukas Ertl
a0781b98f3 Save the config back to disk when a drive goes down. 2004-09-13 17:33:52 +00:00
Lukas Ertl
ea29a30466 Read a whole sector instead of GV_HDR_LEN, since a sector might be
bigger (i.e. on CD-ROMs).
2004-09-13 17:27:58 +00:00
Lukas Ertl
5bad268cdc Move config_new_drive() to the correct place and rename it to
gv_config_new_drive().
2004-08-27 21:32:18 +00:00