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.
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
initialized subdisks.
Tidy up some comments.
Eliminate sddownstate(); it wasn't being used any more. Return
REQUEST_DOWN instead.
Add setstate_by_force() to implement the VINUM_SETSTATE_FORCE ioctl
for diddling individual object states. This is a repair tool which
can also be used for panicing the system. Use with utmost care if at
all.
goes into initialized state, not 'up'. This makes it easier to ensure
consistency in multi-plex volumes.
update_plex_state: redo transitions from empty and initialized
subdisks to up or reviving, depending on the number of plexes.
Reported-by: Bernd Walter <ticso@cicely.de>
Remy Nonnenmacher <remy@synx.com>
Don't return "can't do it" when the user requests a state change to
the current state. This previously caused silly messages like "Can't
start <foo>: invalid argument", when in fact <foo> was already
started.
set_plex_state: don't set state for non-existent plexes.
update_plex_status: as long as we have initializing subdisks, we're
initializing.
Add Cybernet copyright.
OK'd-by: Chuck Jacobus <chuck@cybernet.com>
update_plex_state:
If any subdisk in the plex is initializing, set the plex to
initializing state. This gets rid of the ugly corrupt/degraded/up
transitions which previously occurred.
Desired-by: Steve Taylor <staylor@cybernet.com>
sddownstate:
Add new function, used by checksdstate.
checksdstate:
Let sddownstate decide what status to return.
If the drive goes down, queue a close to the daemon. In many cases
this function gets called in process context, so it could do it
directly, but it's more trouble finding out where we came from than
getting the daemon to do it.
plexes_used and volumes_used. Now these fields are only informative,
and the <object>_allocated count is used for searches, etc. This also
required checking the object state before doing things with the
presumed object.
Problems-reported-by: Kiril Mitev <kiril@ideaglobal.com>
Change from lkm to kld
Serious rewrite. No longer call set_<foo>_state to set the state
based only on other objects; instead, add functions
update_<foo>_state, which determine what the state should be by
themselves. This allows the set_<foo>_state functions to shrink
enough to be almost intelligible.
Remove flags setstate_recurse and setstate_recursing.
Remove plex defective regions and unmapped regions, which were
maintained but not used.
Change code to allow daemon to perform operations formerly kludged
into an interrupt context. Remove the DIRTYCONFIG kludge.
kernel as a pseudo-device. The changes were:
- #ifdef DEBUG -> #ifdef VINUMDEBUG
- opt_vinum.h for holding above config variable
- Fixing up a few stray problems where DEBUG wasn't optional.
- config.c -> vinumconfig.c (there's already a config.o)
- Other *.c -> vinum*.c (wasn't strictly necessary, but done in case we end
up with something else conflicting later on and we might have to have yet
more repository copies of files).
- include file paths fixups.. (ie: get them all from the kernel tree
instead of partly from the kernel and partly from /usr/include/machine)
I've spoken with Greg about this.. I hope this doesn't mess him around
too much..
the top half to do it.
Put in a dubious check for subdisk integrity when trying to bring
up a plex where others are already up. This particular kludge is
crying out for a rewrite of the whole state code.
Add code to set_plex_state and set_volume_state to defer updates when
called from an interrupt context. This doesn't happen yet, but it
could do.
config_drive:
Catch an instance of anonymous drives. Doubtless many remain.
interrupt.c:
complete_rqe:
Call logrq to log iodone events if DEBUG_LASTREQS is set.
Call set_sd_state with setstate_noupdate to avoid buffered I/O out
of interrupt context.
Use define DEBUG_RESID instead of constant.
memory.c:
Remove dead expandrq() function
Malloc:
Remove directory component of file names in malloc table.
Add function vinum_rqinfo (part of the request tracing stuff).
request.c:
Add function logrq (part of the request tracing stuff).
vinumstrategy:
Check whether config needs to be written to disk, do it if so.
This is a stopgap until the Vinum daemon (bacchusd? oenologistd?)
is written.
If DEBUG_LASTREQS is set, call logrq to log user buffer headers.
launch_requests:
Correct format of debug output to console.
If DEBUG_LASTREQS is set, call logrq to log request elements.
request.h:
Add definitions for request trace.
state.c:
set_sd_state:
Check flags for setstate_noupdate. If set, don't write the config
to disk, just set global VF_DIRTYCONFIG flag. This is part of the
kludge to avoid writing config from an interrupt context.
vinumext.h:
Add declaration for vinum_rqinfo, put inside #ifdef DEBUG
Remove dead macro expandrq
vinumio.h:
Increase maximum ioctl reply length to 4 kB if DEBUG is set.
Define VINUM_RQINFO ioctl if DEBUG is set.
vinumioctl.c:
vinumioctl:
Change implementation of VINUM_DEBUG ioctl: use a debug flag
(DEBUG_REMOTEGDB) to decide whether to go into remote debugging or
not.
Implement VINUM_RQINFO.
vinumkw.h:
Define kw_info even when not debugging.
vinumvar.h:
Define VF_DIRTYCONFIG
Add pointers to request info to vinum_info if DEBUG is set.
Define setstate_noupdate
Define additional debug bits DEBUG_RESID, DEBUG_LASTREQS and
DEBUG_REMOTEGDB.