Commit Graph

921 Commits

Author SHA1 Message Date
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
Poul-Henning Kamp
195d573278 Rename g_bde_read_sector() to g_bde_read_keysector() pick up the offset
in the work structure.
2003-04-25 20:16:59 +00:00
Poul-Henning Kamp
0a9c130c06 Introduce a g_waitfor_event() function which posts an event and waits for
it to be run (or cancelled) and use this instead of home-rolled versions.
2003-04-23 21:28:27 +00:00
Poul-Henning Kamp
a974614b05 More of the event stuff can now be private to geom_event.c 2003-04-23 20:54:42 +00:00
Poul-Henning Kamp
8cd1535a24 Rename g_call_me() to g_post_event(), and give it a flag
argument to determine if we can M_WAITOK in malloc.
2003-04-23 20:46:12 +00:00
Poul-Henning Kamp
d98777f8db Remove the now unused hardcoded g_post_event() event support. 2003-04-23 20:25:33 +00:00
Poul-Henning Kamp
9ab3ea7841 Turn EV_NEW_PROVIDER into a g_call_me() event. 2003-04-23 20:16:13 +00:00
Poul-Henning Kamp
f2e9a09494 Convert EV_SPOILED event to use g_call_me(). 2003-04-23 20:06:38 +00:00
Poul-Henning Kamp
9972896c00 Turn the hardwired NEW_CLASS event into a g_call_me() event. 2003-04-23 19:34:38 +00:00
Poul-Henning Kamp
b5cba4167f Move the shutdown eventhandler stuff to a more logical place. 2003-04-23 19:15:27 +00:00
Poul-Henning Kamp
bf9ab27afb Implement CONFIG_GEOM verbs "write label" and "write bootcode". 2003-04-23 08:23:01 +00:00
Poul-Henning Kamp
ca3d750e73 Introduce gctl_get_paraml() which gets a parameter only if it has the
right length.
2003-04-23 08:03:47 +00:00
Poul-Henning Kamp
fb9483af54 Make gctl_error() take printfline varargs. 2003-04-23 07:50:01 +00:00
Poul-Henning Kamp
668ae29c71 Remove unused event pointers in object structures.
Remove KASSERTS which checked that they were unused.
2003-04-23 06:54:44 +00:00
Poul-Henning Kamp
b874183561 Change the locking so that the _modify function is called with topology
held.

The only place where we want to not hold topology is when we read
(or write) the label to disk: in the case of a disk error with a
long recovery time, holding topology would prevent open/close of
any disk device.
2003-04-22 21:29:58 +00:00
Poul-Henning Kamp
b09d72daf8 We don't need to have a slice->start() function. 2003-04-22 21:24:37 +00:00
Poul-Henning Kamp
d3a1a13766 Do not mandate that slicers have a private ->start(), they may not need
one.  KASSERT() that they have one if G_SLICE_HOT_START is used.
2003-04-22 21:19:17 +00:00
Poul-Henning Kamp
ea9ab6bed2 Implement handling of CONFIG_GEOM OAM request. 2003-04-22 21:01:46 +00:00
Poul-Henning Kamp
2c30da600e Add "CONFIG_GEOM" operation to the OAM API. 2003-04-22 21:00:49 +00:00
Poul-Henning Kamp
70b4ddbb09 Collapse meta arguments into regular arguments, the distinction is
more trouble than it is worth.
2003-04-22 19:42:05 +00:00
Poul-Henning Kamp
989afda211 Implement a hotspot for the sunlabel.
This means that you can no longer trash your opened partitions by writing to
the sunlabel through another partition.  This is similar to the semantics
implemented for BSD labels.
2003-04-21 20:14:36 +00:00
Poul-Henning Kamp
666223979c Update GEOM::SUN to use the decoding functions in geom_sunlabel_enc.c
and #defines from sys/sun_disklabel.h.
2003-04-21 19:54:11 +00:00
Poul-Henning Kamp
9bd6be665d Use #defines from <sys/sun_disklabel.h> instead of private ones. 2003-04-21 19:42:36 +00:00
Poul-Henning Kamp
941a2f8cb5 Functions to encode and decode Sun Microsystems disk partitioning data
structures.

Mostly by:	jake
2003-04-21 18:41:12 +00:00
Poul-Henning Kamp
7220a9e779 Make more of the "hotspot" stuff generic:
Give the class a way to specify the necessary action for read/delete/write:
ALLOW, DENY, START or CALL.

Update geom_bsd to use this.
2003-04-19 10:14:39 +00:00
Poul-Henning Kamp
183a45f65e Create a dedicated structure for holding hotspot information rather than
using slice structures for it.
2003-04-19 10:00:22 +00:00
Poul-Henning Kamp
c72e7314c2 These two files fell off during my previous commit: put the encoding
decoding functions for struct disklabel in a separate .c file.
2003-04-17 08:41:08 +00:00
Poul-Henning Kamp
7715475960 More correct patch: Only call biofinish if we have not already sent
any children down the mesh.
2003-04-14 08:49:54 +00:00
Poul-Henning Kamp
2f912fc976 Call biofinish() also when we get a malloc() failure. 2003-04-14 08:08:17 +00:00
Poul-Henning Kamp
3924ad705e Time has run from the "run GEOM in userland" harness, and the new regression
test is built to test GEOM as running in the kernel.

This commit is basically "unifdef -D_KERNEL" to remove the mainly #include
related code to support the userland-harness.
2003-04-13 09:02:06 +00:00
Poul-Henning Kamp
537d9274dc If we hit access ahead of a spoil event, we should have negative
delta access-counts and proceed.
2003-04-12 17:04:34 +00:00
Poul-Henning Kamp
2b454c0ae5 Fix a bug which resulted in orphanization getting confused every now
and then.
2003-04-12 16:36:19 +00:00
Poul-Henning Kamp
5f5a9022b2 Retire the experimental bio_taskqueue(), it was not quite as usable as
hoped.  It can be revived from here, should other drivers be able to
use it.
2003-04-12 09:13:01 +00:00
Poul-Henning Kamp
0d3e96e39c Retire the "frontstuff" record keeping, it was no match for the
in-band meta-data of BSD labels and a more complex solution will be needed.
2003-04-12 08:41:26 +00:00
Poul-Henning Kamp
6e03422af0 Move the functions for encoding decoding struct dos_partition into
a separate .c file so they can be used from userland as well.
2003-04-12 08:34:40 +00:00
Poul-Henning Kamp
cf83284fe3 Only be verbose if (bootverbose) 2003-04-09 13:52:40 +00:00
Poul-Henning Kamp
551e52efb8 With the magic sequence checks removed this class is downright dangerous
to have in your kernel since it indiscriminately attaches to anything
it is offered with a range of bogus partitions.

Stop this from happening by rejecting any label with negative numbers in
it.
2003-04-09 13:08:36 +00:00
Poul-Henning Kamp
13ac082b26 Correctly split cyl/sects bytes when we print them. 2003-04-09 09:21:33 +00:00
Poul-Henning Kamp
2692cc08db Style issue: use do {...} while(0); for multi-exit section. 2003-04-09 08:56:26 +00:00
Poul-Henning Kamp
63f253709f Retire the DIOCGMBR ioctl before anybody starts to use it. 2003-04-03 19:37:40 +00:00
Poul-Henning Kamp
4eba52a2d2 Remove all references to BIO_SETATTR. We will not be using it. 2003-04-03 19:19:36 +00:00
Poul-Henning Kamp
ab0ff32ea1 Update the initializer for GEOM_MBREXT, I overlooked it previously. 2003-04-03 19:05:03 +00:00
Poul-Henning Kamp
4c763c77dc Add #define for DOSPTYP_PMBR, and use it. 2003-04-03 18:55:16 +00:00
Poul-Henning Kamp
76c4109ebb #include <sys/endian.h> as needed. 2003-04-03 11:56:10 +00:00
Poul-Henning Kamp
4d3651f456 Remove geom_enc.c, a superset of these functions are now available in
<sys/endian.h>
2003-04-03 11:40:06 +00:00
Poul-Henning Kamp
d8cb8a5137 Use <sys/endian.h> instead of geom_enc.c for endianess-agnostification. 2003-04-03 11:36:53 +00:00
Poul-Henning Kamp
82db45a5af Use sys/endian.h instead of geom_enc.c for endian-agnostfication. 2003-04-03 11:33:51 +00:00
Poul-Henning Kamp
68f156409e Make sure we don't ignore error codes. 2003-04-03 11:19:24 +00:00
Poul-Henning Kamp
316aed030e Add handling for cancelled events in the g_call_me() methods. 2003-04-02 21:10:04 +00:00
Poul-Henning Kamp
afcbcfaed0 Change events to have an array of "void *" references, and give the
event posting functions varargs to fill these.

Attribute g_call_me() to appropriate g_geom's where necessary.

Add a flag argument to g_call_me() methods which will be used to signal
cancellation of events in the future.

This commit should be a no-op.
2003-04-02 20:41:18 +00:00
Poul-Henning Kamp
8f6da0e4ac Only orphan things if the open/close actually succeeded. 2003-04-02 13:10:40 +00:00
Poul-Henning Kamp
c7e1925c7c Properly handle races between open/close and orphan.
KASSERT the race between close and strategy, it is an error in the upper
echelons if this happens,

Add XXX: comment explaining why the ioctl/orphan race is not closed.
2003-04-02 13:09:50 +00:00
Poul-Henning Kamp
4752f7570a Include <geom/geom_disk.h> not <sys/disk.h> 2003-04-01 18:57:14 +00:00
Poul-Henning Kamp
891619a66d Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now.

Spell bioq_disksort() consistently with the remaining bioq_*().

#include <geom/geom_disk.h> where this is more appropriate.
2003-04-01 15:06:26 +00:00
Poul-Henning Kamp
7c79beb3ce Start to split the GEOM/diskdriver specific bits into geom/geom_disk.h 2003-04-01 13:19:14 +00:00
Poul-Henning Kamp
4a1e273c48 Remove the old config interface, the new OAM is sufficiently functional
now.
2003-04-01 07:33:56 +00:00
Poul-Henning Kamp
dfb99a70d8 Remove the old config interface now that the new OAM is functional. 2003-04-01 07:33:17 +00:00
Poul-Henning Kamp
afa2a5aab7 Remove some debugging in the new OAM[*] and add a debug flag for other
parts of it.

[*] I've been asked what "OAM" means:  It's an acronym used in the
telecom industry, "Operations And Maintenance", and there it covers
anything from a single unlabeled led on the frontpanel the the full
nightmare of CMIP for SS7.
2003-03-31 18:35:37 +00:00
Poul-Henning Kamp
376ceb799f Fix a bug in the ENOMEM pacing code which probably made it panic systems
after a lot of ENOMEM errors.
2003-03-29 22:34:37 +00:00
Poul-Henning Kamp
29c331bfaa Add create_geom and destroy_geom methods. 2003-03-29 22:14:21 +00:00
Poul-Henning Kamp
63728c47e8 Run a revision on the OAM api.
Use prefix gctl_ systematically.
Add flag with access perms for each argument.
Add ro/rw versions of argument building functions.
General cleanup.
2003-03-27 14:35:00 +00:00
Poul-Henning Kamp
5e52756d9d Check return value of g_call_me() 2003-03-27 14:32:52 +00:00
Poul-Henning Kamp
897af91bac g_class_by_name() was unused too. 2003-03-25 09:11:17 +00:00
Poul-Henning Kamp
77b63fb4b1 Remove unuse g_insert_geom(). 2003-03-25 09:07:35 +00:00
Poul-Henning Kamp
0b94902f81 Forward compatibility: NULL check the passed in meta argument. 2003-03-25 09:02:41 +00:00
Poul-Henning Kamp
c138fec0b5 Premptively change initializations of struct g_class to use C99
sparse struct initializations before we extend the struct with
new OAM related member functions.
2003-03-24 19:30:15 +00:00
Poul-Henning Kamp
d49d7ca591 Turn /dev/geom.ctl from a GEOM class into a plain character device driver
instead, it will never see a disk-I/O transaction, so this is a lot simpler.
2003-03-24 13:37:15 +00:00
Poul-Henning Kamp
fbf79df3b8 Save a lock: Grab the stall_events SX lock exclusively so it also serialize
OAM reqests.
2003-03-24 13:35:06 +00:00
Poul-Henning Kamp
dddc28bfe0 Introduce g_cancel_events() and use it a couple of places where it makes
sense.
2003-03-23 23:01:40 +00:00
Poul-Henning Kamp
d943f1b0b9 Introduce an SX lock which allows us to stall event processing
during OAM operations.
2003-03-23 21:58:09 +00:00
Poul-Henning Kamp
757ed3b591 I forgot the evil ioctl census scripts: #include <geom/geom_ctl.h> 2003-03-23 11:05:44 +00:00
Poul-Henning Kamp
3117e54484 Marshalling stuff for OAM API. 2003-03-23 10:16:14 +00:00
Poul-Henning Kamp
679c4aa68c A note about which #include files may be used where. 2003-03-23 10:08:13 +00:00
Poul-Henning Kamp
62d03b91ec Start leaking the AOM api into the tree. 2003-03-23 10:07:44 +00:00
Poul-Henning Kamp
7da1ebfd74 Mitigate deadlock situation pending a more complete solution. 2003-03-21 22:05:33 +00:00
Poul-Henning Kamp
e24cbd9017 Retire the GEOM private statistics code and use devstat instead. 2003-03-18 09:42:33 +00:00
Poul-Henning Kamp
b4b138c27f Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.
2003-03-18 08:45:25 +00:00
Poul-Henning Kamp
20d2026b4e #ifdef notyet a bit of code which needs not yet committed refcounting to
work correctly.
2003-03-16 16:29:04 +00:00
Poul-Henning Kamp
81876757ec Use devstat_{start,end}_transaction_bio().
Remember to set bio_resid correctly first.
2003-03-15 10:49:26 +00:00
Poul-Henning Kamp
e582990901 If we run out of consumers while orphaning them, and the provider's geom
is withering, destroy the provider when done.

This was exposed by the recent change to geom_dev's orphaning logic.
2003-03-10 23:41:41 +00:00
Poul-Henning Kamp
e60dce6b42 Fix yet another fallout of our M_* song and dance. 2003-03-10 23:34:12 +00:00
Poul-Henning Kamp
564632b081 Remove unneeded #include of geom_stats.h 2003-03-09 10:04:21 +00:00
Poul-Henning Kamp
f48b881942 Stamp out Danglish. 2003-03-09 10:02:31 +00:00
Poul-Henning Kamp
0e6be4723b Don't use statistics counters to detect outstanding I/O. 2003-03-09 10:01:16 +00:00
Poul-Henning Kamp
c6ae9b5fd2 Don't abuse the statistics counters for detecting if we have outstanding
I/O requests, instead use the new dedicated fields in the consumer and
provider to track this.
2003-03-09 09:59:48 +00:00
Poul-Henning Kamp
0e082fcca2 Add u_int nstart, nend counters to consumer and providers so we will not
have to examine the stats structure to tell if we have outstanding I/O
requests.

Making them u_int improves the chance of atomic updates to them,
but risks roll-over.  Since the only interesting property is if
they are equal or not, this is not an issue.
2003-03-09 09:58:36 +00:00
Poul-Henning Kamp
df6c9fe955 When a DEV class consumer is orphan'ed we need to wait for all the
outstanding requests to return before we unravel the mesh.

It is very important that the stuff below us plays nice and don't
overlook a couple of outstanding bio's, because until they remember
the geom event thread is blocked.  At an expense in code here this
could be made more robust, but I actually _want_ a robust failure
in this case so any offending drivers can be fixed.
2003-03-09 09:28:45 +00:00
Poul-Henning Kamp
09f958046c Allocate devstat structure with devstat_new_entry(). 2003-03-08 20:00:11 +00:00
Poul-Henning Kamp
60794e0478 Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
Poul-Henning Kamp
ea6ff0649f Limit our requests to DFLTPHYS, this is generally a good idea for
memory-allocation purposes.  Right now it is also a very good idea
because we hit a Giant assertion in the free(9) processing if we
free something larger than 64k.
2003-03-07 19:09:46 +00:00
Poul-Henning Kamp
0238f932b8 Initialize the second buffer for mirroring to point to itself and not its
partner.
2003-03-04 10:15:19 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Poul-Henning Kamp
aa8918faf9 NO_GEOM cleanup:
Remove cdevsw->d_psize() implementation, we don't need it any more.
2003-03-02 14:42:01 +00:00
Poul-Henning Kamp
98bbd7aa59 NO_GEOM cleanup:
Retire the "dev_t" centric version of the disk mini-layer.
Remove now unneeded linkage field in dev_t and struct disk.
2003-02-28 10:02:02 +00:00
Maxime Henrion
07159f9c56 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
Peter Grehan
485d645e63 Drop down Apple Partition Map code that has been in use by some
ppc developers for a while.

OK'd by:  phk
2003-02-23 01:25:35 +00:00
Poul-Henning Kamp
ad3467e1fc NO_GEOM cleanup: Convert CCD(4) to be use "struct disk*" instead of "dev_t"
as "this" handle.
2003-02-21 23:25:43 +00:00
Poul-Henning Kamp
2c6b49f6af NO_GEOM cleanup:
Retire the "d_dump_t" and use the "dumper_t" type instead.

Dumper_t takes a void * as first arg which is more general than the
dev_t taken by d_dump_t.  (Remember: we could have net-dumpers if
somebody wrote us one!)

Define the convention for GEOM controlled disk devices to be that the
first argument to the dumper function is the struct disk pointer.

Change device drivers accordingly.
2003-02-21 19:00:48 +00:00
Poul-Henning Kamp
b82ff75854 NO_GEOM cleanup:
Change the argument to disk_destroy() to be the same struct disk * as
disk_create() takes.

This enables drivers to ignore the (now) bogus dev_t which disk_create()
returns.
2003-02-21 15:13:26 +00:00
Poul-Henning Kamp
0c977c9c53 Add M_WAITOK 2003-02-19 22:51:33 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Tor Egge
96365d3dcf Correctly set bio_data in cloned children when cutting up large requests. 2003-02-12 16:30:46 +00:00
Poul-Henning Kamp
8ebd558f5d Implement a handle for efficient implementation of perforations in
lower extremities.

Setting bit 4 in debugflags (sysctl kern.geom.debugflags=16) will
allow any open to succeed on rank#1 providers.  This will generally
correspond to the physical disk devices: ad0, da0, md0 etc.

This fundamentally violates the mechanics of GEOMs autoconfiguration,
and is only provided as a debugging facility, so obviously error
reports on GEOM where this bit is or has been set will not be
accepted.
2003-02-12 09:48:27 +00:00
Poul-Henning Kamp
f0e185d705 Implement a bio-taskqueue to reduce number of context switches in
disk I/O processing.

        The intent is that the disk driver in its hardware interrupt
        routine will simply schedule the bio on the task queue with
        a routine to finish off whatever needs done.

        The g_up thread will then schedule this routine, the likely
        outcome of which is a biodone() which queues the bio on
        g_up's regular queue where it will be picked up and processed.

        Compared to the using the regular taskqueue, this saves one
        contextswitch.

Change our scheduling of the g_up and g_down queues to be water-tight,
at the cost of breaking the userland regression test-shims.

Input and ideas from:   scottl
2003-02-11 22:30:26 +00:00
Poul-Henning Kamp
7e579a7c0a Announce our ability to do MAXPHYS transfers. 2003-02-11 21:29:53 +00:00
Poul-Henning Kamp
0364fe2cb3 Advertise MAXPHYS upwards, we will split as necessary before we get to the
bottom of things.
2003-02-11 21:24:25 +00:00
Poul-Henning Kamp
99af707c39 Check disk->d_maxsize/dev->si_iosize_max at open time rather than in strategy.
Printf a warning and use DFLTPHYS if the drive has not set a size.
2003-02-11 21:23:34 +00:00
Poul-Henning Kamp
15c672a31d Make a mutex to stop the race coming into geom_disk's done routine.
Cut up requests into smaller bits if they are longer than the drivers
disk->d_maxsize or dev->si_iosize_max.

Properly handle the race condition when using g_clone_bio() is used
without having the single-threadedness of g_down/g_up secure locking.
2003-02-11 18:32:31 +00:00
Poul-Henning Kamp
8028f16b1b Don't divide by zero if there is no stripewidth specified. 2003-02-11 15:23:41 +00:00
Poul-Henning Kamp
200c8a23cd Typo in last commit. 2003-02-11 15:20:34 +00:00
Poul-Henning Kamp
8a63edc3a1 Better names for struct disk elements: d_maxsize, d_stripeoffset
and d_stripesisze;

Introduce si_stripesize and si_stripeoffset in struct cdev so we
can make the visible to clustering code.

Add stripesize and stripeoffset to providers.

DTRT with stripesize and stripeoffset in various places in GEOM.
2003-02-11 14:57:34 +00:00
Poul-Henning Kamp
bb17c5f69f Propagate DISKFLAG_CANDELETE from struct disk to G_PF_CANDELETE on the
provider.
2003-02-11 14:12:06 +00:00
Poul-Henning Kamp
11eb149478 Wrap a long line. 2003-02-11 14:09:48 +00:00
Poul-Henning Kamp
392d56b4bd Don't short-circuit zero-length requests of they are BIO_[SG]ETATTR. 2003-02-11 13:13:10 +00:00
Poul-Henning Kamp
88b1af7730 Use the SI_CANDELETE flag on the dev_t rather than the D_CANFREE flag
on the cdevsw to determine ability to handle the BIO_DELETE request.
2003-02-11 12:49:58 +00:00
Poul-Henning Kamp
cadb987095 Unconditionally make our provider with G_PF_CANDELETE. 2003-02-11 12:37:04 +00:00
Poul-Henning Kamp
faa7b8b96e Propagate G_PF_CANDELETE to our own providers from the provider we attach to. 2003-02-11 12:36:33 +00:00
Poul-Henning Kamp
83333d4569 Introduce flag field and G_PF_CANDELETE field on providers. 2003-02-11 11:55:40 +00:00
Poul-Henning Kamp
dc803e37fb Remove another printf which does not say anything we didn't already know. 2003-02-11 11:02:27 +00:00
Poul-Henning Kamp
81e9eba33a Turn the "updating" flag (back) into two sequence number fields at
either ends of the structure so we have a way to determine if a
snapshot is consistent.
2003-02-11 11:01:26 +00:00
Poul-Henning Kamp
9358a8009a Remove a debugging printf. 2003-02-11 10:59:43 +00:00
Poul-Henning Kamp
cce7303af3 Update the statistics collection code to track busy time instead of
idle time.

Statistics now default to "on" and can be turned off with
        sysctl kern.geom.collectstats=0

Performance impact of statistics collection is on the order of
800 nsec per consumer/provider set on a 700MHz Athlon.
2003-02-09 17:04:57 +00:00
Poul-Henning Kamp
a09a56b5ad Put the name of the /dev entry in the .h file, userland will need it. 2003-02-08 14:50:27 +00:00
Poul-Henning Kamp
4ec353005c Move the g_stat struct to its own .h file, we will export it to other code.
Insted of embedding a struct g_stat in consumers and providers, merely
include a pointer.

Remove a couple of <sys/time.h> includes now unneeded.

Add a special allocator for struct g_stat.  This allocator will allocate
entire pages and hand out g_stat functions from there.  The "id" field
indicates free/used status.

Add "/dev/geom.stats" device driver whic exports the pages from the
allocator to userland with mmap(2) in read-only mode.

This mmap(2) interface should be considered a non-public interface and
the functions in libgeom (not yet committed) should be used to access
the statistics data.
2003-02-08 13:03:57 +00:00
Poul-Henning Kamp
91cd3dc6f5 Move #defines of major/minor to internal header file so other bits can
share and coordinate with geom_dev.
2003-02-08 12:30:12 +00:00
Poul-Henning Kamp
801bb689ca Commit the correct copy of the g_stat structure.
Add debug.sizeof.g_stat sysctl.

Set the id field of the g_stat when we create consumers and providers.

Remove biocount from consumer, we will use the counters in the g_stat
structure instead.  Replace one field which will need to be atomically
manipulated with two fields which will not (stat.nop and stat.nend).

Change add companion field to bio_children: bio_inbed for the exact
same reason.

Don't output the biocount in the confdot output.

Fix KASSERT in g_io_request().

Add sysctl kern.geom.collectstats defaulting to off.

Collect the following raw statistics conditioned on this sysctl:

    for each consumer and provider {
        total number of operations started.
        total number of operations completed.
        time last operation completed.
        sum of idle-time.
        for each of BIO_READ, BIO_WRITE and BIO_DELETE {
            number of operations completed.
            number of bytes completed.
            number of ENOMEM errors.
            number of other errors.
            sum of transaction time.
        }
    }

API for getting hold of these statistics data not included yet.
2003-02-07 23:08:24 +00:00
Poul-Henning Kamp
886d1942e8 Fix some sleep strings to make more sense. 2003-02-07 21:53:55 +00:00
Poul-Henning Kamp
7725f875ee Add the new statistics structure, put one in consumers and providers.
include <sys/time.h> as necessary.
2003-02-07 21:43:34 +00:00
Poul-Henning Kamp
936cc4614b Rename bio_linkage to the more obvious bio_parent.
Add bio_t0 timestamp, and include <sys/time.h> where needed
2003-02-07 21:09:51 +00:00
Gordon Tetlow
ddfa3cce05 Add some comments about the deficiencies of this module. I had hoped to get
around to addressing them some more, but Real Life (tm) has gotten in the
way.
2003-02-07 17:50:33 +00:00
Poul-Henning Kamp
a42106534f Check return value of g_clone_bio(). 2003-02-06 22:00:47 +00:00
Poul-Henning Kamp
ae2afc437b Experimentally don't let go of Giant in geom_disk's done.
We may actually be increasing Giant contention doing so because the
actual stuff we do is very cheap.

Also I am not convinced there is not a tiny window for a race here.
2003-02-06 21:50:39 +00:00
Poul-Henning Kamp
e39d70d4fd Put the checks we perform on a bio before calling ::start in their
own function, handle all validation and truncation at the time we
process the bio instead of when it gets scheduled.
2003-02-06 21:01:36 +00:00
Poul-Henning Kamp
51dd8980f4 Implement the new "struct disk" centered API for device drivers.
This commit should not change anything as no device drivers use the
new API yet.
2003-02-05 21:13:08 +00:00
Poul-Henning Kamp
237d2765f9 Pave the road to removing the fixed size limit on device nodes:
Change the si_name of dev_t's to be a char * and put a private buffer for
holding the name at then end of the struct.

Initialize si_name to point to the private buffer.

Put a KASSERT in geom_disk to prevent overrun on the fake dev_t we still
have to generate for the disk_drivers.
2003-02-04 10:32:40 +00:00
Gordon Tetlow
6be2e1dd37 Correct a comment. GEOM modules do not create /dev entries. They create
providers.

Pointed out by:	phk
2003-02-03 17:21:43 +00:00
Gordon Tetlow
a6fff888c3 Add the GEOM module that makes volume labels useful. A kernel compiled with
this will cause volume labels to be exposed in /dev/vol/<volname>. Currently,
there is no conflict resolution if more than one FS has the same volume name.

Reviewed by:	phk
2003-02-03 17:14:29 +00:00
Poul-Henning Kamp
ffa918814d Add a bio_disk pointer for use between geom_disk and the device drivers. 2003-02-02 11:59:54 +00:00
Poul-Henning Kamp
806d5cfff0 Eliminate the sc_openmask, ccdopen() and ccdclose() functions, we
can use the flag maintained by geom_disk.c

Having only a strategy method to intialize, don't waste space using
a cdevsw structure to do so.
2003-02-01 11:17:22 +00:00
Poul-Henning Kamp
5f6fb2dde3 Move configuration of geom/providers into its own function in preparation
for adding on-the-fly config interface.
2003-02-01 08:28:43 +00:00
Poul-Henning Kamp
a908904a1e Remove commented out g_enc_dos_partition(). We won't be needing it. 2003-01-31 21:18:41 +00:00
Poul-Henning Kamp
83dde52716 Add a rudimentary class for slicing Apple partitioned disks.
More work is needed on this, stakeholders please contact me.

Not quite asked for by:	rwatson
2003-01-31 16:27:07 +00:00
Poul-Henning Kamp
31a1093fc2 Add some agility to the disk_create() API:
Make passing the methods in a cdevsw structure optional.

Move "CANFREE" and "NOGIANT" flags into struct disk instead of the
cdevsw which may or may not be there.

Rename CANFREE to CANDELETE to match BIO_DELETE operation.

Add "OPEN" flag so drivers don't have to provide open/close methods
just to maintain such a flag.

Add temporary stopgap include of <sys/conf.h> to <sys/disk.h> until
the files which have them in the other order are fixed.

Add KASSERTS to make sure we don't get fed too many NULL pointers.

Clear our geom's softc pointer before we wither.
2003-01-30 20:34:23 +00:00
Poul-Henning Kamp
6e0b29aeca NO_GEOM cleanup: Remove sys/disklabel.h include. 2003-01-30 19:55:19 +00:00
Poul-Henning Kamp
1686ac18f9 NO_GEOM cleanup: retire disk_invalidate() 2003-01-30 19:43:50 +00:00
Poul-Henning Kamp
bf17219d59 NO_GEOM cleanup: Mark the last arg to disk_create() as unused. 2003-01-30 11:39:36 +00:00
Poul-Henning Kamp
5a67919a5e Add code to repsect the D_NOGIANT flag, should the disk device driver set it.
NO_GEOM cleanup:        remove ifdefs.

Still untested.
2003-01-29 19:47:25 +00:00
Poul-Henning Kamp
fc2b90eaab Sort these functions as the author instructed. 2003-01-29 18:37:29 +00:00
Poul-Henning Kamp
c516a05a66 Mark some args unused so this compiles in userland. 2003-01-28 09:48:09 +00:00
Poul-Henning Kamp
e55d9b0bd1 Use a void * to carry the private data for return-call'ed ioctl requests.
Amongst other things this avoids a complex workaround in the userland
regression bits.
2003-01-28 09:47:50 +00:00
Poul-Henning Kamp
7253da9c05 Implement DIOCBSDBB ioctl which overwrites first BBSIZE bytes of BSD
labeled disk.

This is complicated by the fact that BBSIZE is greater than the
PAGE_SIZE limit ioctl inflicts on arguments which are automatically
copied in.

As long as we don't need access to userland memory (copyin/out) we
can deal with the ioctl using g_callme() which executes it from the
GEOM event thread.

Once we need copyin/out, we need to return the bio with EDIRIOCTL
in order to make geom_dev call us back in the original process context
where copyin will work.

Unfortunately, that results in us getting called with Giant, so
we have to DROP_GIANT/PICKUP_GIANT around the code where we diddle
GEOMs internals.

Sometimes you just can't win...

... But it does make geom_bsd.c an almost complete example of the
GEOM beastiarium.
2003-01-26 21:54:36 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Poul-Henning Kamp
c0805171aa disk_dev_synth() is a NO_GEOM hack. 2003-01-20 11:29:07 +00:00
Poul-Henning Kamp
30f5ffb8d9 Remove need for <sys/diskslice.h> but retain numerical compatibilty just in case. 2003-01-20 11:23:00 +00:00
Poul-Henning Kamp
0f76d6d822 Finally give CCD the disk mini-layer treatment:
CAUTION:

        Previously CCD would be different from all other disks in
        the system in that there were no "ccd0" device, only a
        "ccd0c" device.

        This is no longer so after this commit.  If you access a
        ccd device through the "/dev/ccd0c" device _and_ have not
        actually put a BSD disklabel on the device, you will have
        to use the name "/dev/ccd0".  If your CCD device contains
        a BSD disklabel there should be no difference.

        You need to recompile ccdconfig(8) using the changed
        src/sys/sys/ccdvar.h for the -g "show me" option to work.

        I have run the regression test I created before I started
        overhauling CCD and it flags no problems, but this code
        is mildly evil, so take care.  If you would cry if you lost
        what's on CCD, make a back before you upgrade.

Create separate cdevsw for the /dev/ccd.ctl device.

Remove the cloning function, the disk-minilayer will do all naming
for us.

Remove the ccdunit and ccdpart functions and carry the softc pointer
in the relevant dev_t's and structures.

Release all memory when a CCD device is unconfigured, previously
the softc would linger behind.

Remove all traces of BSD disklabel fiddling code.

Remove ccdpsize, the disk mini-layer does this for us.

Don't allocate memory with M_WAITOK in ccdstrategy().

Remove boundary checks which the disk mini-layer does for us.

Don't allocate space for more than 2 ccdbuf, RAID was never implemented.

NB: I have not tried to address any of the preexisting ailments of CCD.
2003-01-19 15:00:58 +00:00
Poul-Henning Kamp
1dccd08a34 Unifdef -UDEBUG on the CCD driver. The debugging is mostly useless
and can be added back selectively, should anybody start to interest
themselves for the internal workings of ccd.

This commit will make the diffs for the following commits much more
readable.
2003-01-19 14:35:38 +00:00
Poul-Henning Kamp
e9fe7d1f7f Inline now trivial functions getccdbuf() and putccdbuf().
Fix another trivial memory-leak.
2003-01-18 12:23:49 +00:00
Poul-Henning Kamp
6b267654ab Fix minor memory-leak. 2003-01-18 11:33:06 +00:00
Poul-Henning Kamp
b51ea35631 Use the M_CCD malloc bucket instead of M_DEVBUF.
Don't keep a private freelist of a low number of trivially small structures.
2003-01-18 11:04:41 +00:00
Poul-Henning Kamp
360d71d1b5 Inline trivial function ccdintr() into its one caller ccdiodone().
Only call ccdfind() once in ccdiodone() and cache the result.
2003-01-18 10:44:17 +00:00
Poul-Henning Kamp
3b1746df8b Sanitize the copyright section a bit: We do not need two copies of the
four-clause BSD license in the file, one will do.
2003-01-18 10:08:27 +00:00
Poul-Henning Kamp
ddbf51af0c Find places to store the previously implicityly passed unit number in
the three configuration ioctls which need a unit number.

Add a "ccd.ctl" device for config operations.

Implement ioctls on ccd.ctl which rely on the explicityly passed
unit numbers.

Update ccdconfig to use the new ccd.ctl interface.

Add code to the kernel to detect old ccdconfig binaries, and whine
about it.

Add code to ccdconfig to detect old kernels, and whine about it.

These two compatibility measures will be retained only for a limited
period since they are in the way of GEOM'ification of ccd.
2003-01-17 14:53:53 +00:00
Poul-Henning Kamp
d2128d818f Add a very simple but functional GEOM mirror class.
This is committed more as an instructive tool than as a production
facility, but this will change over time.
2003-01-14 22:44:48 +00:00
Poul-Henning Kamp
d320fdbca7 Now that we have non-geom_disk based drivers, we need to cover for those,
in case they return EOPNOTSUPP on an ioctl.

Found by:	jhb
2003-01-14 21:31:00 +00:00
Poul-Henning Kamp
4b2f4ce94e Always issue ioctls as BIO_GEATTR requests. The direction of data copies on
ioctls are no reliable indication of the ioctls "set" or "get" nature or if
such simplistic categories can even be applied.

MFC candidate:	boot0cfg issue.
2003-01-13 11:34:35 +00:00
Poul-Henning Kamp
abb50a48e8 Remove g_silence(). It does not do anything anymore. 2003-01-13 08:46:32 +00:00
Poul-Henning Kamp
bf1dae82da Fix typo. 2003-01-13 08:44:03 +00:00
Poul-Henning Kamp
78b9d70000 Don't restrict MBR sectorsize to 512 bytes.
Test data provided by:	Andrey Koklin <aka@veco.ru>
2003-01-11 12:30:51 +00:00
John Baldwin
3a8790a13b Output the fstype of each partition in a disklabel in the configuration
text similar to the way that the MBR module dumps its slice types.
2003-01-10 19:44:14 +00:00
Poul-Henning Kamp
51a5c572a6 BSD disklabels expose the controling label though the 'c' partition, and
some trick is necessary to prevent further BSD geoms from attaching to
that.  Our old trick was to make sure we don't attach to a geom from
the "BSD" class, but this doesn't work if an intermediary geom obscures
this fact.  Instead, calculate the MD5 checksum of the label we target
and ask if anybody below us loves that label.  If they do we don't.

Coded by:       gordon.
2003-01-06 20:10:41 +00:00
Poul-Henning Kamp
72384683ad In userland case include <errno.h>, not <err.h>. This is needed to make
the src/tools/regression/geom stuff compile.
2003-01-06 20:05:45 +00:00
Yoshihiro Takahashi
404a379e4a Rename the dos_partition structure for pc98 to pc98_partition. 2003-01-04 08:50:48 +00:00
Poul-Henning Kamp
f05f44f0f2 Remove CCDF_SWAP and CCDF_PARITY, they have never been implemented. 2003-01-03 08:57:40 +00:00
Yoshihiro Takahashi
05f0a5a323 MFMBR: Add ioctls for writing an IPL and a boot menu. 2003-01-03 07:13:36 +00:00
Poul-Henning Kamp
d616ee081f Remove unused second argument from BIO_STRATEGY() 2003-01-03 05:51:11 +00:00
Poul-Henning Kamp
acb161b16f Optimize the size of the work-items by letting the mapping function
decide the largest size which stays inside the zone and does not
collide with a lock sector.
2003-01-02 19:29:49 +00:00
Poul-Henning Kamp
105df8c3d7 Update si_bsize_phys on open.
MFC candidate.
2003-01-02 09:38:22 +00:00
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +00:00
Poul-Henning Kamp
f8cfa0dbaf Implement ioctls for tampering with sector0. 2002-12-29 14:59:24 +00:00
Poul-Henning Kamp
9693da433c Remove the "ascii" attribute from the sysctls so that "sysctl -a" will
skip them.
2002-12-27 07:58:59 +00:00
Poul-Henning Kamp
5ab413bf6e white-space changes 2002-12-26 21:02:50 +00:00
Poul-Henning Kamp
3ff81a4ca8 Use a mutex assert to document our locking circumstances. 2002-12-26 20:48:22 +00:00
Poul-Henning Kamp
4fbfd368dd We should not need to hold Giant for sbuf operations any more. 2002-12-26 20:46:30 +00:00
Poul-Henning Kamp
cd4b1352fa Add an XXX comment to explain the predicament. 2002-12-26 20:45:37 +00:00
Poul-Henning Kamp
cea573842c Don't forget our topology lock in the MBREXT case. 2002-12-19 12:01:19 +00:00
Poul-Henning Kamp
1e90b74683 Solve another bug in the mapping code: correctly skip lock sectors.
Make sure sector zero is protected if it contains metadata.

Lower WARNS for gbde to 3 on non-i386 archs.  rijndael-fst is evil
but appearntly does the right thing and passes the test-vectors.

MFC Candidate.
2002-12-18 22:11:54 +00:00
Poul-Henning Kamp
88806cc28c Fix two blunders in the mapping functions which can lead to corrupt data,
for request sizes larger than the sectorsize or for multi-key setups.

See warning mailed to current@ for details of recovery.

Found by:	Marcus Reid <marcus@blazingdot.com>
2002-12-18 19:57:27 +00:00
Poul-Henning Kamp
0ae8896ed2 Balk at unaligned requests.
MFC candidate.
2002-12-18 19:53:59 +00:00
Poul-Henning Kamp
9eebd265b9 Add a check for negative offset locations and return EINVAL for them. 2002-12-17 21:31:58 +00:00
Poul-Henning Kamp
dd0879a966 Don't mangle geometry for pc98, this will happen in the ata driver. 2002-12-17 15:50:51 +00:00
Poul-Henning Kamp
50bd488da3 Remember to hold topology lock when we change things.
Spotted by:	kuriyama
2002-12-17 09:44:10 +00:00
Poul-Henning Kamp
2cc40a38a8 Constify the dumpconf() function. 2002-12-17 07:22:48 +00:00
Poul-Henning Kamp
a1d5f791fa Get rid of g_slice_addslice() and use g_slice_config() instead.
Tested with:	i386 + src/tools/regression/geom
2002-12-16 23:08:48 +00:00
Poul-Henning Kamp
0f9d3dba37 Constification and some s/int/u_int/ changes. 2002-12-16 22:33:27 +00:00
Poul-Henning Kamp
cc0163a3c4 Add a couple of KASSERTS, just in case. 2002-12-13 22:04:45 +00:00
Poul-Henning Kamp
821a4d01ea Don't interpret the hotspots relative to all slices on a slicer, but
relative to the parent device.
2002-12-13 21:31:13 +00:00
Poul-Henning Kamp
ef7b370b00 Fix spelling in comment. 2002-12-13 21:10:59 +00:00
Søren Schmidt
8ba4488cea Add support for the PC98 platform to the ATA driver.
This mostly consists of functionality to serialize accesses to
the two ATA channels (which can also be used to "fix" certain
PCI based controllers).
Add support for Acard controllers.
Enable the ATA driver in PC98 GENERIC, and add device hints.
Update man page with latest support.

The PC98 core team has kindly provided me with a PC98
machine that made this all possible, thanks to all that
contributed to that effort, without that this would
probably newer have been possible..

Approved by: re@
2002-12-03 20:20:44 +00:00
Poul-Henning Kamp
00e11500e2 Use the hotspot code to prevent people from overwriting their disklabel
with stuff which would ruin the day for any open parititons.

Approved by:	re
2002-12-02 20:23:54 +00:00
Poul-Henning Kamp
188321b737 Add a simplified version of the hot-spot code to enable us to protect
in-band disklabels from in-band vandalism.

Approve by:	re
2002-12-02 19:59:25 +00:00
Poul-Henning Kamp
c7f74a4931 Use more mnemonic argument names in the access functions.
Sponsored by:	DARPA & NAI Labs
Approved by:	re (blanket)
2002-12-01 15:54:39 +00:00