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>
VINUM_<object>CONFIG: return ENXIO rather than EFAULT if an object
doesn't exist.
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>
vinum_scandisk: increment drive use count when we find a good one.
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>
Remove unused (and braindead) functions volume_index, plex_index,
sd_index and drive_index.
Add a flag VF_CREATED for volumes. VF_NEWBORN was being used in two
capacities, and they clashed, my Lord, they clashed.
find_object: restructure the search loop as a result of the change in
variable use.
Decrement object use count in the remove_<object> functions, not in
the free_<object> functions, which are often called with partially
initialized (and uncounted) objects.
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>
longjmp. I suspect that the occasional double panic may be the result
of incorrect parameters to longjmp. This happens, of course, like the
entire file, only with -DVINUMDEBUG.
give_sd_to_plex: Don't set Raid-5 subdisk state here.
config_subdisk: handle the name parameter correctly when the subdisk
was referenced in a previous plex definition. The
name parameter must come first.
Handle autosizing relatively correctly. There is
still a danger of losing drive space if problems
occur with an autosized subdisk.
Set state to empty, not up, when complete. This also
solves a nagging problem about enforcing the need to
initialize RAID-5 plexes.
config_plex: handle the name parameter correctly when the plex
was referenced in a previous volume definition. The
name parameter must come first.
Handle initial state better.
update_plex_config:
Calculate the trim factor for RAID-5 plexes correctly.
Set the number of down subdisks correctly when reading
from disk config.
remove the splbio() around the call to launch read requests.
launch_requests:
Move the splbio() protection outside the entire launch_loop. The
previous location was causing problems with IDE drives, where the
call to the strategy routine often did not complete until after
complete_rqe deallocated the request structure.
Solution-independently-found-by: Russell Neeper <r-neeper@tamu.edu>
Problem-reported-by: Vallo Kallaste <vallo@matti.ee>
John Saunders <john@nlc.net.au>
Bernd Walter <ticso@cicely.de> (maybe)
Check for partition types FS_VINUM and FS_UNUSED. Accept both, but
complain about FS_UNUSED. At a later date, only FS_VINUM will be
accepted.
Threatened-since: over a year
Add a flag `force' (VF_FORCECONFIG) to force name changes of
existing drives.
config_drive:
If the drive already has a vinum label, and name doesn't match the
specified drive, do it anyway if the 'force' flag is specified.
finish_config:
Reset the `force' flag.
Continually-tripped-over-by: Karl Pielorz <kpielorz@tdx.co.uk>
give_sd_to_drive:
If the drive is down, take the subdisk down and don't try to fix
things.
update_plex_config:
Don't try to update the config parameters of a plex which isn't
fully configured (state plex_init or plex_unallocated).
Correctly calculate the amount to trim off a striped or RAID-5 plex
whose size is not a multiple of the stripe size.
compiled with or without debugging support. This enables us to catch
(fatal) mismatches between the kernel and userland.
Coalesce flags VINUM_DISKCONFIG and VINUM_READING_CONFIG. They did
essentially the same thing.
Add VINUM_BIGDRIVE for pretending we have macho hardware.
pretends that each drive is 100 times as large as it really is. Not
for use at home.
Coalesce flags VINUM_DISKCONFIG and VINUM_READING_CONFIG. They did
essentially the same thing.
This solved a problem where 'vinum resetconfig' only reset half
the drives.
Reported-by: Brad Knowles <blk@skynet.be>
Karl Pielorz <kpielorz@tdx.co.uk>
Change the super device. We now have three super devices:
1. The normal superdevice used by vinum(8).
2. The superdevice used by vinum(8) when compiled with debug support.
3. The superdevice used by the daemon.
This method allows vinum(8) to determine debug mismatches. Also check
correctly for the device type. The old code did not check all bits of
the minor number.
Reported-by: a cast of thousands, most recently by Brad Knowles
<blk@skynet.be>.
MMalloc: save the time at which the request was granted, remove more
crud.
FFree: add a circular buffer of the last 64 Free requests if
DEBUG_MEMFREE is set.
after the volume had been fully operational; involves a change in the
use of the VF_NEWBORN flag. Now if you add a plex to a volume which
is up, the plex will be down and the subdisks stale. You need to
explicitly start the subdisks, which copies data from the good
subdisks to the uninitialized ones.
Stumbled-over-by: Ludwig Pummer <ludwigp@bigfoot.com>
give_sd_to_drive:
correct method to give the entire largest chunk of drive to the
subdisk. Now it's enough to specify a length, and vinum will give
you as much as it can. Not to be recommended except for empty
drives.
Correct a bogon which made vinum refuse to give the last sector of
a drive to a subdisk.
Last-reported-by: Ludwig Pummer <ludwigp@bigfoot.com>
Change %q formats to %ll before the former go away. This doesn't make
much difference, since kernel kvprintf currently doesn't support
either, and the messages in question are just error messages.
Change VINUM_SAVECONFIG: it now requires a parameter. 0 means
"configuration updates are finished, please save", and 1 means "please
just save the config". This second meaning is invoked by the new
"saveconfig" command to vinum(8).
Recognize "referenced" drives by the lack of a slash in the device
name, not by a NUL character.
vinum_scandisk: return error indication (ENOENT if we can't find any
vinum drive, otherwise 0).
VINUM_SAVECONFIG: change parameters.
Don't save config while we're reading it from disk.
Change the way we handle the daemon: if we can't communicate with it
for 1 second (which is possible), start a new one. The daemon saves
its pid in daemonpid; on each iteration of the main loop the daemon
checks whether it's still in favour. If not, it silently exits.
Also, when trying to communicate with the daemon, check daemonpid
first. If it's set to 0, don't even try.
Rename the VF_KERNELOP to VF_DISKCONFIG and checkkernel () to
checkdiskconfig (), which better describes their function.
Disable configuration updates if we have an error reading in the
configuration. This stops a "shoot-in-foot" problem where a mistake
can cause the configuration to be obliterated.
Tidy up some messages, which included superfluous \ns.
Recognize RAID-5 configuration information even in the non-RAID-5
version. This fixes shoot-in-foot problems where starting the wrong
version of vinum would kill RAID-5 plexes.
Recognize drives that have been referenced, but for which no physical
location is known. This is part of a modification which will
ultimately allow incrementally reading configurations. Such drives
will have a device name "unknown".
New function return_drive_space () returns space to a drive.
Previously this was part of free_sd ().
give_sd_to_drive: don't do it if the subdisk needs more space than the
drive has available.
config_sd: if reading config from disk, accept plex offset, drive
offset and length specs of -1 to indicate error conditions.
parse_config: return ENOENT if the "read" command doesn't find any
drives.
remove_sd_entry: don't do it, even by force, if it's open.
If the size of a striped or RAID-5 plex is not an integral multiple of
the stripe size, trim the size until it is.
reinstate update_volume_config, which had atrophied, to recalculate
the size of a volume if a plex has shrunk due to stripe size
considerations.
vinumattach: Zero out tables after allocating them
Modify procedure at unload: if a vinum(8) has the superdev open, don't
close down. If only the daemon has it open, send the daemon a stop
request and wait for it to close the superdev, then unload.
In order to do this, create a second superdev which is opened by the
daemon. The open and close routines set a different bit in
vinum_conf.flags; otherwise the treatment is identical.
Remove opencount field in vol structure; replace by a flag bit, since
we can't count the number of opens.
Remove dead LKM grunge.
the same name. Silently return EEXIST if this happens.
vinum_scandisk: Collect drive numbers, not pointers, to avoid problems
of relocated drives.
Tripped-over-by: Bernd Walter <ticso@cicely.de>
time out on an operation. Under these circumstances, vinum(8) will
automatically start another daemon. Add a pid for the daemon, so that
an overtaken daemon will discover that it's no longer in favour, and
will crawl into a corner and die.
apparently in accordance with style(9).
Complained-about-by: bde
vinumopen: Change check for root user to a call to suser(9)
vinumclose: Remove check for root user.
Nitpicked-by: phk
vinum_scandisk: check not only drive error, but also drive state,
before accessing the drive.
drivecmp: Remove warning messages by Backing out overly constant
declarations in revision 1.9.
Change from lkm to kld
Add field plexsdno to sd struct
Add flag VF_NEWBORN to drive, sd, plex and volume structs, indicating
that the object has just been created.
Add object types for raw (unattached) plexes and subdisks
Remove definitions of VOLNO, PLEXNO and SDNO (now functions Volno,
Plexno and Sdno)
Move revive parameters from struct plex to struct sd.
struct plex:
maintain a count of the number of inaccessible subdisks.
remove defective and unmapped regions.
Debug flags: make an enum (previously #define)
Set default revive block size to 64kB (was 32 kB)
Previously, accidentally starting the wrong version could corrupt
the RAID5 configuration.
Add functions Volno, Plexno and Sdno to replace the old defines
VOLNO, PLEXNO and SDNO.
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.
Change from lkm to kld
Remove #ifdefs for FreeBSD 2.c
vinumstrategy:
Support anonymous (`raw') subdisks and plexes.
Change code to allow daemon to perform operations formerly kludged
into an interrupt context. Remove the DIRTYCONFIG kludge.
No longer set B_ORDERED for reviving subdisks. I suspect this
wouldn't work correctly, and it should be done in a different manner
in vinumrevive.c
sdio: set subdisk state correctly on error
start to remove code that doesn't make any sense any more.
Remove #ifdefs for FreeBSD 2.c
Change from lkm to kld
correct type of `flags' in calls to set_drive_state.
set_drive_parms: handle anonymous drives correctly (remove them)
drive VOP functions: use the PID of the original opener to fool the
lock manager.
open_drive: be quiet about failures (they're normal when scanning the
partitions).
close_drive: lock drive before closing.
remove_drive: lock drive before deallocating.
read_drive_label: set drive up when all is OK
check_drive:
Complete rewrite. Offload most of the code to the new
vinum_scandisk
format_config:
use snprintf and %qd options to make much less emetic.
Remove old supporting functions.
vinum_scandisk:
Moved here from vinum.c
Almost complete rewrite, incorporating much of what was check_drive.
We still don't have a general way to find the drives on a system, so
get the user to supply the names via the `read' command. For each
device, try each possible compatibility slice name (there's a danger
of finding both /dev/da1h and /dev/da0s1h otherwise). Sort the
partitions found in reverse order of last update time and read them
in, setting the `update' parameter to parse_config and descendents.
save_config: rename to daemon_save_config, since the function is now
called by the daemon. Create a new function save_config which queues
the request with the daemon.
daemon_save_config: some mods to allow for the unfamiliar
environment.
Change from lkm to kld
Remove BROKEN_GDB kludge (it's not needed with klds)
Add code for interfacing with daemon
Modify device minor number encoding, use selector functions which also
permit anonymous plexes and subdisks.
Remove code for 2.x support.
Change messages to omit obvious words like 'plex' and 'subdisk.
give_plex_to_volume: invalidate subdisks being given to a plex which
is part of a volume with other plexes.
give_sd_to_plex: keep track of plex size in all cases
lock drives before closing them, to keep the daemon from getting
confused.
config_drive: handle partition type errors more gracefully
config_subdisk: set subdisk state correctly
find_drive, find_drive_by_dev, find_subdisk, find_plex, find_volume:
set VF_NEWBORN flag when a new object is created
config_drive:
Handle partition_status returns more cleverly.
Replace the device name in some cases where it got overwritten.
config_subdisk:
add parameter `update'. If the object already exists, exit without
any changes.
Set state correctly.
config_plex, config_volume:
add parameter `update'. If the object already exists, exit without
any changes.
parse_config:
move read function to vinum_scandisk.
add parameter `update' to pass to config_<object>.
remove_<object>_entry:
print a message when the object is removed.
update_plex_config:
Start defusing this function, which will go away some time.
Remove calls to update_volume_config.
Make size 64 bits
Change from lkm to kld
Remove BROKEN_GDB kludge (it's not needed with klds)
Add code for interfacing with daemon
Modify manner of determining when module is idle
Modify device minor number encoding, use selector functions which also
permit anonymous plexes and subdisks.
Remove code for 2.x support.
Move vinum_scandisk to vinumio.c
Remove myproc kludge
Keep track of open volumes by flag, not by pid (the pids caused some
problems with the lock manager).
free_vinum:
Remove unmapped and defective regions from plexes.
Wait for daemon to stop before returning
vinumopen:
Don't refuse an open if the volume is already open.
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.