Commit Graph

90 Commits

Author SHA1 Message Date
pjd
1ee75f4b9c Implement g_topology_try_lock().
No objection from:	phk
2004-12-21 18:32:46 +00:00
phk
7f03fd0a1d Pass the file->flags down to geom ioctl handlers.
Reject certain ioctls if write permission is not indicated.

Bump geom API version.

Reported by:	Ruben de Groot <mail25@bzerk.org>
2004-12-12 10:09:05 +00:00
pjd
b0447d7957 Introduce g_waitidlelock() function which is simlar to g_waitidle(),
but should be called with the topology lock held and returns with the
topology lock held and empty event queue.

Approved by:	phk (sometime ago)
2004-11-09 23:20:50 +00:00
phk
8f4f4f999d Add g_wither_geom_close() function. 2004-10-29 09:19:03 +00:00
phk
bc0b077f82 Move the prototype for g_waitidle() to a more visible place. 2004-10-23 20:22:02 +00:00
phk
5761cd340f Introduce g_alloc_bio() as a waiting variant of g_new_bio().
Use in places where we can sleep and where we previously failed to check
for a NULL pointer.

MT5 candidate.
2004-08-27 14:43:11 +00:00
phk
ad0367b47c Give classes a version number and refuse to touch classes which are not
understood.  This makes room for additional binary compatibility in the
future.

Put fields in the class for the geom's methods and initialize the methods
of a new geom from these fields.  This saves some code in all classes.
2004-08-08 06:46:27 +00:00
phk
500031481b Kill g_access_rel() already now before we send it down 5-stable 2004-06-21 20:31:49 +00:00
phk
70c86a601e Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
phk
23855f4e83 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
phk
1dd409d2a5 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
phk
2153be178c 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
pjd
d6cf40b908 Added g_print_bio() function to print informations about given bio.
Approved by:	phk, scottl (mentor)
2004-02-11 18:21:32 +00:00
pjd
ef4c1cddb3 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
phk
7de0d3f354 KASSERT against multiple orphanings of providers. 2003-12-07 10:04:43 +00:00
scottl
4d0fe8538c Re-arrange and consolidate some random debugging stuff 2003-12-07 05:04:49 +00:00
phk
dd4e48d278 Introduce a per provider wither flag 2003-10-06 09:05:44 +00:00
phk
ec782a9fb4 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
phk
a7bcfa268d Add the new g_dev_getprovider() function, the swap_pager needs it now.
Spotted by:	mr
2003-08-30 18:33:55 +00:00
phk
5e4348cbf7 Improve the root-dev prompt facility for printing devices which could
possibly be a root filesystem.
2003-06-07 15:46:53 +00:00
phk
b956d682a7 Drop a memory-corruption debugging test-tool. 2003-06-07 10:55:48 +00:00
phk
53d3b48367 Introduce g_provider_by_name() function, and use it. 2003-06-04 18:17:52 +00:00
phk
11a350a92d 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
phk
58f002ce85 constify g_sanity() 2003-06-01 13:30:39 +00:00
phk
00f71dae6d 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
phk
fe52944f51 Remove the G_CLASS_INITIALIZER, we do not need it anymore. 2003-05-31 16:59:27 +00:00
phk
484ae48473 Add gctl_set_param() function. 2003-05-04 19:24:34 +00:00
phk
1730ca78f5 Rework the "withering" mechanism:
Introduce g_wither_geom() to do the work in one single place.
2003-05-02 06:15:27 +00:00
phk
de08af3a06 Remove the now obsolete geomidorname hack. 2003-05-01 20:32:24 +00:00
phk
7042a29817 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
phk
9bc462e400 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
phk
dd830ea830 Make gctl_error() take printfline varargs. 2003-04-23 07:50:01 +00:00
phk
634d29cedc Remove unused event pointers in object structures.
Remove KASSERTS which checked that they were unused.
2003-04-23 06:54:44 +00:00
phk
fb1adf6e62 Implement handling of CONFIG_GEOM OAM request. 2003-04-22 21:01:46 +00:00
phk
fc2c7e81b5 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
phk
67333c42ba Remove all references to BIO_SETATTR. We will not be using it. 2003-04-03 19:19:36 +00:00
phk
85870bf643 Remove geom_enc.c, a superset of these functions are now available in
<sys/endian.h>
2003-04-03 11:40:06 +00:00
phk
ba5cde9039 Add handling for cancelled events in the g_call_me() methods. 2003-04-02 21:10:04 +00:00
phk
38741ab7a1 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
phk
88021e91c0 Remove the old config interface, the new OAM is sufficiently functional
now.
2003-04-01 07:33:56 +00:00
phk
621746d152 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
phk
d4ac0e8060 Remove unuse g_insert_geom(). 2003-03-25 09:07:35 +00:00
phk
d62ac2f9bc 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
phk
d05d6b6751 Retire the GEOM private statistics code and use devstat instead. 2003-03-18 09:42:33 +00:00
phk
3bea2a0b26 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
phk
d623bd9b10 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
phk
052bf7ffed Introduce flag field and G_PF_CANDELETE field on providers. 2003-02-11 11:55:40 +00:00
phk
6847c3f4e5 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
phk
6521321db7 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
phk
83f002b25c 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