Commit Graph

53 Commits

Author SHA1 Message Date
Greg Lehey
e8b3affb8e build_write_request: correct logic for handling writes to volumes with
failed plexes.

allocrqg: Remove dead code
1999-02-11 06:44:12 +00:00
Greg Lehey
8093cf90f1 check_drive: Make sure that we don't open two different drives with
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>
1999-02-11 06:43:15 +00:00
Greg Lehey
cc902735df In some cases, it's possible that I/O errors will cause the daemon to
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.
1999-02-11 06:42:39 +00:00
Greg Lehey
3f8d2678bc Remove some dead debug code
build_write_request: get the check for failure right
1999-02-05 05:09:22 +00:00
Greg Lehey
7f1050341c Change multiline comments to start with a lone /* and end with a */,
apparently in accordance with style(9).

Complained-about-by: bde
1999-01-29 01:17:54 +00:00
Greg Lehey
6fe15bff6e Change multiline comments to start with a lone /* and end with a */,
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
1999-01-29 01:16:18 +00:00
Greg Lehey
bb1d6cfa3c build_write_request: only fail if all plexes are down, instead of if
any of them are down.

Reported-by: dg
1999-01-28 07:00:55 +00:00
Greg Lehey
a1c1b26d88 Fix some format breakage before bde finds out
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.
1999-01-28 06:59:27 +00:00
Matthew Dillon
b4e36adf1c Fix warnings preparing for -Wall -Wcast-qual
Also disable one usb module in LINT due to fatal compilation errors,
    temporary.
1999-01-27 20:09:21 +00:00
Greg Lehey
ac4cd383ca Correct #include in vinumioctl.c to compile correctly
without VINUMDEBUG

Submitted-by: peter
1999-01-24 05:14:39 +00:00
Peter Wemm
e5ca2df920 Minor tweak to fix 'pseudo-device vinum'. One of these got lost before,
the other is a new file.
1999-01-23 01:29:05 +00:00
Peter Wemm
013b59f2cb Remove stray Makefile that Greg initially imported. 1999-01-23 00:09:07 +00:00
Greg Lehey
33953e5e97 Include Peter Wemm's renaming and restructuring
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)
1999-01-21 00:41:58 +00:00
Greg Lehey
5d6f3129b1 Retain some of the RAID5 texts even in the non-RAID5 versions.
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.
1999-01-21 00:41:31 +00:00
Greg Lehey
8a2cba6003 Remove states:
plex_reviving (now we revive subdisks)
  drive_coming_up (never happened)

Add state sd_reviving.
1999-01-21 00:40:50 +00:00
Greg Lehey
6d930639c3 Include Peter Wemm's renaming and restructuring
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.
1999-01-21 00:40:32 +00:00
Greg Lehey
2178c45997 Change the style of revive: revive subdisks instead of plexes. This
makes it easier to keep track of which parts of a plex need reviving.

Use sdio, not vinumstrategy, to write to the subdisk.
1999-01-21 00:40:03 +00:00
Greg Lehey
7d077233f8 Include Peter Wemm's renaming and restructuring
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.
1999-01-21 00:39:36 +00:00
Greg Lehey
09c265ba75 Add keywords help, makedev, quit and setdaemon 1999-01-21 00:39:01 +00:00
Greg Lehey
cb4547a333 MMalloc: remove directory part of name correctly 1999-01-21 00:37:56 +00:00
Greg Lehey
ba40e00009 Create functions lockdrive and unlockdrive to handle drive locking 1999-01-21 00:37:38 +00:00
Greg Lehey
216e9f2046 Add keywords makedev, setdaemon and help. 1999-01-21 00:37:18 +00:00
Greg Lehey
2f4e1ffa11 Remove ioctls VINUM_GETUNMAPPED and VINUM_GETDEFECTIVE (we no longer
have regions).

Add definitions for VINUM_DAEMON, VINUM_FINDDAEMON and VINUM_DAEMON
1999-01-21 00:36:21 +00:00
Greg Lehey
c3dff4f036 Include Peter Wemm's renaming and restructuring
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.
1999-01-21 00:35:35 +00:00
Greg Lehey
a01fbbe4ac Include Peter Wemm's renaming and restructuring
Change from lkm to kld

Recover from I/O errors by passing the request to the daemon, except
for plex I/O, which is not fault tolerant.
1999-01-21 00:34:14 +00:00
Greg Lehey
3a85d3f98a Remove old cruft 1999-01-21 00:33:47 +00:00
Greg Lehey
76714993c6 Include Peter Wemm's renaming and restructuring
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
1999-01-21 00:32:54 +00:00
Greg Lehey
2ef3e3ddbc Include Peter Wemm's renaming and restructuring
Change from lkm to kld
1999-01-21 00:31:59 +00:00
Greg Lehey
eb1cd79843 Code for vinum daemon. 1999-01-21 00:31:31 +00:00
Greg Lehey
fc4e325173 Include Peter Wemm's renaming and restructuring
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.
1999-01-21 00:30:52 +00:00
Greg Lehey
efd86c9a8c Reflect changes in vinumstate.h 1999-01-21 00:30:24 +00:00
Greg Lehey
7230cf7d2a Include Peter Wemm's renaming and restructuring
Change from lkm to kld

Add structures for daemon

Remove old cruft

Increase RQINFO_SIZE to 128
1999-01-21 00:29:44 +00:00
Greg Lehey
e743f211c1 Include the copyright notice in the script, making the file COPYRIGHT
unnecessary.
1999-01-21 00:29:20 +00:00
Greg Lehey
acf3160e71 Fix an overflow problem which prevented revive from working on plexes
of more than 4 GB.

Reported by: dg
1999-01-06 23:11:29 +00:00
Peter Wemm
c285ca1254 Some relatively minor tweaks to enable vinum to be built into a static
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..
1998-12-28 16:28:24 +00:00
Peter Wemm
ef2dbe9885 If I've done this right, revive the vinum code in it's now home after it
was savaged in the blood bath a few hours ago.
1998-12-28 04:56:24 +00:00
Søren Schmidt
c74cd3590f Remove LKM's depricated by modules. 1998-12-27 19:38:15 +00:00
Peter Wemm
5ebfc07dce Remove machine/cputypes.h - it's an i386 only thing 1998-11-06 01:34:06 +00:00
Greg Lehey
0b492c2b06 Remove some dead code and comments 1998-11-03 06:38:58 +00:00
Greg Lehey
44043daefc Print a warning if we removed a junked drive
Take a drive down if it's not open
1998-11-03 06:38:26 +00:00
Greg Lehey
8ef3d686c9 Take drive down if the disk driver tells us it's not there 1998-11-03 06:37:57 +00:00
Greg Lehey
62ae0ffa95 Check for duplicate subdisk names 1998-11-03 06:37:14 +00:00
Greg Lehey
c51cd25e95 Change some numeric #defines to enums 1998-11-02 04:11:16 +00:00
Greg Lehey
8b71433847 Don't close drives when called from interrupt context, set a flag for
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.
1998-11-02 04:10:45 +00:00
Greg Lehey
d45fbfc7a1 Get the default revive blocksize right for striped and RAID-5 plexes 1998-11-02 04:10:19 +00:00
Greg Lehey
47ffaa06f1 Close any drives downed in an interrupt context.
Ensure correct order of requests.
Call launch_requests at splhigh to see if this stops the mysterious
SMP panics
1998-11-02 04:09:34 +00:00
Greg Lehey
f9fd1687b6 Accept incorrect device open counts, but print a warning
Don't save invalid drive config information, remove the drive
1998-11-02 04:09:09 +00:00
Greg Lehey
6e1f0e2f5e Check for maximum number of subdisks in a plex
Get object counts right when removing
1998-11-02 04:08:30 +00:00
Peter Wemm
a4bc95cff9 Move the kld stuff to here. 1998-10-23 11:49:47 +00:00
Greg Lehey
721fbc5ae0 config.c:
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.
1998-10-21 08:32:32 +00:00