Commit Graph

921 Commits

Author SHA1 Message Date
Lukas Ertl
d8a720f9ec Save the vinum config back to disk after syncing two plexes. 2004-07-26 07:30:21 +00:00
Lukas Ertl
3242376072 There's a chance that the VINUMDRIVE class tastes before the
VINUM class, so let the VINUMDRIVE class parse the on-disk
configuration, too.
2004-07-25 23:01:09 +00:00
Lukas Ertl
5289667c16 Check for a NULL pointer before dereferencing it. 2004-07-25 09:41:31 +00:00
Lukas Ertl
c291a77678 Use a temporary geom when tasting vinumdrives and lock the 'real'
vinumdrive geom with an exclusive bit.  This should fix the problem
when underlying partitions overlap (i.e. the 'a' partition is at
the same offset as the 'c' partition).

Ideas borrowed from pjd@, quite a bit of testing by
Matthias Schuendehuette <msch@snafu.de>.
2004-07-24 22:26:40 +00:00
Lukas Ertl
6db345b90e Disable kldunloading of geom_vinum temporarily until I figured out
how to do it correctly.
2004-07-24 19:04:24 +00:00
Pawel Jakub Dawidek
e370e911b2 MFp4: Add two options for gnop(8)'s 'create' command:
-o offset - specifies where to start on the original provider
	-s size - specifies size of the transparent provider
2004-07-19 07:52:56 +00:00
Pawel Jakub Dawidek
726cb09fbc Fix copy&paste bug. 2004-07-18 16:51:58 +00:00
Pawel Jakub Dawidek
be7695cf65 Fix exclusive-bit leakage. 2004-07-18 06:54:29 +00:00
Poul-Henning Kamp
3e019deaed Do a pass over all modules in the kernel and make them return EOPNOTSUPP
for unknown events.

A number of modules return EINVAL in this instance, and I have left
those alone for now and instead taught MOD_QUIESCE to accept this
as "didn't do anything".
2004-07-15 08:26:07 +00:00
Pawel Jakub Dawidek
f3b3b0ce27 Remove unused macro. 2004-07-13 12:01:29 +00:00
Pawel Jakub Dawidek
45c26487a7 Decrease log level of one debug message, so there is no hole (level 2
wasn't used at all).
2004-07-13 12:01:11 +00:00
Pawel Jakub Dawidek
71df072547 Minor sysctl description fixes.
Submitted by:	simon
2004-07-13 11:23:31 +00:00
Pawel Jakub Dawidek
4c55f05b89 Implement "FAST" mode for GEOM_STRIPE class and turn it on by default.
In this mode you can setup even very small stripe size and you can be
sure that only one I/O request will be send to every disks in stripe.
It consumes some more memory, but if allocation fails, it will fall
back to "ECONOMIC" mode.

It is about 10 times faster for small stripe size than "ECONOMIC" mode
and other RAID0 implementations. It is even recommended to use this
mode and small stripe size, so our requests are always splitted.

One can still use "ECONOMIC" mode by setting kern.geom.stripe.fast to 0.
It is also possible to setup maximum memory which "FAST" mode can consume,
by setting kern.geom.stripe.maxmem from /boot/loader.conf.
2004-07-09 14:30:09 +00:00
Poul-Henning Kamp
539bec4042 Only detach consumers which are attached when we wither stuff away.
Pointed out by:	pjd
2004-07-09 14:06:17 +00:00
Poul-Henning Kamp
1b464bd889 Make withering water tight.
When we orphan/wither a provider, an attached geom+consumer could
end up being withered as a result and it may be in front of us in
the normal object scanning order so we need to do multi-pass.  On
the other hand, there may be withering stuff we can't get rid off
(yet), so we need to keep track of both the existence of withering
stuff and if there is more we can do at this time.
2004-07-08 16:17:14 +00:00
Poul-Henning Kamp
4fa0290fbf Fail normally rather than KASSERT if attempt to open a spoiled consumer. 2004-07-08 10:34:09 +00:00
Pawel Jakub Dawidek
01ab535e8d Add missing argument. 2004-07-06 17:06:54 +00:00
Pawel Jakub Dawidek
e943975c69 Properly free resources if g_access() fails. 2004-07-06 16:29:32 +00:00
Pawel Jakub Dawidek
a2e31b8b53 - Add 'stop' command, which works just like 'destroy' command, but sounds
less dangerous.
- Update manual pages and extend examples.
- Bump versions.
2004-07-05 21:16:37 +00:00
Pawel Jakub Dawidek
1b39b2f671 g_clone_bio() can fail, be ready for this.
Approved by:	le
2004-07-05 13:24:22 +00:00
Poul-Henning Kamp
8529ce7a87 We only need to check for overlaps if we increasing access counts. 2004-07-04 13:44:48 +00:00
Pawel Jakub Dawidek
e1237b285b Introduce GEOM_LABEL class.
This class is used for detecting volume labels on file systems:
UFS, MSDOSFS (FAT12, FAT16, FAT32) and ISO9660.
It also provide native labelization (there is no need for file system).

g_label_ufs.c is based on geom_vol_ffs from Gordon Tetlow.
g_label_msdos.c and g_label_iso9660.c are probably hacks, I just found
where volume labels are stored and I use those offsets here,
but with this class it should be easy to do it as it should be done by
someone who know how.
Implementing volume labels detection for other file systems also should
be trivial.

New providers are created in those directories:
/dev/ufs/ (UFS1, UFS2)
/dev/msdosfs/ (FAT12, FAT16, FAT32)
/dev/iso9660/ (ISO9660)
/dev/label/ (native labels, configured with glabel(8))

Manual page cleanups and some comments inside were submitted by
Simon L. Nielsen, who was, as always, very helpful. Thanks!
2004-07-02 19:40:36 +00:00
Pawel Jakub Dawidek
9ecdd506ea Remove unused argument for good. 2004-07-01 15:42:03 +00:00
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
Poul-Henning Kamp
43bff1a7ab Forgotten commit: If a provider has zero sectorsize, it is an
indication of lack of media.

Tripped up:	peter
2003-10-22 06:32:20 +00:00
Poul-Henning Kamp
d1b8bf476c Remove KASSERT check for negative bio_offsets, add "normal" EIO
error return for same.
2003-10-19 19:06:54 +00:00
Poul-Henning Kamp
3916828f7b Retire bio_blkno entirely.
bio_offset is the field drivers should use.
bio_pblkno remains as a convenient place to store the number of
the device drivers.
2003-10-18 17:53:34 +00:00
Poul-Henning Kamp
e83d1f3b9c Assume that bp->bio_offset is correctly initialized.
This fixes non-power-of-2 blocksize GEOM I/O.
2003-10-12 11:35:55 +00:00
Poul-Henning Kamp
b144e6ffeb Destroy providers maked with G_PF_WITHER when the last consumer has detached. 2003-10-12 11:34:35 +00:00
Poul-Henning Kamp
f4db0cbe58 Interior decoration changes. 2003-10-07 09:28:07 +00:00
Poul-Henning Kamp
f7eeab176c Allow our bio tools to be used for local bio-chopping by not mandating
a bio_from value.  bio_to is still mandated (mostly for debuggign) and
shall be copied from the parent bio.
2003-10-06 09:07:35 +00:00
Poul-Henning Kamp
90916ef730 Introduce a per provider wither flag 2003-10-06 09:05:44 +00:00
Poul-Henning Kamp
5774cead7a Return ENODEV in case the driver has no dump routine. 2003-09-29 07:44:23 +00:00
Poul-Henning Kamp
70cd771337 The present defaults for the open and close for device drivers which
provide no methods does not make any sense, and is not used by any
driver.

It is a pretty hard to come up with even a theoretical concept of
a device driver which would always fail open and close with ENODEV.

Change the defaults to be nullopen() and nullclose() which simply
does nothing.

Remove explicit initializations to these from the drivers which
already used them.
2003-09-27 12:01:01 +00:00
Poul-Henning Kamp
3eb6ffdf43 Add more KASSERTS(). 2003-09-26 20:52:46 +00:00
Poul-Henning Kamp
eb98005f8d Be more careful in dumpconf: softc may be NULL for departing devices.
Allow drivers to initialize the d_devstat if they want magic params.
2003-09-23 07:53:59 +00:00
Poul-Henning Kamp
e060b6bd03 Reorder a couple of KASSERTS to give more sensible messages.
Found by:	GEOM 101 class of '03
2003-09-11 00:49:02 +00:00
Poul-Henning Kamp
d5ce9dac89 Correct bzero length so we clear the entire key structure. 2003-09-08 18:35:26 +00:00
Poul-Henning Kamp
a8c1568e29 Bzero the right number of bytes.
Found by:	Juergen Buchmueller <pullmoll@stop1984.com>
2003-09-06 18:37:17 +00:00
Poul-Henning Kamp
f03bec944d Make sure to return ENOIOCTL if the ioctl is not handled. 2003-09-04 21:23:46 +00:00
Poul-Henning Kamp
497c334767 Simplify the ioctl handling in GEOM.
This replaces the current ioctl processing with a direct call path
from geom_dev() where the ioctl arrives (from SPECFS) to any directly
connected GEOM class.

The inverse of the above is no longer supported.  This is the
situation were you have one or more intervening GEOM classes, for
instance a BSDlabel on top of a MBR or PC98.  If you want to issue
MBR or PC98 specific ioctls, you will need to issue them on a MBR
or PC98 providers.

This paves the way for inviting CD's, FD's and other special cases
inside GEOM.
2003-09-01 20:45:32 +00:00
Poul-Henning Kamp
ce1ee7895e Try to close the race between disk_destroy() and a subsequent disk_create(). 2003-09-01 12:03:13 +00:00
Poul-Henning Kamp
bff1e2999d Add the new g_dev_getprovider() function, the swap_pager needs it now.
Spotted by:	mr
2003-08-30 18:33:55 +00:00
Paul Saab
e65b213768 Change the the size fields to daddr_t to support greater than 2TB ccd volumes.
Reviewed by:	phk
2003-08-22 11:21:06 +00:00
Poul-Henning Kamp
f63679713e Make CCD unloadable. 2003-08-22 11:04:47 +00:00
Poul-Henning Kamp
1f75de94ea Don't panic over the fact that unloading failed if we already knew that. 2003-08-22 11:00:54 +00:00
Poul-Henning Kamp
e30b2eda02 Block all GETATTR calls hitting the CCD, we wouldn't know which child
device should handle them.

This prevents for instance GEOM::ioctl requests from reaching a
lower BSDlabel node, which ps@ found would confuse newfs(8).
2003-08-22 10:28:19 +00:00
Poul-Henning Kamp
92b5e86ebf Check for null softc pointers, these happens when a ccd is withering.
Found by:	 David Schultz <dschultz@OCF.Berkeley.EDU>
2003-08-22 10:22:46 +00:00
Poul-Henning Kamp
4ba5a129c5 Replace a panic with a .1Hz retry loop.
Not a perfect solution, but far cheaper than one.
2003-08-13 12:35:25 +00:00
Poul-Henning Kamp
f0ffd81bc2 In case we encounter a zero sectorsize provider in g_io_check(), fail
the request with a printf rather than a divide by zero error.
2003-08-13 06:42:56 +00:00
Poul-Henning Kamp
a35006e814 Kick Giant compatibility one layer up. 2003-08-02 10:11:58 +00:00
Poul-Henning Kamp
114ebb2f28 Fix a memory leak in CCD's mirror code. 2003-07-29 20:04:06 +00:00
Poul-Henning Kamp
3f5187f276 Implement DOSPTYP_EXTLBA more completely: loop until we find no more
partitions.

Submitted by:	Rudolf Cejka <cejkar@fit.vutbr.cz>
PR:	53719
2003-07-29 10:09:13 +00:00
Poul-Henning Kamp
d32622aaee Handle geoms which are withering away specially in the dump functions. 2003-07-08 21:12:40 +00:00
Poul-Henning Kamp
fd02a4233e Only dump 512 bytes of debugging.
Always wait for things to settle before returning.
2003-07-02 08:07:07 +00:00
Poul-Henning Kamp
44be139bbb Sleep on "-" in our normal state to simplify debugging. 2003-06-18 10:33:09 +00:00
Poul-Henning Kamp
22db1e9ff5 Add "GEOM_FOX", a class which detects and selects between multiple
redundant paths to the same device.

This class reacts to a label in the first sector of the device,
which is created the following way:

        #    "0123456789abcdef012345..."
        #    "<----magic-----><-id-...>
        echo "GEOM::FOX       someid" | dd of=/dev/da0 conv=sync

NB: Since the fact that multiple disk devices are in fact the same
    device is not known to GEOM, the geom taste/spoil process cannot
    fully catch all corner cases and this module can therefore be
    confused if you do the right wrong things.

NB: The disk level drivers need to do the right thing for this to
    be useful, and that is not by definition currently the case.
2003-06-18 09:29:28 +00:00
David E. O'Brien
50b1faef38 Use __FBSDID().
Approved by:	phk
2003-06-11 06:49:16 +00:00
Poul-Henning Kamp
ec421aec25 Fix error handling for ENOMEM style issues. 2003-06-09 19:12:19 +00:00
Poul-Henning Kamp
84c080a85e Improve the root-dev prompt facility for printing devices which could
possibly be a root filesystem.
2003-06-07 15:46:53 +00:00
Poul-Henning Kamp
ac2ba9e3d5 Wait for everything to settle before we try to print the list of
geom devices.
2003-06-07 15:32:09 +00:00
Poul-Henning Kamp
b61e8fed30 Make sure we return an error message if the geom parameter is not
located.
2003-06-07 15:31:44 +00:00
Poul-Henning Kamp
c44c213f24 Polishing and nitpicking. 2003-06-07 11:06:44 +00:00
Poul-Henning Kamp
df2c3922e9 Drop a memory-corruption debugging test-tool. 2003-06-07 10:55:48 +00:00
Poul-Henning Kamp
a1a9b44569 Add missing va_end() calls.
Noticed by:	tmm
2003-06-07 10:16:53 +00:00
Poul-Henning Kamp
d6c5e71627 Introduce g_provider_by_name() function, and use it. 2003-06-04 18:17:52 +00:00
Poul-Henning Kamp
3a3fcd72dd Make this a true GEOM class:
Attach to the component devices using GEOM semantics.
        Create a GEOM provider instead of using disk_create()
        Use the GEOM OAM api for configuration.

I saw approx ~1% speedup in througput and ~7% in latency in a
simple minded test of a two-disk striped device.

This file was repo-copied from src/sys/dev/ccd/ccd.c.

This is not yet linked into the build.
2003-06-04 18:16:09 +00:00
Poul-Henning Kamp
ce64e0f2c9 Add a KASSERT to prevent the same GEOM class from being processed loaded
twice.

Enforce that classes should have different names while we are here.
2003-06-04 17:51:10 +00:00
Poul-Henning Kamp
0f557e0ac0 Further devilification of CCD:
Change the list interface to simplify things.
Remove old list ioctls which bogusly exported the softc to userland.
Move the softc and associated structures from the public header to
the source file.
2003-06-02 21:29:04 +00:00
Poul-Henning Kamp
189337d81f Begin deevilification of CCD:
Make CCD a GEOM class.

For now only use this for implementing a OAM config method which
can return a list of configured CCD devices in the format which
"ccdconfig -g[v]" would normally output.
2003-06-02 20:50:03 +00:00
Poul-Henning Kamp
786a6905ec Return an indicative error message. 2003-06-02 20:35:37 +00:00
Poul-Henning Kamp
83d771de78 Simplify the GEOM OAM api: Drop the request type, and let everything
hinge on the "verb" parameter which the class gets to interpret as
it sees fit.

Move the entire request into the kernel and move changed parameters
back when done.
2003-06-01 13:47:51 +00:00
Poul-Henning Kamp
a6c58fec6c constify g_sanity() 2003-06-01 13:30:39 +00:00
Poul-Henning Kamp
58223589d5 Use bcmp() to compare hash strings. 2003-06-01 09:18:49 +00:00
Poul-Henning Kamp
b77052e617 Remove unused variable.
Remove unneeded return;

Found by:       FlexeLint
2003-05-31 19:41:33 +00:00
Poul-Henning Kamp
3bae8877f4 Remove unused variables.
Found by:       FlexeLint
2003-05-31 19:40:43 +00:00
Poul-Henning Kamp
7fd69a8064 Remove unused variables.
Rename struct h0h0 to g_hh01 in order to make it unique over files.

Found by:       FlexeLint
2003-05-31 19:37:21 +00:00
Poul-Henning Kamp
c543626797 Remove unused variables.
Remove #ifdef notyet which will never become.

Found by:       FlexeLint
2003-05-31 19:30:52 +00:00
Poul-Henning Kamp
23bfa598a8 Remove unused variable.
Remove unneeded return.

Found by:       FlexeLint
2003-05-31 19:29:38 +00:00
Poul-Henning Kamp
68283a9b5a Remove unused variable.
Found by:       FlexeLint
2003-05-31 19:28:53 +00:00
Poul-Henning Kamp
ce67c955ca Add a destroy_geom method to the slice "library".
If a slice class has no destroy_geom method, use this one.

This should allow all slicers to kldload.
2003-05-31 19:25:05 +00:00
Poul-Henning Kamp
fc29c9de5c Don't use & in front of arrays.
Found by:       FlexeLint
2003-05-31 19:23:11 +00:00
Poul-Henning Kamp
a980e07369 Remove unused variable.
Found by:       FlexeLint
2003-05-31 19:08:23 +00:00
Poul-Henning Kamp
d6b602d4b2 Remove unused variable.
Found by:       FlexeLint
2003-05-31 18:55:18 +00:00
Poul-Henning Kamp
6c87f8d5ea Introduce a init and fini member functions on a class.
Use ->init() and ->fini() to handle the mutex in geom_disk.c

Remove the g_add_class() function and replace it with a standardized
g_modevent() function.

This adds the basic infrastructure for loading/unloading GEOM classes
2003-05-31 18:13:07 +00:00
Poul-Henning Kamp
f075585f67 Remove the G_CLASS_INITIALIZER, we do not need it anymore. 2003-05-31 16:59:27 +00:00
Poul-Henning Kamp
7e28a78f0e Use le_uuid_dec() since GPT UUID's are always in LE format.
Tested by:      Marcel
2003-05-31 16:48:43 +00:00
Poul-Henning Kamp
43f0db6cc5 Don't do silly thing if the disk_create() event gets canceled.
Approved by:	re/scottl
2003-05-25 16:57:10 +00:00
Poul-Henning Kamp
67fd2837cd Return ENXIO if the softc pointer is NULL, in all likelyhood the
disk is in the process of disappearing.

Approved by:	re/rwats*
2003-05-21 18:52:29 +00:00
Poul-Henning Kamp
3eb8c738fd When a disk disappears, destroy the class from the event thread
to avoid race condtion.

Approved by:	re/rwatson
2003-05-12 20:15:28 +00:00
Poul-Henning Kamp
4da6e74ce4 When a GEOM (/dev-)device is closed and we find that I/O requests are
still outstanding, give them a chance to complete.

If after 10 seconds we still find outstanding I/O requests, complete
the close with a console warning that the system is likely to panic
later on.

This is a workaround for umount -f not quite doing the right thing.

Approved by:    re/scottl
2003-05-09 21:25:28 +00:00
Poul-Henning Kamp
2cc9686e52 Hide the "ENOMEM" notice messages behind bootverbose. They are still
a valuable debugging tool for certain kinds of problems.

Approved by:	re/scottl
2003-05-07 05:37:31 +00:00
Poul-Henning Kamp
c9e629297a Fix the WARNING for wrong rawoffset, I tested incompatible units.
Approved by:	re/jhb
2003-05-06 19:36:13 +00:00
Poul-Henning Kamp
af3e2db5de Avoid double-free panic.
Tripped up:	DougB
2003-05-05 15:52:11 +00:00
Poul-Henning Kamp
c0c393a2aa Re-order the the initialization slightly to improve structure. 2003-05-05 08:58:12 +00:00
Poul-Henning Kamp
0195276f54 Use a dedicated malloc(9) bucket for sector storage. 2003-05-05 08:37:07 +00:00
Poul-Henning Kamp
3fd530f7ec Don't warn if the rawoffset is zero, that is actually the best value it
could have.
2003-05-05 08:30:59 +00:00
Poul-Henning Kamp
b9275c8fc6 Turn the check that rawoffset == mbroffset into a warning instead. 2003-05-05 06:46:49 +00:00
Poul-Henning Kamp
b624374de8 Only accept a rawoffset if it is identical to the mbroffset. 2003-05-04 19:26:31 +00:00
Poul-Henning Kamp
7f9e81b703 Add a way to read the current mbroffset from a BSD label class. 2003-05-04 19:25:48 +00:00
Poul-Henning Kamp
1ee055e692 Add gctl_set_param() function. 2003-05-04 19:24:34 +00:00
Poul-Henning Kamp
ce40bcd0d1 Remove debugging printfs which should not have been committed. 2003-05-04 18:48:25 +00:00
Poul-Henning Kamp
a767c3daa3 Add a OAM interface for changing the label and writing the boot code. 2003-05-03 08:01:34 +00:00
Poul-Henning Kamp
951fd0d157 remove unused variables.
Spotted by:	dougb
2003-05-03 07:12:15 +00:00
Poul-Henning Kamp
56dde750d5 Make bsd_disklabel_le_enc calculate the checksum and fill it in.
(If there is a legitimate need to correctly encode and pack a
disklabel with an invalid checksum custom tools can be built for
that.)

Make bsd_disklabel_le_dec() validate the magics, number of partitions
(against a new parameter) and the checksum.

Vastly simplify the logic of the GEOM::BSD class implementation:

Let g_bsd_modify() always take a byte-stream label.

This simplifies all users, except the ioctl's which now have to
convert to a byte-stream first.  Their loss.

g_bsd_modify() is called with topology held now, and it returns
with it held.

Always update the md5sum in g_bsd_modify(), otherwise the check
is no use after the first modification of the label.  Make the
MD5 over the bytestream version of the label.

Move the rawoffset hack to g_bsd_modify() and remove all the
inram/ondisk conversions.

Don't configure hotspots in g_bsd_modify(), do it in taste instead,
we do not support moving the label to a different location on the
fly anyway.

This passes all current regression tests.
2003-05-02 22:46:13 +00:00
Poul-Henning Kamp
81377a3f17 Pull in bcopy() prototype from <string.h> when compiled in userland. 2003-05-02 19:53:55 +00:00
Poul-Henning Kamp
039b4cba75 Considering that I did cast the arguments to (intmax_t) I must have
been sleepy since I used %qd instead of %jd.
2003-05-02 19:08:57 +00:00
Poul-Henning Kamp
3daf7274a1 Style improvement. 2003-05-02 12:57:40 +00:00
Poul-Henning Kamp
3110102a73 Use g_wither_geom() and plug memory leaks. 2003-05-02 12:52:51 +00:00
Poul-Henning Kamp
3e7b7bb1cb Plug memory leaks. 2003-05-02 12:49:41 +00:00
Poul-Henning Kamp
5ffb2c8bfd Use an uma-zone for allocation bio requests. 2003-05-02 12:36:12 +00:00
Poul-Henning Kamp
c9c29450f5 Use g_slice_spoiled() instead of g_std_spoiled().
Add XXX comment about minor memory leak until I can fix it.
2003-05-02 08:33:26 +00:00
Poul-Henning Kamp
7da144d91c Use g_slice_spoiled() instead of g_std_spoiled(). 2003-05-02 08:21:02 +00:00
Poul-Henning Kamp
a0c89548a3 Use g_slice_spoiled().
Free buffer from g_read_data().
2003-05-02 08:13:03 +00:00
Poul-Henning Kamp
c4da4e46b2 Back out all the stuff that didn't belong in the last commit. 2003-05-02 06:42:59 +00:00
Poul-Henning Kamp
e65ab0f83f Use g_slice_spoiled() rather than g_std_spoiled().
Remember to free the buffer we got from g_read_data().
2003-05-02 06:36:14 +00:00
Poul-Henning Kamp
4f806d2428 Use g_slice_spoiled() not g_std_spoiled() 2003-05-02 06:34:51 +00:00
Poul-Henning Kamp
28ce9efcef Use g_slice_spoiled() rather than g_std_spoiled() 2003-05-02 06:33:59 +00:00
Poul-Henning Kamp
afec8eb8ad Use g_slice_spoiled() rather than g_std_spoiled(). 2003-05-02 06:33:26 +00:00
Poul-Henning Kamp
15649213a6 Use a more tailored spoil routine for slices, and take advantage of
g_wither_geom() to do most of the work for us.
2003-05-02 06:29:33 +00:00
Poul-Henning Kamp
3ddef7422c Style improvement. 2003-05-02 06:22:48 +00:00
Poul-Henning Kamp
03af3a23dd Use g_wither_geom() for cleanup. 2003-05-02 06:22:32 +00:00
Poul-Henning Kamp
d6227ae71f Rework the "withering" mechanism:
Introduce g_wither_geom() to do the work in one single place.
2003-05-02 06:15:27 +00:00
Poul-Henning Kamp
82b53b8dc8 Rename g_slice_init() to the more appropriate g_slice_alloc() and give
it a g_slice_free() partner function.
2003-05-02 05:33:27 +00:00
Poul-Henning Kamp
516b02faf7 style improvement. 2003-05-02 05:26:47 +00:00
Poul-Henning Kamp
9dfffbc959 Get rid of trivial function g_destroy_event(). 2003-05-02 05:26:19 +00:00
Poul-Henning Kamp
6a543b1031 Plug some memory-leaks. 2003-05-01 21:07:08 +00:00
Poul-Henning Kamp
606402511a Remove the now obsolete geomidorname hack. 2003-05-01 20:32:24 +00:00
Poul-Henning Kamp
c8589ad169 Add a new flag, EV_CANCELED, and use it to make g_waitfor_event() return
EAGAIN if an event got canceled.
2003-05-01 19:43:52 +00:00
Poul-Henning Kamp
2ab31b05ba When events on a reference is cancelled, check our doorstep first,
it might be an orphan.
2003-05-01 19:24:00 +00:00
Poul-Henning Kamp
e931331eaa Remove now unneeded special case for "geom.ctl". 2003-05-01 18:18:14 +00:00
Yoshihiro Takahashi
4b4582a84c Remove DIOCGPC98 ioctl. 2003-05-01 14:40:16 +00:00
Yoshihiro Takahashi
50cf98ed97 - Move decoding pc98_partition function into geom_pc98_enc.c.
- Add encoding pc98_partition function.
2003-05-01 13:44:24 +00:00
Marcel Moolenaar
b52e9eb6b6 Don't emulate a MBR by handling the MBR::type attribute. It is
not needed at all. The BSD class will attach to a GPT class without
it.
2003-05-01 01:51:28 +00:00
Mark Murray
51da11a27a Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.
2003-04-30 12:57:40 +00:00
Poul-Henning Kamp
c7f3baedf3 Fix an obscure fencepost error in GBDE's sector mapping code:
For certain combinations of sectorsize, mediasize and random numbers
(used to define the mapping), a multisector read or write would ignore
some subset of the sectors past the first sector in the request because
those sectors would be mapped past the end of the parent device, and
normal "end of media" truncation would zap that part of the request.

Rev 1.19+1.20 of g_bde_work.c added the check which should have alerted
me to this happening.  This commit maps the request correctly and
adds KASSERTS to make sure things stay inside the parent device.

This does not change the on-disk layout of GBDE, there is no need to
backup/restore.
2003-04-29 19:46:42 +00:00
Poul-Henning Kamp
a17da2aa74 Typo in last commit: Do not press xZZ to leave vi(1). 2003-04-29 19:38:55 +00:00
Poul-Henning Kamp
ca8f372bbc When a bio comes back from below with a zero error code, check that
it wrote the full length.  The only case where this should be able
to happen is if we try to read/write past the end and the request
is truncated.  We obviously should never try to do that, so this
code should never activate.
2003-04-29 19:37:36 +00:00
Alexander Kabaev
104a9b7e3e Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on:	standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-04-29 13:36:06 +00:00
Poul-Henning Kamp
90336bb4d8 I accidentally leaked this debugging tool in with my last commit.
Disable it with a direct warning.
2003-04-28 17:57:12 +00:00
Poul-Henning Kamp
306babd20c Rename g_bde_get_sector() to g_bde_get_keysector() and pick up the
offset from the work packet.
2003-04-28 06:38:31 +00:00
Poul-Henning Kamp
11ca41a9bb Only attempt total cache-purge once in case of failure. 2003-04-28 06:19:41 +00:00
Poul-Henning Kamp
035694b29a Better criteria for skipping disk reading BIO_READ work packets. 2003-04-28 06:15:39 +00:00
Poul-Henning Kamp
d8e7c92c9e Explicitly set the sector state to JUNK if we encounter a read-error. 2003-04-28 06:10:35 +00:00
Poul-Henning Kamp
c08c56e02a Bail as soon as the first write request has failed, there is no point
in trying the second write if the first one went nowhere.
2003-04-26 21:40:26 +00:00
Poul-Henning Kamp
54d2011343 Appearantly UFS no longer issues BIO_DELETE requests correctly, and
consequently trashes data.  Disable BIO_DELETE handling in gbde for now.
2003-04-26 21:39:33 +00:00
Poul-Henning Kamp
9b99e39d61 Do an explicit retry after we have dumped the cache, rather than a
(potential) tail recursion.
2003-04-25 21:43:11 +00:00
Poul-Henning Kamp
e8e0742ef4 If on a BIO_READ request, we failed to allocate the bio for reading
our key-sector, we would end up returning the read without an error,
despite the fact that the data was not correctly decrypted.

This would result in data corruption on read, but intact data still
on the media.
2003-04-25 21:28:28 +00:00
Poul-Henning Kamp
37f5e4a6c2 Fix a problem and slightly improve the ENOMEM handling:
Give up the entire bio as soon as we detect a problem.

When we detect a problem, give up the bio by contributing the
remainder with ENOMEM, rather than kicking the bio back right
away.

If we failed on a non-first iteration we previously could end up
modifying fields in the bio after we delivered it.  This could
account for memory corruption (none directly reported) on machines
with GBDE.
2003-04-25 21:20:57 +00:00
Poul-Henning Kamp
af6b9f17f9 Don't count a sector in the cache unless we manage to create it. 2003-04-25 20:56:27 +00:00
Poul-Henning Kamp
f2314b445d Rename g_bde_release_sector() to g_bde_release_keysector() and pick up
the sector from the work item.
2003-04-25 20:35:34 +00:00