Commit Graph

748 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
916a3aa05b Free only if pointer isn't NULL. 2004-07-01 12:42:13 +00:00
Poul-Henning Kamp
11e9a67906 Fix regression in last commit. 2004-06-29 08:33:58 +00:00
Poul-Henning Kamp
52c583feb9 Make sure to kill the devstat entry for disappearing disks.
PR:	68074
Submitted by:	Hendrik Scholz <hscholz@raisdorf.net>
2004-06-27 20:53:20 +00:00
Pawel Jakub Dawidek
55336b83e0 Introduce a hack that will make geom_gate to work with read-only mounts.
Now, when trying to mount file system in read-only mode it tries to
opened a device for writting to be able to update to read-write mode
latter. Ehh.

Discussed with:	phk
2004-06-27 12:56:11 +00:00
Robert Watson
5706472c3a The g_up and g_down threads use a local 'mymutex' mutex to allow WITNESS
to warn about attempts to sleep in the I/O path.  This change pushes the
definition and use of 'mymutex' behind #ifdef WITNESS to avoid the cost
in non-debugging cases.  This results in a clear .22% performance win for
512 byte and 1k I/O tests on my SMP test box.  Not much, but every bit
counts.
2004-06-26 23:27:42 +00:00
Lukas Ertl
865897c9f1 Mark a plex as 'newborn' when it is created. This is used to indicate
that new RAID5 plexes need to be initialized first.
2004-06-25 18:04:33 +00:00
Pawel Jakub Dawidek
40f798dad1 Don't force class to give a valid softc to g_slice_new(), it is not always
needed.

Approved by:	phk
2004-06-24 10:50:20 +00:00
Christian S.J. Peron
d7af790b0d Currently, if the drives specified for volume creation are
not active GEOM providers, it will result in a kernel panic.

If the GEOM provider or disk goes away before the volume
configuration data gets written to the disk, it will result
in another kernel panic.

o Make sure that the drives specified for volume creation
  are active GEOM providers.

o When writing out volume configuration data to associated drives,
  make sure that the GEOM provider is active, otherwise continue
  to the next drive in the volume.

Approved by:	le, bmilekic (mentor)
2004-06-24 02:40:34 +00:00
Lukas Ertl
3a1e11b485 Add a function to clean up RAID5 packets and use it when I/O has
finished or when building the complete packet fails.
2004-06-23 23:52:55 +00:00
Lukas Ertl
c3dba6d0e0 Remove two debugging printfs that are currently rather disturbing
than helpful.
2004-06-23 22:32:01 +00:00
Lukas Ertl
b950fbe67b Accept "sd len 0" and auto-size the subdisk correctly.
Spotted by: csjp
2004-06-23 21:15:55 +00:00
Lukas Ertl
1b699be2e1 No need to free the softc, because it wasn't allocated. 2004-06-22 18:13:43 +00:00
Lukas Ertl
291cb0ac69 Don't sleep in the g_down path. More error checks to come. 2004-06-22 14:54:31 +00:00
Poul-Henning Kamp
71c911b18c Kill g_access_rel() already now before we send it down 5-stable 2004-06-21 20:31:49 +00:00
Pawel Jakub Dawidek
47f44cb708 Don't hold topology lock while calling g_gate_release().
Found by:	KASSERT()
2004-06-21 09:12:08 +00:00
Poul-Henning Kamp
fc6c63b477 Duplicate the securelevel check from spec_vnops.c here. 2004-06-19 09:00:53 +00:00
Lukas Ertl
7f72de2d55 Clean up allocated ressources when destroying the main vinum geom. 2004-06-18 19:53:33 +00:00
Poul-Henning Kamp
b90c855961 Reduce the thaumaturgical level of root filesystem mounts: Instead of using
an otherwise redundant clone routine in geom_disk.c, mount a temporary
DEVFS and do a proper lookup.

Submitted by:	thomas
2004-06-17 21:24:13 +00:00
Poul-Henning Kamp
f3732fd15b Second half of the dev_t cleanup.
The big lines are:
	NODEV -> NULL
	NOUDEV -> NODEV
	udev_t -> dev_t
	udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.
2004-06-17 17:16:53 +00:00
Lukas Ertl
99b536d888 Handle dead disks in a somewhat sane way. 2004-06-16 14:41:04 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Lukas Ertl
da8f1aa53d Fix several bugs related to subdisk drive_offset calculation. 2004-06-15 20:56:25 +00:00
Lukas Ertl
a6facf72b1 Don't free a VINUMDRIVE softc when it's orphaned or spoiled. All
allocated ressouces should be ultimately freed in gv_destroy_geom()
(when unloading the module and not earlier), but I need to look at this
more closely.
2004-06-14 17:12:32 +00:00
Lukas Ertl
1a9e260fd4 Correctly calculate subdisk offset in RAID5 plexes. 2004-06-14 17:06:55 +00:00
Lukas Ertl
73679edcc7 Add a first version of a GEOMified vinum. 2004-06-12 21:16:10 +00:00
Poul-Henning Kamp
cf4572847a Make the sysctl kern.geom.collectstats more granular.
Bit 0 controls statistics collection on GEOM providers.
Bit 1 controls statistics collection on GEOM consumers.

Default value is 1.

Prodded by:	scottl
2004-06-09 19:44:44 +00:00
Pawel Jakub Dawidek
d462f0a1ac Fix format string. 2004-06-07 13:40:40 +00:00
Pawel Jakub Dawidek
0e11f0a93b Don't allow for duplicated entries creation. 2004-06-07 13:33:09 +00:00
Joerg Wunsch
c7cfc3b129 Add SVR4-compatible VTOC-style elements to the Sun label. The
FreeBSD kernel doesn't use them but sunlabel(8) shortly will,
and both these files are used by sunlabel(8).
2004-06-01 20:18:25 +00:00
Poul-Henning Kamp
887ae9a1d2 Zap a redundant NULL 2004-05-30 18:04:06 +00:00
Pawel Jakub Dawidek
3fb17452b0 Dump some more informations:
- device state
	- list of used providers
	- total number of disks
	- number of disks online

Prodded by:	Alex Deiter <tiamat@komi.mts.ru>
2004-05-26 11:36:27 +00:00
Pawel Jakub Dawidek
02692c510d - Change command name from 'config' to 'configure'.
- Bump version number.
2004-05-21 15:23:48 +00:00
Pawel Jakub Dawidek
02637cdcb1 - Teach CONCAT class how to talk with geom(8).
- Remove provider if any disk was lost.
- Dump CONCAT version.

Supported by:	Wheel - Open Technologies - http://www.wheel.pl
2004-05-20 10:40:18 +00:00
Pawel Jakub Dawidek
b09121f9e1 Introduce STRIPE GEOM class. It implements RAID0 transformation and it
is intend to be fast. Just like CONCAT class it provides manual and
auto configuration methods.

Supported by:	Wheel - Open Technologies - http://www.wheel.pl
2004-05-20 10:20:49 +00:00
Pawel Jakub Dawidek
89aaffec5c Introduce NOP GEOM class. This is totally transparent GEOM class, but
it is very useful for tests. One is able to destroy its provider
forcibly if wants to test how other class handle such events.
One is also able to specify failure probability to check how other
classes handle I/O errors.

Supported by:	Wheel - Open Technologies - http://www.wheel.pl
2004-05-20 10:15:53 +00:00
Søren Schmidt
bbf15239ed Dont try to finish devstat's if the disk pointer is NULL, this can happen
when a disk has been destroyed but still has outstanding bio's.

Reviewed by:	phk
2004-05-11 13:17:40 +00:00
Pawel Jakub Dawidek
053271038e Close some small wakeup<->msleep races. 2004-05-05 12:30:41 +00:00
Pawel Jakub Dawidek
c2496c87c1 Fix compilation on 64-bit architectures.
Noticed by:	Tinderbox
2004-05-04 07:45:39 +00:00
Pawel Jakub Dawidek
b62093b274 Turn off debugging by default. 2004-05-03 21:11:54 +00:00
Pawel Jakub Dawidek
37c9eaae29 Prefer signed type over unsigned to be able to assert negative
reference count.
2004-05-03 21:02:02 +00:00
Pawel Jakub Dawidek
4d1e1bf3f5 - Hold g_gate_list_mtx lock while generating/checking unit number.
Found by:	mtx_assert() g_gate.c:273
- Set command before returning to userland with ENOMEM error value.
	Found by:	assert() ggatel.c:108
2004-05-03 18:06:24 +00:00
Pawel Jakub Dawidek
0d785336d1 Make it compile on 64-bit architectures.
The biggest issue was that 16-bit atomic operations aren't supported
on all architectures.
2004-05-02 17:57:49 +00:00
Pawel Jakub Dawidek
fe27e77251 Kernel bits of GEOM Gate. 2004-04-30 16:08:12 +00:00
Marcel Moolenaar
1b19d4ae61 Allow disks with a GPT to be used on big-endian machines. The GPT is
little-endian by definition and needs byte-swap operations for any
multi-byte field. While here fix indentation.
2004-04-30 05:05:39 +00:00
Pawel Jakub Dawidek
f1f163e9cb - Don't check if 'gp' is non-NULL, it always is and GEOM wants to
dump geom configuration when 'pp' and 'cp' are NULL.
- Use tabs instead of spaces.
2004-04-20 17:07:55 +00:00
Pawel Jakub Dawidek
46aeebec57 Calculate bio_completed properly or die!
Approved by:	phk
2004-04-04 20:37:28 +00:00
Peter Grehan
ae33b79b67 Move the name attribute to the end of the conftxt line to simplify
libdisk parsing (the name may be empty, or contain spaces).

Submitted by:  Suleiman Souhlal <refugee@segfaulted.com>
2004-04-01 01:33:37 +00:00
Pawel Jakub Dawidek
950124e354 Move "is consumer attached?" check before G_VALID_PROVIDER() check,
because if consumer is not attached, its provider never will be valid,
so we never reach this check.

Approved by:	phk
2004-03-18 07:17:10 +00:00
Poul-Henning Kamp
e26bafdc25 Be more insistent on destroying geoms at unload time. Still not perfect,
but it will do (better) for now.

KASSERT that to have providers a class must have an access method.

Tag the new_provider event with the geom as well.
2004-03-11 08:16:23 +00:00
Poul-Henning Kamp
3d1d5bc3c3 Rearrange some of the GEOM debugging tools to be more structured.
Retire g_sanity() and corresponding debugflag (0x8)

  Retire g_{stall,release}_events().

  Under #ifdef DIAGNOSTIC:

    Make g_valid_obj() an official function and have it return an an
    non-zero integer which indicates the kind of object when found.

    Implement G_VALID_{CLASS,GEOM,CONSUMER,PROVIDER}() macros based
    on g_valid_obj().

    Sprinkle calls to these macros liberally over the infrastructure.

    Always check that we do not free a live object.
2004-03-10 08:49:08 +00:00
Pawel Jakub Dawidek
48fbd94b4e - Don't take sectorsize from first disk. Calculate it by finding
least common multiple of all disks sector sizes.
  This will allow to safely concatenate disks with different sector sizes.
- Mark unused function arguments.
- Other minor cleanups.
2004-03-09 11:18:53 +00:00
Pawel Jakub Dawidek
810914da53 Print a space character between string given as a macro argument and
bio description.
2004-03-09 11:00:24 +00:00
Poul-Henning Kamp
b07ef6c2db Don't panic on providers already withered when we wither a geom. 2004-03-07 17:33:15 +00:00
John Baldwin
6074439965 kthread_exit() no longer requires Giant, so don't force callers to acquire
Giant just to call kthread_exit().

Requested by:	many
2004-03-05 22:42:17 +00:00
Pawel Jakub Dawidek
32d7144dbc Correct year in copyrights. 2004-03-04 10:22:42 +00:00
Pawel Jakub Dawidek
a88ae49f98 - Remove d_valid field, we can use d_consumer field to check if disk
is valid.
- Use SYSCTL_DECL() instead of using own, ugly extern.
2004-03-03 22:29:24 +00:00
Pawel Jakub Dawidek
db33b1c4d0 Removed unused fields. 2004-03-01 17:33:11 +00:00
Pawel Jakub Dawidek
03816084de We don't need d_length field. 2004-03-01 17:32:48 +00:00
Pawel Jakub Dawidek
0e2ff2832c Even if we're sure that we can't be orphaned here, we have to define
orphan field - we're enforcing it in GEOM. This will reach KASSERT
in INVARIANTS case.

Add missing space.

Approved by:	scottl (mentor)
2004-02-27 15:34:21 +00:00
Pawel Jakub Dawidek
0787ce83b2 Remove unused field.
Approved by:	scottl (mentor)
2004-02-27 15:32:49 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Pawel Jakub Dawidek
19d16e2fee Introduce CONCAT GEOM class for disk concatenation.
It allows manual and automatic (based on on-disk metadata) concatenation.

Reviewed by:	phk, scottl
Approved by:	scottl (mentor)
2004-02-19 15:19:49 +00:00
Poul-Henning Kamp
0b7ed341e1 Change the disk(9) API in order to make device removal more robust.
Previously the "struct disk" were owned by the device driver and this
gave us problems when the device disappared and the users of that device
were not immediately disappearing.

Now the struct disk is allocate with a new call, disk_alloc() and owned
by geom_disk and just abandonned by the device driver when disk_create()
is called.

Unfortunately, this results in a ton of "s/\./->/" changes to device
drivers.

Since I'm doing the sweep anyway, a couple of other API improvements
have been carried out at the same time:

The Giant awareness flag has been flipped from DISKFLAG_NOGIANT to
DISKFLAG_NEEDSGIANT

A version number have been added to disk_create() so that we can detect,
report and ignore binary drivers with old ABI in the future.

Manual page update to follow shortly.
2004-02-18 21:36:53 +00:00
Poul-Henning Kamp
281591449a Do not check error code from closing ->access() calls, we know they succeed. 2004-02-14 17:59:44 +00:00
Poul-Henning Kamp
bfc37a5112 Add a KASSERT which checks that a class never fails a closing ->access()
call.
2004-02-14 17:58:57 +00:00
Poul-Henning Kamp
d2bae332d6 Remove the absolute count g_access_abs() function since experience has
shown that it is not useful.

Rename the relative count g_access_rel() function to g_access(), only
the name has changed.

Change all g_access_rel() calls in our CVS tree to call g_access() instead.

Add an #ifndef BURN_BRIDGES #define of g_access_rel() for source
code compatibility.
2004-02-12 22:42:11 +00:00
Poul-Henning Kamp
f865123ec4 Give both consumers and providers a {void *private, u_int index} which
the implementing class can use to hang internal info from.
2004-02-12 20:32:11 +00:00
Pawel Jakub Dawidek
72e330954e Added g_print_bio() function to print informations about given bio.
Approved by:	phk, scottl (mentor)
2004-02-11 18:21:32 +00:00
Pawel Jakub Dawidek
18e88d825c Now we have g_topology_assert_not(), so use it to detect deadlocks.
Approved by:	phk, scottl (mentor)
2004-02-10 15:55:17 +00:00
Pawel Jakub Dawidek
692498b0cd Added macro which will be used to assert, that the topology lock is not held.
Approved by:	phk, scottl (mentor)
2004-02-10 15:53:28 +00:00
Poul-Henning Kamp
99cf2f941c don't call sbuf_clear() right after sbuf_new(), it is not necessary. 2004-02-10 10:54:19 +00:00
Poul-Henning Kamp
df3df337b8 Polish the work/state engine in preparation for HW-crypto support. 2004-02-08 10:19:18 +00:00
Poul-Henning Kamp
d091e630f1 Add a missing error case return.
Problem reported by:	Flemming Jacobsen <fj@batmule.dk>
2004-02-08 09:39:02 +00:00
Poul-Henning Kamp
3aa5a3ad90 We don't need to hold Giant to create the worker kthread. 2004-02-07 23:01:17 +00:00
Pawel Jakub Dawidek
12047230cd Allow decreasing access count even if there is no disk anymore.
This will allow closing disks that were removed while opened.

Approved by:	phk, scottl (mentor)
2004-02-06 23:10:49 +00:00
Lukas Ertl
5b2f81ec4b Fix memory leak.
PR:            kern/58634
Submitted by:  le
Approved by:   phk
2004-02-06 22:51:04 +00:00
Poul-Henning Kamp
0ed4f6a180 Allow a GEOM class to unload if it has no geoms or a method function to
get rid of them.

Prodded by:	pjd
2004-02-02 19:49:41 +00:00
Pawel Jakub Dawidek
cff2ddaeb2 - Use proper names in KASSERTs.
- Typos.

Approved by:	phk, scottl (mentor)
2004-02-02 17:50:09 +00:00
Poul-Henning Kamp
abc2e0fd56 Check error return from g_clone_bio(). (netchild@)
Rearrange code to avoid duplication (phk@)

Submitted by:	netchild@
2004-02-02 13:36:06 +00:00
Poul-Henning Kamp
793ffa8e55 Don't mingle malloc/g_event flags.
Spotted by:	pjd@
2004-02-02 10:58:07 +00:00
Poul-Henning Kamp
5fcf4e4398 Bring back the geom_bioqueues, they _are_ a good idea.
ATA will uses these RSN.
2004-01-28 08:39:18 +00:00
Poul-Henning Kamp
57ab2e0468 Make sure to keep track of canceled events.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 21:09:38 +00:00
Poul-Henning Kamp
799426f877 Add KASSERTS.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 21:02:49 +00:00
Poul-Henning Kamp
f5b3481451 Plug an insignificant memoryleak.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 20:40:25 +00:00
Poul-Henning Kamp
752e0f0196 Add missing newline in printf.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-23 20:36:21 +00:00
Poul-Henning Kamp
bbf53bc053 Remove the MD5_KEY debugging tool 2004-01-23 11:47:06 +00:00
Poul-Henning Kamp
8cae62eee9 Remove no longer necessary debug printfs 2004-01-23 10:56:16 +00:00
Poul-Henning Kamp
cbb650409c Print the correct pointer in a KASSERT.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-11 10:02:42 +00:00
Poul-Henning Kamp
cfa35456ca KASSERT against no-op access requests.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2004-01-09 16:10:32 +00:00
Poul-Henning Kamp
8592d7a760 Prevent withering of the provider we're orphaning from happening until
we do it ourselves.

Nailed by:	Simon Heath <heath@cng.fr>
2003-12-23 11:37:05 +00:00
Don Lewis
2cf0d8a6ef Correct usage of mtx_init() API. This is not a functional change since
the code happened to work because MTX_DEF and NULL are both defined as 0.

Reviewed by:	phk
2003-12-07 23:20:53 +00:00
Poul-Henning Kamp
d0265773dc KASSERT against multiple orphanings of providers. 2003-12-07 10:04:43 +00:00
Scott Long
774114995e Re-arrange and consolidate some random debugging stuff 2003-12-07 05:04:49 +00:00
Poul-Henning Kamp
0ecc7670a9 Call class->init() an class->fini() while the class is hooked up,
rather than right before and right after.  This allows these routines
to manipulate the mesh.

KASSERT that nobody creates a geom on an alien class.

Assert topology in g_valid_obj().

Approved by:	re@
2003-11-18 18:17:39 +00:00
Poul-Henning Kamp
e0d617c1f7 Fix a harmless bug and add a ')' in a debugging printf.
Submitted by: "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
2003-11-18 07:54:12 +00:00
Poul-Henning Kamp
b3ecca4d0a This is a crude bandaid for 5.2 to protect against providers which disappear
while being tasted.  I can moderately easy trigger this with atapi-cd, but
I do not fully understand the circumstances.
2003-11-15 18:44:43 +00:00
Poul-Henning Kamp
c12ec49eda Make sure to return errors if we have any.
Submitted by:    Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2003-11-12 09:46:54 +00:00
Poul-Henning Kamp
7b3c545769 Close the right consumers if we run into trouble opening them all.
Submitted by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2003-10-24 18:47:31 +00:00
Poul-Henning Kamp
87ac8d11c2 Fix two old/new consumer confusions.
Submitted by:    Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2003-10-24 18:46:23 +00:00
Poul-Henning Kamp
d55b513f6e Fix a braino memory leak.
Found by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2003-10-22 20:28:46 +00:00