remove_sd_entry() to:
Simplify (hopefully) it by moving all error returns closer to
the beginning of the function.
Return an error when "Error removing subdisk %s: not found in
plex %s\n" would have been reported, as I doubt that we are "OK"
after printing that error message.
Adding make_dev() and destroy_dev() calls in (hopefully) the right
places.
This is done by calling make_dev() in each object constructor and
caching the dev_t's returned from make_dev() in each struct
'subdisk'(sd), 'plex' and 'volume' such that the 'object'_free()
functioncs can call destroy dev.
This change makes a subset of the old /dev/vinum appear under devfs.
Enough nodes appear such that I'm able to mount my striped volume.
There may be more work needed to get vinum configuration working
properly.
striped plexes. This prevents various panics introduced in the last
rewrite of the locking code.
Suffered by: "Niels Chr. Bank-Pedersen" <ncbp@bank-pedersen.dk>
to RAID-5. peter claims that it might be faster for sequential
reading, since the drive caches don't trip over the parity blocks. I
have seen no evidence to support this, but it's a trivial change.
Requested-by: peter
Change checks for striped or RAID-5 plexes to a macro 'isstriped',
which now also includes RAID-4.
Change checks for RAID-5 plexes to a macro 'isparity', which now also
includes RAID-4.
atoi(): Remove, nobody was talking to it.
give_sd_to_drive: If no space is available, make the subdisk down,
don't delete it.
Change the manner in which the subdisk count was maintained to avoid
cases where the count was not adjusted correctly.
config_drive: Check if we have subdisks referencing us, and add them
if so. This fixes problems which arose when a drive is replaced in a
running system.
config_sd: Add support for a keyword 'partition', whose meaning will
be revealed in the fullness of time.
Cosmetic: Shorten some console messages.
Approved-by: jkh
on alpha.
Submitted-by: Bernd Walter <ticso@cicely.de>
Get parameters right for some error messages returned via
throw_rude_remark().
Fix typo in comment.
Remove the 'static' attribute from give_sd_to_drive. This is needed
for the implementation of moveobject() in vinumioctl.c.
get_empty_volume: initialize plexes to -1 (not allocated)
remove_drive_entry:
Remove recurse parameter (there's nothing below a drive in the hierarchy).
Use remove_sd_entry to remove sds, don't do it ourselves.
Log errors, don't throw rude remarks.
remove_plex_entry:
Don't use plex->subdisks as a loop limit, it gets changed in the
loop. This caused some removals to only remove half the subdisks.
Change logging of some "impossible" situations.
remove_volume_entry:
Use remove_plex_entry to remove plexes, don't do it ourselves.
update_sd_config:
Use set_sd_state to do the work.
lockrange: correctly expand rangelock struct, including expanding a
null struct. Previously lockrange would attempt to lock a
NULL pointer under these circumstances.
Reported-by: Ian Freislich <iang@uunet.co.za>
checkdiskconfig(): remove. It didn't make any sense to complain about
kernel keywords in user config files; it just made it more difficult
to convert. Now we ignore kernel keywords if we're not in kernel
mode.
get_empty_sd: initialize sectors.
free_drive: don't close if we don't have a vp. Maybe this will help
fix the problem that peter had, but I wouldn't count on it.
config_plex: If the plex is RAID-5, give it a rangelock structure.
start_config: Reset current drive, plex and volume so that a new
'create' command doesn't get long-dead defaults.
is probably gone, but the debug checks remain for a while.
update_plex_config: Catch yet another divide-by-zero problem when
detaching the last subdisk from a striped plex.
Uncovered-by: Michael Reifenberger <root@nihil.plaut.de>
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.
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.
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.
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.
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.
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
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..
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.