Commit Graph

410 Commits

Author SHA1 Message Date
Jeff Roberson
421e6a659e Remove unused include. 2002-03-20 09:55:07 +00:00
Kirk McKusick
0d2af52141 Introduce the new 64-bit size disk block, daddr64_t. Change
the bio and buffer structures to have daddr64_t bio_pblkno,
b_blkno, and b_lblkno fields which allows access to disks
larger than a Terabyte in size. This change also requires
that the VOP_BMAP vnode operation accept and return daddr64_t
blocks. This delta should not affect system operation in
any way. It merely sets up the necessary interfaces to allow
the development of disk drivers that work with these larger
disk block addresses. It also allows for the development of
UFS2 which will use 64-bit block addresses.
2002-03-15 18:49:47 +00:00
Poul-Henning Kamp
af91f4fa16 GC: BIO_ORDERED going away. 2002-02-22 09:18:46 +00:00
Greg Lehey
93bbd4c8da Grr. The last commit contained update conflicts. It just goes to
show that you should check the code even for a forced commit.

Spotted by:	dd
2002-01-29 02:49:15 +00:00
Greg Lehey
60fc37994f Forced commit. The previous commit log was garbled and didn't even
apply to this file.  The correct message is:

throw_rude_remark: Make sure we're holding the config lock before
                   proceeding.  There's no reason to assume that this
                   has ever happened, but the alternative might be a
                   double fault.
2002-01-29 02:14:51 +00:00
Greg Lehey
98912ee8cc vinumioctl: Fix a double fault caused by calling setjmp() without holding the config lock. The call was in fact superfluous. 2002-01-27 04:20:52 +00:00
Poul-Henning Kamp
90a13e1e9e Don't call cdevsw_{add,remove}(). 2001-11-04 11:55:19 +00:00
Greg Lehey
c253329a84 allocrqg: Don't ever try to write to a NULL pointer.
Reported by:	Jeff Roberson <jeff@midstream.com>
2001-11-03 02:39:15 +00:00
Greg Lehey
5de383bcbc attachobject: Return correct status after successfully attaching a
plex.

Indirectly found by:	Hendrik Scholz <hscholz@perikles.toppoint.de>
2001-10-13 07:22:12 +00:00
John Baldwin
7106ca0d1a Add missing includes of sys/lock.h. 2001-10-11 17:52:20 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Greg Lehey
27b286aa8c Remove an accidentally forgotten #ifdef. This could cause depletion
of mutexes if a lot of plexes are created and destroyed.
2001-09-04 06:30:05 +00:00
Greg Lehey
d505403792 open_device: Recognize ar device.
Submitted by:  Valery Kotchiev <valery@rudiment.dk>
2001-08-01 04:35:28 +00:00
Peter Wemm
e664fdb13c The kernel *does* now define setjmp/longjmp. Dont duplicate it here.
In file included from ../../../dev/vinum/vinumhdr.h:77,
                 from ../../../dev/vinum/vinum.c:44:
../../../dev/vinum/vinumext.h:165: warning: redundant redeclaration of `setjmp' in same scope
../../../sys/systm.h:96: warning: previous declaration of `setjmp'
../../../dev/vinum/vinummemory.c:44: warning: redundant redeclaration of `longjmp' in same scope
../../../sys/systm.h:97: warning: previous declaration of `longjmp'
2001-07-27 00:44:36 +00:00
Peter Wemm
953d6e00e9 Fix warnings:
vinumhdr.h:80: warning: redundant redeclaration of `vinum_cdevsw'
 vinumext.h:239: warning: previous declaration of `vinum_cdevsw'
in each of the following files:
 vinum.c, vinumconfig.c, vinumdaemon.c, vinuminterrupt.c, vinumio.c,
 vinumioctl.c, vinumlock.c, vinummemory.c, vinumraid5.c, vinumrequest.c,
 vinumrevive.c, vinumstate.c, vinumutil.c
2001-06-15 00:23:11 +00:00
Greg Lehey
7b4bf18baa Change #if VINUMDEBUG to #ifdef VINUMDEBUG. This is a flag, not a variable. 2001-05-23 23:24:05 +00:00
Greg Lehey
468f05c7f7 Move objflags from vinumvar.h to vinumobj.h in preparation for
requiring fewer header files for userland programs.

Remove the gross debug device/non-debug device hack used to recognize
whether the kernel module was in sync with the userland module.
2001-05-23 05:27:40 +00:00
Greg Lehey
dd3dced8c4 Move objflags from vinumvar.h to vinumobj.h in preparation for
requiring fewer header files for userland programs.
2001-05-23 05:27:15 +00:00
Greg Lehey
4ec8f62211 Move external declaration to vinumhdr.h. 2001-05-23 05:26:40 +00:00
Greg Lehey
bc55b89e25 Set flag VF_HASDEBUG in vinum_conf to indicate that the module was
compiled with debug support.  This can be used by userland programs to
recognize which ioctls the module supports.

As a result, remove the gross debug device/non-debug device hack used
to recognize whether the kernel module was in sync with the userland
module.

Replace explicit references to major/minor numbers of vinum
superdevice with the VINUM_SUPERDEV macro written for that purpose.
2001-05-23 05:25:45 +00:00
Greg Lehey
4b2ec3c529 New header file.
Missed by:	Szilveszter Adam <sziszi@petra.hos.u-szeged.hu>
		David Wolfskill <david@catwhisker.org>
Pointy hat to:	grog
2001-05-22 22:29:35 +00:00
Greg Lehey
74f5bf080b Remove Malloc definitions (now in vinumext.h) 2001-05-22 06:08:52 +00:00
Greg Lehey
c6ef641d24 Add a field 'version' to vinum_conf. This field is a constant which
gets incremented every time the kernel-userland interface changes.
This enables vinum(8) to check for the correct kernel version and to
produce a useful message if it doesn't match.

Requested by:	Too many to count.

Move the definitions of struct drive, sd, plex and volume to
vinumobj.h.

Add a new debug flag, DEBUG_LOCKREQS, which logs only lock requests.
2001-05-22 02:37:28 +00:00
Greg Lehey
2e387f1bd3 vinumstart: If a write request is for a RAID-[45] plex or a volume
with more than one plex, the data will be accessed
            multiple times.  During this time, userland code could
            potentially modify the buffer, thus causing data
            corruption.  In the case of a multi-plexed volume this
            might be cosmetic, but in the case of a RAID-[45] plex it
            can cause severe data corruption which only becomes
            evident after a drive failure.  Avoid this situation by
            making a copy of the data buffer before using it.

	    Note that this solution does not guarantee any particular
	    content of the buffer, just that it remains unchanged for
	    the duration of the request.

Suggested by:	alfred
2001-05-22 02:36:47 +00:00
Greg Lehey
5be7546b83 tokenize: Take third parameter specifying the maximum number of
parameters to return.  This code is used both in userland and in the
kernel.
2001-05-22 02:35:57 +00:00
Greg Lehey
24ad5cd24b Cosmetics: wrap long lines to be < 80 characters. 2001-05-22 02:35:19 +00:00
Greg Lehey
c4d4f4147d Add a new debug flag, DEBUG_LOCKREQS, which logs only lock requests.
Use this instead of DEBUG_LASTREQS to decide whether to log lock
requests.

MFS:

vinumlock: Catch a potential race condition where one process is
           waiting for a lock, and between the time it is woken and
           it retries the lock, another process gets it and places it
           in the first entry in the table.

           This problem has not been observed, but it's possible, and
           it's easy enough to fix.

Submitted by:   tegge

vinumunlock: Catch a real bug capable of hanging a system.  When
             releasing a lock, vinumunlock() called wakeup_one.  This
             caused wakeups to sometimes get lost.  After due
             consideration, we think that this is due to the fact that
             you can't guarantee that some other process is also
             waiting on the same address.  This makes wakeup_one a
             very dangerous function to use.
2001-05-22 02:34:30 +00:00
Greg Lehey
cf65a3dc63 Change ioctls to use the expurgated userland version of the Vinum
structures.
2001-05-22 02:33:32 +00:00
Greg Lehey
acac8659d7 format_config: Replace long format lines.
Requested by:  bde

Add retryerrors keyword.

vinum_scandisk: Print a different message if an inadvertent start
command did not find any additional drives.  The previous message "no
drives found" confused and worried many people.

MFS:

vinum_open: Recognize Mylex devices as storage devices.
2001-05-22 02:32:22 +00:00
Greg Lehey
ab15c118bf complete_rqe:
In case of error, check the VF_RETRYERRORS flag in the subdisk and
  don't take the subdisk down if it's set, just retry the I/O.

  Requested by:	peter

  If the buffer has been copied (XFR_COPYBUF), release the copied
  buffer when the I/O completes.

  Suggested by:	alfred
2001-05-22 02:31:08 +00:00
Greg Lehey
0e414969e0 Remove unnecessary declarations of userland functions.
Desired by:	   bde

This commit is the first of a general cleanup of the header files..
It won't be enough to make bde happy.

Move debug definitions from vinumhdr.h.
2001-05-22 02:30:44 +00:00
Greg Lehey
177bb9657f config_sd: Add code to recognize "retryerrors" keyword.
config_plex: Don't create the device until we're finished.

parse_config: check for corrupted configuration, thus avoiding a
potential panic.

remove_sd_entry: Restore structure.
2001-05-22 02:29:54 +00:00
Greg Lehey
7e18e4ffbc free_vinum: Change some explicit struct member references to the SD,
PLEX and VOL.
2001-05-22 02:29:15 +00:00
Greg Lehey
2c4a6d9016 Add xferinfo flag bit for copied buffers.
Create a new struct rangelockinfo.  In revision 1.21 of vinumlock.c,
the plex info was removed from struct rangelock, since it wasn't
needed there.  It *is* needed for trace information, however, so use
struct rangelockinfo for that.
2001-05-22 02:28:55 +00:00
Greg Lehey
1739a10826 New file containing definitions for separate views of objects for
userland and kernel.
2001-05-22 01:41:12 +00:00
Poul-Henning Kamp
f83880518b Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.
2001-03-26 12:41:29 +00:00
Alfred Perlstein
ea846c773d devfs convertion used VINUMRMINOR incorrectly (passing args in
backwards order)

Submitted by: Bernd Walter <ticso@mail.cicely.de>
2001-03-22 23:21:49 +00:00
Peter Wemm
e793f3a0e0 By convention, the moduledata is static unless there is a reason for it
to not be.
2001-03-13 05:55:43 +00:00
Alfred Perlstein
729d4f1db0 Fix vinum for both devfs and non-devfs systems.
userland tool:

  Use the vfs.devfs.generation sysctl to test for devfs presense
  (thanks phk!) when devfs is active it will not try to create the
  device nodes in /dev and therefore will not complain about the
  failure to do so.

  Revert the change in the #define for VINUM_DIR in the kernel
  header so that vinum can find its device nodes.

  Replace perror() with vinum_perror() to print file/line when
  DEVBUG is defined (not defined by default).

kernel:

  Don't use the #define names for the "superdev" creation since
  they will be prepended by "/dev/" (based on VINUM_DIR), instead
  use string constants.

  Create both debug and non-debug "superdev" nodes in the devfs.

Problem noticed and fix tested by: Martin Blapp <mblapp@fuchur.lan.attic.ch>
2001-02-20 22:07:36 +00:00
Alfred Perlstein
1a1f84bdd7 forced commit to note that the last delta also reordered some code in
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.
2001-02-20 12:14:01 +00:00
Alfred Perlstein
d9ca06d2a3 Take a shot at making vinum devfs aware.
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.
2001-02-20 11:37:04 +00:00
Bosko Milekic
9ed346bab0 Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)
2001-02-09 06:11:45 +00:00
Greg Lehey
2a1735da45 Allocate lock table and mutex not only for parity plexes, but also for
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>
2001-02-02 07:14:13 +00:00
John Baldwin
e7d904a13a - Proc locking around the vinumdaemon dinking with its flags.
- P_INMEM -> PS_INMEM.
2001-01-24 10:28:19 +00:00
Jake Burkholder
a448b62ac9 Make intr_nesting_level per-process, rather than per-cpu. Setup
interrupt threads to run with it always >= 1, so that malloc can
detect M_WAITOK from "interrupt" context.  This is also necessary
in order to context switch from sched_ithd() directly.

Reviewed By:	peter
2001-01-21 19:25:07 +00:00
Greg Lehey
9cd8b5cf0d Correct check for partition c. Previously the check was for drive 2,
which did not exactly have the desired result.

Submitted by:	Akira Watanabe <akira@myaw.ei.meisei-u.ac.jp>
2001-01-20 03:46:19 +00:00
Greg Lehey
940b9a4808 struct rangelock: Remove the field 'plex' from the entry. Range locks
are accessed only via the plex, so there's never any confusion as to
the plex number.  This value was, as a result, unused.
2001-01-14 06:34:57 +00:00
Greg Lehey
96f2d202a1 format_config: If a subdisk loses its drive (due to a bug which has
not yet been caught), don't save the config with a null drive
   	name (which causes the drive to be renamed "plex" on the next
   	start), put in the text "*invalid*" instead.

	This is damage control, not a fix.

Experienced by:	peter

Break some long format strings so that they fit in style(9)-sized
lines.

Remove some "outdentation".
2001-01-14 06:33:10 +00:00
Greg Lehey
a08d6f1a2c config_plex: Check that we have specified a plex organization.
Tripped over by:	"Jeroen C. van Gelderen" <jeroen@vangelderen.org>
2001-01-14 06:29:56 +00:00
Greg Lehey
891b3d045f Reinstate 1.19.
Prodded by: iedowse
2001-01-10 21:42:06 +00:00