Commit Graph

988 Commits

Author SHA1 Message Date
Marcel Moolenaar
9055ed836a o Don't limit GPT as a rank 2 provider. Allow it to be connected
anywhere in the DAG. This includes configurations that are not
   allowed by the EFI specification.
o  Reject a GPT partition table if it's not preceeded by a PMBR.
   There's no need to preserve the MBR partitioning anymore as GPT
   is mature and with the first bullet extending the applicability
   of GPT, it's better to be a bit more strict.
2004-12-05 06:02:21 +00:00
Pawel Jakub Dawidek
afd05d741f When initializing device, set d_softc and d_no fields for all components,
because we know it then and we need it when inserting a component which
wasn't destroyed while device was running.

Reported by:	Michael Handler <handler@grendel.net>
MFC after:	1 week
2004-12-04 21:20:59 +00:00
Warner Losh
3bc18cb767 Add observations of the Linux98 and Grub/98 boot loaders. These
observations lead me to believe that the convetion for pc98 boot
loaders is to have a jump unstruction, followed by a string, followed
by code.  The jump usually doesn't have a nop after it and usually the
string is NUL terminated, but Grub/98 breaks both of these rules.

# I looked for, but failed to find the Minux boot blocks for PC-9801 port.
2004-11-30 09:40:11 +00:00
Warner Losh
696ac86f2c Reject tasting of this provider if the sector size isn't a multiple of
512.  If I had an audio cdrom in my cd player when I booted my system,
I'd get a panic from geom because you can't read 8192 bytes from an
audio cdrom.

Remove XXX comment about IPL1 and replace it with some information
from my soon to be published web page on the pc98 disk layout.  The
IPL1 test was the result of an observation of a disk with FreeBSD's
boot0 program.  It was testing part of an area what appears to be
reserved for a boot loader name, which comes after a jump over this
area.  I don't yet know if it is required to be any specific jump
instruction, or if the destination has to be location 11. [1]

[1] FreeBSD Press No. 13, page 115, poorly translated by myself.  The
picture there shows offset 8 as the destination of the jump, but
FreeBSD's boot0 program has three padding NULs after the IPL1 name and
uses a 16-bit 'jmp' instruction.
2004-11-30 08:00:14 +00:00
Poul-Henning Kamp
d4dbba5f83 Fix a long standing bug in geom_mbr which is only now exposed by the
correct open/close behaviour of filesystems:

When an ioctl to modify the MBR arrives, we cannot take for granted that
we have the consumer open.

The symptom is that one cannot run 'boot0cfg -s2 /dev/ad0' in single-user
mode because / is the only open partition in only open r1w0e1.

If it is not, we attempt to increase the write count by one and
decrease it again afterwards.

Presumably most if not all other slices suffer from the same problem.
2004-11-28 20:57:25 +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
Pawel Jakub Dawidek
a17dd95f14 - Add missing Giant drop before acquiring the topology lock.
- Move DROP_GIANT()/PICKUP_GIANT() to g_gate_ioctl().
2004-11-23 11:18:26 +00:00
Max Khon
9595dba40d Use M_ZERO to not panic in mtx_init when INVARIANTS enabled.
Submitted by:	simokawa
MFC after:	1 week
2004-11-20 13:10:04 +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
Pawel Jakub Dawidek
085f43afae Before trying to update metadata (so open consumer for writing), be sure
that the events queue is empty. In other case we're able to hit the race
where for example da0s1 is tasted by some other class, which means that
da0 is open with exclusive bit set, which means that we can't open da0
for writing if it is our component.

Reported by:	Attila Nagy <bra@fsn.hu> (and somebody else sometime ago,
		                          but I cannot find who it was)
2004-11-09 23:27:21 +00:00
Pawel Jakub Dawidek
b8005b9b24 Introduce g_waitidlelock() function which is simlar to g_waitidle(),
but should be called with the topology lock held and returns with the
topology lock held and empty event queue.

Approved by:	phk (sometime ago)
2004-11-09 23:20:50 +00:00
Pawel Jakub Dawidek
b36b4bfb55 Don't rely on DIRTY flag to be sure that consumer if open, because
DIRTY flag can be removed in idle process. Use consumer's acw field
instead to avoid opening consumer twice.
2004-11-09 23:15:40 +00:00
Pawel Jakub Dawidek
9c6a3f03c6 For BIO_READ check if provider is open for reading and for BIO_WRITE,
check if provider is open for writing.
This fixes panic when device is open only for writing and we send write
request.
2004-11-09 23:04:45 +00:00
Pawel Jakub Dawidek
fdc3c6ce23 Drop Giant lock before grabbing the topology lock. 2004-11-09 00:35:08 +00:00
Pawel Jakub Dawidek
463674f7e0 If device is marked as beeing destroyed, deny all access requests. 2004-11-08 20:23:53 +00:00
Pawel Jakub Dawidek
9bb09163fc Don't forget to make sure that there are no not-finished requests before
marking components as clean.

Pointed out by:	scottl
2004-11-05 17:18:39 +00:00
Pawel Jakub Dawidek
4d006a98d1 - Mark all raid3 components as clean after kern.geom.raid3.idletime seconds.
- Make kern.geom.raid3.timeout variable tunable.
2004-11-05 13:12:58 +00:00
Pawel Jakub Dawidek
9da3072cae Mark raid3 devices as clean on shutdown (after all file systems are
unmounted).

Suggested by:	scottl
2004-11-05 13:01:25 +00:00
Pawel Jakub Dawidek
79e614937e - Use ->index consumer's field to track number of in-flight requests.
- Remove unused #include.
2004-11-05 12:42:16 +00:00
Pawel Jakub Dawidek
6349471be3 Use shutdown hooks to mark mirrors as clean after all file systems are
unmounted.

Suggested by:	scottl
2004-11-05 12:35:21 +00:00
Pawel Jakub Dawidek
127cf38ee4 Remove unused #include. 2004-11-05 12:31:32 +00:00
Pawel Jakub Dawidek
14089dae44 - Add a sysctl kern.geom.mirror.idletime, so one can specify after how many
seconds of idling, DRITY flags are removed.
- If mirror is in idle state or is not open for writing, sleep without
  timeout when waiting for I/O requests.
- Don't use atomic operations, for now sysctls are protected by Giant.
- Update debugs.
2004-11-05 10:55:04 +00:00
Pawel Jakub Dawidek
2fdf5be172 MFp4:
- Fix for good (I hope) force-stopping mirrors and some filure cases
  (e.g. the last good component dies when synchronization is in progress).
  Don't use ->nstart/->nend consumer's fields, as this could be racy,
  because those fields are used in g_down/g_up, use ->index consumer's
  field instead for tracking number of not finished requests.

  Reported by:	marcel

- After 5 seconds of idle time (this should be configurable) mark all
  dirty providers as clean, so when mirror is not used in 5 seconds
  and there will be power failure, no synchronization on boot is needed.

  Idea from:	sorry, I can't find who suggested this

- When there are no ACTIVE components and no NEW components destroy whole
  mirror, not only provider.

- Fix one debug to show information about I/O request, before we change
  its command.
2004-11-05 09:05:15 +00:00
Poul-Henning Kamp
f9eeb89522 Finish cut&paste adjustments.
Spotted by:	tegge
2004-11-04 07:17:08 +00:00
Poul-Henning Kamp
e93a5ce092 Stop dumping the MBR entries under bootverbose 2004-11-03 09:08:33 +00:00
Poul-Henning Kamp
2859a695dc Stop wasting a bootverbose line on all geom slices. 2004-11-03 09:08:10 +00:00
Poul-Henning Kamp
55f499a94f Don't set si_bsize_phys, nobody cares. 2004-10-29 11:11:44 +00:00
Poul-Henning Kamp
4d13ab3da2 Add GEOM class "VFS" for filesystems and other buffer cache users
of GEOM devices.

There is nothing magic about this, it just gives a bufobj interface
to GEOM.
2004-10-29 09:56:56 +00:00
Poul-Henning Kamp
725419af56 Add g_wither_geom_close() function. 2004-10-29 09:19:03 +00:00
Poul-Henning Kamp
6afb3b1c37 Give dev_strategy() an explict cdev argument in preparation for removing
buf->b-dev.

Put a bio between the buf passed to dev_strategy() and the device driver
strategy routine in order to not clobber fields in the buf.

Assert copyright on vfs_bio.c and update copyright message to canonical
text.  There is no legal difference between John Dysons two-clause
abbreviated BSD license and the canonical text.
2004-10-29 07:16:37 +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
Poul-Henning Kamp
8c24ef5f78 Use unit number allocation functions for GEOM minor numbers. 2004-10-25 12:28:28 +00:00
Poul-Henning Kamp
f8fe7a735c Retire si_stripesize and si_stripeoffset they will not be needed in cdev
in the future.
2004-10-25 07:40:54 +00:00
Poul-Henning Kamp
85986ce002 Don't call g_waitidle(), it happens automagically now. 2004-10-23 20:52:15 +00:00
Poul-Henning Kamp
9197ce2ee5 Add a new per-thread private flag: TDP_GEOM.
This flag gets set whenever the thread posts an event on the GEOM
event queue, and if the flag is set when the thread is prepared
to return to userland from the kernel, g_waitidle() will be called
to make sure that the posted events have completed.

This can replace an insufficient number of g_waitidle() calls in
various other places, and has the advantage of being failsafe:  Any
system call which does a VOP_OPEN()/VOP_CLOSE will now correctly
wait for any geom events it posted as part of spoils or tastes.

Assert that topology and Giant is not held in g_waitidle().
2004-10-23 20:49:17 +00:00
Poul-Henning Kamp
a11021f362 Move the prototype for g_waitidle() to a more visible place. 2004-10-23 20:22:02 +00:00
Andrew R. Reiter
f96c8ef18a - Turn KASSERT()s into warning printf()'s in the g_class_load() routine.
This removes a panic that will occur if you build with GENERIC and
  attempt to kldload a GEOM module that is already in the kernel.

Reviewed by: phk
2004-10-22 22:16:24 +00:00
Robert Watson
49dbb61dfc Add KTR_GEOM, which allows tracing of basic GEOM I/O events occuring
in the g_up and g_down threads.  Each time a bio is propelled up and
down the stack, an event is generating showing the provider, offset,
and length, as well as thread wakeup and work status information.
2004-10-21 18:35:24 +00:00
Pawel Jakub Dawidek
06697d4f59 Ehh. Introduce a hack: Wait for 3 seconds, so GEOM is able to give us
providers for tasting. Before this hack, race below is possible:
	SI_SUB_RAID (no not-fully-configured geoms, so don't block)
	GEOM tasting (now geoms are created)
	SI_SUB_MOUNT_ROOT (if root file system is placed on a mirror, it is
		possible that this mirror is not fully configured yet)
There is a lot of work to do to avoid such hacks and I need a working
solution before 5.3, sorry.

Reported by:	John Hay <jhay@icomtek.csir.co.za>
2004-10-14 07:55:29 +00:00
Pawel Jakub Dawidek
268111a210 Only allow for unloading when there are no geoms in LABEL GEOM class.
We have to use our own destroy_geom method, because default one, which
is a part of geom_slice is broken.
MT5 candidate.

PR:		kern/72467
Submitted by:	Vladimir Novoseltsev
2004-10-14 07:46:13 +00:00
Brian Feldman
6f299fa373 When loading GEOM modules, we expect the actual load process to be done
by the time that kldload(8) returns.  Satisfy that by making the GEOM
module load event -- only when the kernel is !cold -- wait until the
GEOM module init function has finished instead of returning immediately.

This is the other half of fixing md(8) (actually, "mfs" in fstab(5))
that is similar to r1.128 of src/sys/dev/md/md.c.  This bug would be
why RAM disks would often fail on boot and the first call to mdconfig(8)
would probably fail.

pjd has ideas for not requiring kldload(8) to work synchronously for
control devices that could make this obsolete.

Silence on:	-arch
2004-10-12 04:44:54 +00:00
Stephan Uphoff
f7717523a2 Trace information about a buffer while we still control it.
Reviewed by:    phk
Approved by:    sam (mentor)
2004-10-11 21:22:59 +00:00
Søren Schmidt
39e6971cba Only do the geometry translations on ad* devices, other devices seems to
have their own way of life.
Those other devices translations should be moved here as well.
2004-10-08 21:27:27 +00:00
Pawel Jakub Dawidek
7aefe57c5c Be sure to always return 0 for negative access requests.
Reported by:	Maciej Kucharz <qk@comp.waw.pl>
2004-10-07 20:13:23 +00:00
Søren Schmidt
6c35773729 Move the PC98 specific geometry "gunk" to geom_pc98.c where it belongs.
This also adds support for bigger disks on the controller I have access to,
and maybe others if I understood the adhoc methods used on those.

Those with more PC98 bigdrive controllers it is hereby invited to add/fix
support for those in geom_pc98.c and not using #ifdef PC98 all over the place.
2004-10-07 17:37:09 +00:00
Poul-Henning Kamp
276f72c550 Don't set the BIO_ONQUEUE debugging flag until we actually put the bio
onto a queue.  This made the ENOMEM handling an instant panic.
2004-10-06 20:59:59 +00:00
Pawel Jakub Dawidek
dd12956ac7 Geoms without softc are geoms which are initialized, so wait for them. 2004-10-06 18:47:15 +00:00
Pawel Jakub Dawidek
18d2addc23 Look out for geoms without softc.
Reported by:	tegge
2004-10-06 14:15:47 +00:00
Pawel Jakub Dawidek
59883b3b34 Before root file system is mounted, wait for mirrors in degraded state. 2004-10-05 11:17:08 +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
Pawel Jakub Dawidek
c7e17f4bbe Unlock g_gate_list_mtx mutex when we cannot allocate unit number.
MT5 candidate.

PR:		kern/72253
Submitted by:	Ivan Voras <ivoras@fer.hr>
2004-10-02 15:03:26 +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
Poul-Henning Kamp
19fa21aa50 Protect the start/end counts on consumers and providers with the up/down
mutexes.

Make it possible to also protect the disk statistics (at a minor cost in
performance) by setting bit 2 of kern.geom.collectstats.
2004-09-28 11:56:37 +00:00
Pawel Jakub Dawidek
8dd5480d29 - Set maximum request size to MAXPHYS (128kB), instead of DFLPHYS (64kB).
- Set minimum request size to sectorsize, instead of 512 bytes.

Approved by:	phk (some time ago)
2004-09-28 08:34:27 +00:00
Pawel Jakub Dawidek
604fce4f60 Just use MAXPHYS as maximum I/O request size, instead of using my own
#define for this purpose.
No functional change.
2004-09-28 07:33:37 +00:00
Pawel Jakub Dawidek
e5e7825cc3 Decrease kern.geom.raid3.timeout to 4, so it is smaller than
vfs.root.mountdelay by default.
2004-09-27 22:12:14 +00:00
Pawel Jakub Dawidek
6c25233782 Deny invalid I/O requests which comes from userland here, because later
we'll get a panic.
MT5 candidate.

Reviewed by:	phk
2004-09-27 22:10:01 +00:00
Pawel Jakub Dawidek
d2fb9c62e2 Avoid race while synchronizing components. It is very hard to bump into,
but it is possible:
1. Read data from good component for synchronization.
2. Write data to the same area.
3. Write synchronization data, which are now stale.

Found by:	tegge (for gmirror)
2004-09-27 20:32:35 +00:00
Pawel Jakub Dawidek
829c0864cb Minor, but very important condition fix. The current one can never be true. 2004-09-27 19:32:26 +00:00
Pawel Jakub Dawidek
cf41526bdc Decrease kern.geom.mirror.timeout to 4, so it is smaller than
vfs.root.mountdelay by default.
2004-09-27 13:47:37 +00:00
Pawel Jakub Dawidek
0217ba9893 Forgot to commit addition of ds_resync field. 2004-09-26 20:42:35 +00:00
Pawel Jakub Dawidek
e8adbe4499 Avoid race while synchronizing components. It is very hard to bump into,
but it is possible:
1. Read data from good component for synchronization.
2. Write data to the same area.
3. Write synchronization data, which are now stale.

Found by:	tegge
2004-09-26 20:41:07 +00:00
Pawel Jakub Dawidek
31522023f9 Simplify code a bit. 2004-09-26 20:30:15 +00:00
Poul-Henning Kamp
a7830346e2 Assert topology is held in g_dev_getprovider().
Don't call devsw().  It is not necessary, and we do not need to hold dev_lock
to compare the devsw pointer to our own since we do not dereference it.
2004-09-24 06:43:20 +00:00
Pawel Jakub Dawidek
201dfcf143 This is not needed anymore, it is forced in GEOM now.
Actually, it can even cause some problems, because GEOM requires sectorsize
to be more than 0 on first access, not on provider creation, so we can skip
valid providers by doing this check here.

Reported by:	Divacky Roman <xdivac02@stud.fit.vutbr.cz>
		Sven Willenberger <sven@dmv.com>
2004-09-20 17:26:25 +00:00
Max Khon
9cf3607da2 Use correct malloc type when freeing memory allocated by g_read_data.
PR:		71431
Submitted by:	daichi
2004-09-19 10:27:46 +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
Max Khon
b3f05a2e9e g_nop_create: destroy newly created provider in case of errors. 2004-09-16 15:28:48 +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
Pawel Jakub Dawidek
7e8ca741ca Make kern.geom.debugflags sysctl tunable from /boot/loader.conf.
It will help to debug problems when booting.

Approved by:	phk
2004-09-13 14:58:27 +00:00
Poul-Henning Kamp
4090065137 Fix a problem that shows up if less than the full complement of
lock sectors are defined ("number_of_keys" argument to gbde init being
less than 4 in the default compile).
2004-09-11 17:58:53 +00:00
Poul-Henning Kamp
cbca0b53e5 Respect that G_BDE_MAXKEYS is a compile time variable. 2004-09-11 17:57:51 +00:00
Max Khon
51eb0765c6 Do not compile in zlib.c. Add a dependency on module instead. 2004-09-08 17:27:31 +00:00
Pawel Jakub Dawidek
f7b4d339ac Show current status of mirror device directly.
Suggested by:	Krzysztof Ciep³ucha <kris@home.pl>
2004-09-08 16:37:22 +00:00
Poul-Henning Kamp
5ae652c0ed For removable devices without media we set a zero mediasize but a non-zero
sectorsize in order to avoid a lot of checks around various divisions etc.

Enforce the sectorsize being > 0 with a KASSERT on successful open.

Fix scsi_cd.c to return 2k sectors when no media inserted.
2004-09-05 21:15:58 +00:00
Pawel Jakub Dawidek
6d7b8aecd3 Allow to configure debug level from /boot/loader.conf. 2004-08-30 18:50:06 +00:00
Poul-Henning Kamp
dcbd0fe5aa Add more KASSERTS and checks. 2004-08-30 09:33:06 +00:00
Pawel Jakub Dawidek
45d5e85a40 GCC, ehh. 2004-08-29 14:29:30 +00:00
Pawel Jakub Dawidek
c0d68b6ef2 Use sc->sc_mediasize instead of sc->sc_provider->mediasize which contains
exactly the same value, but is shorter.
2004-08-28 02:35:43 +00:00
Pawel Jakub Dawidek
08249e9e6e Warn the user if we are not going to use whole provider space.
Requested by:	Michael Handler <handler@grendel.net>
2004-08-28 02:34:10 +00:00
Pawel Jakub Dawidek
16ebaa0793 Don't allow to insert providers, which are too small.
Reported by:	Michael Handler <handler@grendel.net>
2004-08-28 02:02:48 +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
Poul-Henning Kamp
a2033c9615 Introduce g_alloc_bio() as a waiting variant of g_new_bio().
Use in places where we can sleep and where we previously failed to check
for a NULL pointer.

MT5 candidate.
2004-08-27 14:43:11 +00:00
Lukas Ertl
4328802ce9 When attaching a consumer from a volume to a plex, check if the
volume already has a plex attached and adjust the access counts
of the new consumer accordingly.
2004-08-26 21:04:41 +00:00
Pawel Jakub Dawidek
29c78ab315 Skip providers with not defined sector size.
Reported by:	kuriyama
2004-08-26 12:42:47 +00:00
Pawel Jakub Dawidek
4cf67afe37 Log verification errors at level 1. 2004-08-25 19:18:07 +00:00
Pawel Jakub Dawidek
f0c8658d4e Dump disk number. 2004-08-25 12:14:44 +00:00
Pawel Jakub Dawidek
c8b906bcbe Allow to set kern.geom.mirror.timeout from /boot/loader.conf. 2004-08-23 20:42:34 +00:00
Lukas Ertl
a3423d4c6f Compare the addresses of two RAID5 work packets directly instead
of the addresses of their related bios when locking one out, since
they could share a bio and this could lead to parity corruption.
2004-08-23 17:50:18 +00:00
Lukas Ertl
c4bdc6fc32 Implement the possibility to remove drives. 2004-08-22 17:07:55 +00:00
Pawel Jakub Dawidek
dba915cfee Implementation of 'verify reading' algorithm, which uses parity data for
verification of regular data when device is in complete state.
On verification error, EIO error is returned for the bio and sysctl
kern.geom.raid3.stat.parity_mismatch is increased.

Suggested by:	phk
2004-08-22 16:21:12 +00:00
Lukas Ertl
45d0fdcda9 Add forgotten format specifier in a KASSERT and shut up the compiler.
Submitted by: Gavin Atkinson <gavin.atkinson@ury.york.ac.uk>
2004-08-22 13:34:24 +00:00
Pawel Jakub Dawidek
d12bd83e9b Add version history. 2004-08-21 21:15:03 +00:00
Pawel Jakub Dawidek
f5a2f7feac Implement new reading algorithm, which will use parity component for reading
as well, even if device is in complete state.
I observe 40% of speed-up with this option for random read operations,
but slowdown for sequential reads.
Basically, without this option reading from a RAID3 device built from 5
components (c0-c4) looks like this:

	Request no.	Used components
	1		c0+c1+c2+c3
	2		c0+c1+c2+c3
	3		c0+c1+c2+c3

With the new feature:

	Request no.	Used components
	1		c0+c1+c2+c3
	2		(c1^c2^c3^c4)+c1+c2+c3
	3		c0+(c0^c2^c3^c4)+c2+c3
	4		c0+c1+(c0^c1^c3^c4)+c3
	5		c0+c1+c2+(c0^c1^c2^c4)
	6		c0+c1+c2+c3
	[...]
2004-08-21 18:11:46 +00:00
Lukas Ertl
83bfcb1092 A volume can be up if it has a degraded RAID5 plex. 2004-08-19 12:03:27 +00:00
Pawel Jakub Dawidek
d86bc96cab We really don't want to receive spoil event for synchroniztion consumers. 2004-08-18 23:33:37 +00:00
Poul-Henning Kamp
a9654c8c58 Do not override the class provided dumpconf function. 2004-08-18 21:42:08 +00:00
Lukas Ertl
9a8bd51965 Pretty print some informational messages. 2004-08-18 20:43:56 +00:00
Lukas Ertl
d30f29867e Fix a stupid bug in the drive taste function: when checking if a
drive is known to the configuration check also if it already has a geom.
Without this check several needless geoms are created and valid
configuration data was overwritten.

This change obsoletes the need for a separate geom to taste an
offered provider and the consumer doesn't need to be opened with the
exclusive bit set.
2004-08-18 20:34:45 +00:00
Pawel Jakub Dawidek
b25aec32ff NOP class doesn't operate on metadata, so the spoil event can be safely
ignored.
2004-08-18 16:58:42 +00:00
Pawel Jakub Dawidek
28b31df727 Dump device status on 'list' command. 2004-08-18 16:46:51 +00:00
Pawel Jakub Dawidek
f1ad62a4d8 Bump synchronization ID if we are sure, that we have ACTIVE components. 2004-08-18 07:28:48 +00:00
David E. O'Brien
fa6a78376f Minor style.9 cleanup. 2004-08-16 10:33:35 +00:00
Pawel Jakub Dawidek
809a9dc601 Decrease debug level to 0. 2004-08-16 08:33:04 +00:00
Pawel Jakub Dawidek
5e6db16cd6 Fix warning. 2004-08-16 08:21:31 +00:00
Pawel Jakub Dawidek
2d1661a5b6 Introduce GEOM RAID3 class, i.e. kernel module, which implements RAID3
transformation and graid3(8) userland utility, which can be used for
configuration. No manual page yet, sorry.

Hardware provided by:	Daniel Seuffert
2004-08-16 06:23:14 +00:00
Pawel Jakub Dawidek
f62d59df32 Avoid code duplication by introducing g_mirror_write_metadata() function,
which is used now by g_mirror_clear_metadata() function and
g_mirror_update_metadata() function.
2004-08-15 13:58:29 +00:00
Lukas Ertl
71fd4f60da Make informational output look less like an accident. 2004-08-14 09:56:17 +00:00
Max Khon
75261008d7 Add geom_uzip -- geom class that implements read-only compressed disks.
Currently supports cloop V2.0 disk compression format.
May support more formats in future.
2004-08-13 09:40:58 +00:00
Pawel Jakub Dawidek
887c9fd564 MFp4: Simplify code a bit:
- Remove kern.geom.mirror.sync_block_size sysctl. It is quite obvious that we
  want to use the biggest size possible.
- Do not use UMA zone for sync data allocations. There could be only one
  synchronization request per synchronized disk at a time, so allocate memory
  for one request on whole synchronization process related to one disk.

Tested by synchronizing one component (out of three) and by synchronizing
two components (out of three) in parallel.
2004-08-11 23:41:53 +00:00
Pawel Jakub Dawidek
445a4b68f2 Actually, HARDCODED flag isn't stored in metadata, so don't bother
dumping it.
2004-08-11 22:16:42 +00:00
Pawel Jakub Dawidek
2def749bb1 - Fix typo.
- Dump HARDCODED flag.
2004-08-11 22:12:44 +00:00
Pawel Jakub Dawidek
a5ef629f10 Increase default kern.geom.stripe.maxmem to 50 elements. 2004-08-11 12:57:17 +00:00
Pawel Jakub Dawidek
1b949c05a3 When sending request once again because of ENOMEM, reset bio_children
and bio_inbed fields to 0. Without this change we can end up with
I/O leakage in some rare situations.
I tested this change by putting failure probability mechanism simlar
to this used in NOP class into g_clone_bio(9) function, so it was
able to return NULL with the given probability.

Discussed with:	phk
2004-08-11 12:04:35 +00:00
Pawel Jakub Dawidek
6d8fb92d78 Try harder to not panic on 'stop -f'.
After the commit, this command should be really safe to use.
2004-08-11 11:10:46 +00:00
Lukas Ertl
92f49a969d If we kill the worklist thread of a RAID5 plex we can destroy
the worklist mutex at the same time, so move the mtx_destroy() call
to gv_kill_thread().
2004-08-10 20:51:48 +00:00
Lukas Ertl
ecffb8e64b Lock the topology before calling gv_parse_config, not afterwards. 2004-08-10 20:15:12 +00:00
Pawel Jakub Dawidek
6b2b3e8745 - Recognize HARDCODED flag when dumping consumer configuration.
- Improve code readabilty a bit.
2004-08-10 19:53:31 +00:00
Pawel Jakub Dawidek
c38d2f4eca Forgot to commit those: introduce hardcoded provider functionality,
which allow to store provider's name in the metadata and avoid
problems when few providers share the same last sector.
2004-08-10 19:52:12 +00:00
Pawel Jakub Dawidek
4ffa3fef69 Fix one of the lastest commit. This bio_caller1 should also be changed to
bio_driver1 (as all the rest).
This introduced a small memory leak, but it wasn't really critical,
because maximum memory for g_stripe_zone is always set, so after few
requests gstripe was working in "economic" mode.
2004-08-10 19:07:55 +00:00
Pawel Jakub Dawidek
6c74f5177c - Introduce option for hardcoding providers' names into metadata.
It allows to fix problems when last provider's sector is shared between few
  providers.
- Bump version number for CONCAT and STRIPE and add code for backward
  compatibility.
- Do not bump version number of MIRROR, as it wasn't officially introduced yet.
  Even if someone started to play with it, there is no big deal, because
  wrong MD5 sum of metadata will deny those providers.
- Update manual pages.
- Add version history to g_(stripe|concat).h files.
2004-08-09 11:29:42 +00:00
Pawel Jakub Dawidek
7e72a70863 Do not use g_wither_geom(9). I doesn't work in the way which is expected
here anymore (after g_wither_washer() was introduced), i.e. geom and consumer
will not be immediately destroyed if possible.
2004-08-09 11:14:25 +00:00
Poul-Henning Kamp
157b106eae Too many versions.
Spotted by:	pjd
2004-08-09 06:04:00 +00:00
Poul-Henning Kamp
07f076fe7a OK, now check geom class version numbers. 2004-08-08 08:34:46 +00:00
Poul-Henning Kamp
5721c9c76a Tag all geom classes in the tree with a version number. 2004-08-08 07:57:53 +00:00
Poul-Henning Kamp
e232f70a75 OOps, that check was a bit premature. Allow zero versions as well. 2004-08-08 07:30:47 +00:00
Poul-Henning Kamp
650ee351b3 Use default method initialization on geoms. 2004-08-08 06:49:07 +00:00
Poul-Henning Kamp
dd66958e28 Give classes a version number and refuse to touch classes which are not
understood.  This makes room for additional binary compatibility in the
future.

Put fields in the class for the geom's methods and initialize the methods
of a new geom from these fields.  This saves some code in all classes.
2004-08-08 06:46:27 +00:00
Pawel Jakub Dawidek
cea363682f Add and document kern.geom.stripe.fast_failed sysctl, which shows how
many times "fast" mode failed.
2004-08-06 10:19:34 +00:00
Pawel Jakub Dawidek
ec70430134 Fields bio_caller[12] should be used by the consumer and fields
bio_driver[12] should be used by the provider!
2004-08-06 10:07:03 +00:00
Pawel Jakub Dawidek
37abacd4ff Fix I/O leakage. We're cloning bios in g_stripe_start_fast(), but when
something goes wrong while running in "fast" mode, we free all bios and
falling back to "economic" mode. Freeing bios, doesn't mean decrease
bio_children, so bio_inbed couldn't be equal to bio_children and request
was never finished.
Decrease bio_children manually when destroying bios.

Reported by:	Sam Lawrance <boris@brooknet.com.au>, simon
2004-08-06 09:55:40 +00:00
Pawel Jakub Dawidek
db332970e7 Don't use 'bp' after its destruction! 2004-08-05 14:07:21 +00:00
Pawel Jakub Dawidek
a4fa09ec93 Simplify a bit - we could use 'sc' here as it was initialized properly. 2004-08-05 13:22:17 +00:00
Pawel Jakub Dawidek
51385a3c00 - Add two fields to bio structure: 'bio_cflags' which can be used by
consumer and 'bio_pflags' which can be used by provider.
- Remove BIO_FLAG1 and BIO_FLAG2 flags. From now on new fields should be
  used for internal flags.
- Update g_bio(9) manual page.
- Update some comments.
- Update GEOM_MIRROR, which was the only one using BIO_FLAGs.

Idea from:	phk
Reviewed by:	phk
2004-08-04 21:35:05 +00:00
Pawel Jakub Dawidek
fe7c3780c8 - Add "prefer" balance algorithm. When used, only disk with the biggest
priority will be used for reading.
- Bump version number.
2004-08-04 12:09:53 +00:00
Pawel Jakub Dawidek
e1efe7edcd MFp4: We don't really need g_mirror_free_disk() function. 2004-08-04 10:02:06 +00:00
Pawel Jakub Dawidek
7d01f1820a Fix comment. 2004-08-03 15:41:33 +00:00
Pawel Jakub Dawidek
969ff54d70 - Fix unloading by the same way it is done in my other classes:
set gp->softc to NULL and return ENXIO when it is NULL, so GEOM
  will not panic or hang, but unload one device on every 'unload'.
  This make 'unload' command usable, but it have to be executed
  <number of devices> + 1 times.
- Made use of 'pp' variable.
2004-08-02 00:37:40 +00:00
Pawel Jakub Dawidek
6b1c71eef8 Typo. 2004-08-01 20:41:58 +00:00
Pawel Jakub Dawidek
4084e6aad2 - Launch main provider when there are no more disks in NEW state.
- Log syncid bump at debug level 1.
2004-08-01 09:01:50 +00:00
Pawel Jakub Dawidek
959521ff1f If there are no valid components after the timeout, just destroy device.
There is probably nothing to wait for.
2004-07-31 22:10:51 +00:00
Lukas Ertl
4b017d0d93 Propagate size changes upwards. 2004-07-31 21:34:21 +00:00
Pawel Jakub Dawidek
4b2e596e38 Handle spoil event in dedicated function: g_mirror_spoiled().
The different between the new function and g_mirror_orphan() (which was
used previously) is that syncid is bumped immediately, instead of on
first write, because when consumer was spoiled, it means, that its
provider was opened for writing, so we can't trust that its data
will be valid when it will be connected again.
2004-07-31 21:08:17 +00:00