Commit Graph

482 Commits

Author SHA1 Message Date
phk
cbe207a30e Remove all references to BIO_SETATTR. We will not be using it. 2003-04-03 19:19:36 +00:00
phk
aba0028d27 Update the initializer for GEOM_MBREXT, I overlooked it previously. 2003-04-03 19:05:03 +00:00
phk
3288c86f74 Add #define for DOSPTYP_PMBR, and use it. 2003-04-03 18:55:16 +00:00
phk
9e2f75eb24 #include <sys/endian.h> as needed. 2003-04-03 11:56:10 +00:00
phk
f14c63f8a8 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
25c7685ca9 Use <sys/endian.h> instead of geom_enc.c for endianess-agnostification. 2003-04-03 11:36:53 +00:00
phk
34a3abe946 Use sys/endian.h instead of geom_enc.c for endian-agnostfication. 2003-04-03 11:33:51 +00:00
phk
7d796a935a Make sure we don't ignore error codes. 2003-04-03 11:19:24 +00:00
phk
39cbb43bab Add handling for cancelled events in the g_call_me() methods. 2003-04-02 21:10:04 +00:00
phk
cedf04c475 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
a47b0e4a84 Only orphan things if the open/close actually succeeded. 2003-04-02 13:10:40 +00:00
phk
3cfb76c317 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
phk
af778aa48a Include <geom/geom_disk.h> not <sys/disk.h> 2003-04-01 18:57:14 +00:00
phk
c235e25328 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
phk
8be523e927 Start to split the GEOM/diskdriver specific bits into geom/geom_disk.h 2003-04-01 13:19:14 +00:00
phk
80780d2ba2 Remove the old config interface, the new OAM is sufficiently functional
now.
2003-04-01 07:33:56 +00:00
phk
85edc96041 Remove the old config interface now that the new OAM is functional. 2003-04-01 07:33:17 +00:00
phk
5b75c05966 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
phk
15c9ea202d 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
phk
cdc67e7072 Add create_geom and destroy_geom methods. 2003-03-29 22:14:21 +00:00
phk
2d56ed957a 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
5447a01760 Check return value of g_call_me() 2003-03-27 14:32:52 +00:00
phk
192c308033 g_class_by_name() was unused too. 2003-03-25 09:11:17 +00:00
phk
45e43ab0e8 Remove unuse g_insert_geom(). 2003-03-25 09:07:35 +00:00
phk
87ed6d02e4 Forward compatibility: NULL check the passed in meta argument. 2003-03-25 09:02:41 +00:00
phk
639a37daa0 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
063b352331 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
phk
dc9d8429c2 Save a lock: Grab the stall_events SX lock exclusively so it also serialize
OAM reqests.
2003-03-24 13:35:06 +00:00
phk
8e76f1cefa Introduce g_cancel_events() and use it a couple of places where it makes
sense.
2003-03-23 23:01:40 +00:00
phk
3e8d794231 Introduce an SX lock which allows us to stall event processing
during OAM operations.
2003-03-23 21:58:09 +00:00
phk
0e60b8dd4b I forgot the evil ioctl census scripts: #include <geom/geom_ctl.h> 2003-03-23 11:05:44 +00:00
phk
35c6fd6e4d Marshalling stuff for OAM API. 2003-03-23 10:16:14 +00:00
phk
e6351bec2e A note about which #include files may be used where. 2003-03-23 10:08:13 +00:00
phk
3413b5f1fe Start leaking the AOM api into the tree. 2003-03-23 10:07:44 +00:00
phk
9dd05c47c0 Mitigate deadlock situation pending a more complete solution. 2003-03-21 22:05:33 +00:00
phk
abd9cc6d2b Retire the GEOM private statistics code and use devstat instead. 2003-03-18 09:42:33 +00:00
phk
e059b79437 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
phk
127bfb5486 #ifdef notyet a bit of code which needs not yet committed refcounting to
work correctly.
2003-03-16 16:29:04 +00:00
phk
0e540e1b29 Use devstat_{start,end}_transaction_bio().
Remember to set bio_resid correctly first.
2003-03-15 10:49:26 +00:00
phk
29e1315705 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
phk
35dab36ffa Fix yet another fallout of our M_* song and dance. 2003-03-10 23:34:12 +00:00
phk
c4bc634fce Remove unneeded #include of geom_stats.h 2003-03-09 10:04:21 +00:00
phk
8da8aa2622 Stamp out Danglish. 2003-03-09 10:02:31 +00:00
phk
418634ed06 Don't use statistics counters to detect outstanding I/O. 2003-03-09 10:01:16 +00:00
phk
d2601e2480 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
phk
b00bfcca9b 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
cdacd28664 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
phk
b454fc547a Allocate devstat structure with devstat_new_entry(). 2003-03-08 20:00:11 +00:00
phk
e01fc931cf 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
phk
6471cae560 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
phk
21654c3b17 Initialize the second buffer for mirroring to point to itself and not its
partner.
2003-03-04 10:15:19 +00:00
phk
0ae911eb0e 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
phk
2fb7245efc NO_GEOM cleanup:
Remove cdevsw->d_psize() implementation, we don't need it any more.
2003-03-02 14:42:01 +00:00
phk
e8ab4a65e4 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
mux
541937cf73 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
grehan
c2c6624864 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
phk
8f9640b59b 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
phk
02e550fabb 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
phk
9aa946589d 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
phk
05d8d6e23f Add M_WAITOK 2003-02-19 22:51:33 +00:00
imp
cf874b345d Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
tegge
4d5cb6df0d Correctly set bio_data in cloned children when cutting up large requests. 2003-02-12 16:30:46 +00:00
phk
ba1e23916c 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
phk
8bf75a2e40 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
phk
b098c0b196 Announce our ability to do MAXPHYS transfers. 2003-02-11 21:29:53 +00:00
phk
ef9a1b8601 Advertise MAXPHYS upwards, we will split as necessary before we get to the
bottom of things.
2003-02-11 21:24:25 +00:00
phk
9b781d6129 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
phk
9c7fdcb565 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
phk
75f224dcec Don't divide by zero if there is no stripewidth specified. 2003-02-11 15:23:41 +00:00
phk
dc511a8940 Typo in last commit. 2003-02-11 15:20:34 +00:00
phk
fd7ea6d48a 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
b2fb118970 Propagate DISKFLAG_CANDELETE from struct disk to G_PF_CANDELETE on the
provider.
2003-02-11 14:12:06 +00:00
phk
8405552698 Wrap a long line. 2003-02-11 14:09:48 +00:00
phk
064989983a Don't short-circuit zero-length requests of they are BIO_[SG]ETATTR. 2003-02-11 13:13:10 +00:00
phk
ab4aed671a 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
phk
a61961945a Unconditionally make our provider with G_PF_CANDELETE. 2003-02-11 12:37:04 +00:00
phk
18e25b25db Propagate G_PF_CANDELETE to our own providers from the provider we attach to. 2003-02-11 12:36:33 +00:00
phk
41af143abe Introduce flag field and G_PF_CANDELETE field on providers. 2003-02-11 11:55:40 +00:00
phk
47f258f8be Remove another printf which does not say anything we didn't already know. 2003-02-11 11:02:27 +00:00
phk
89a4ec072e 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
phk
1ce699ee2a Remove a debugging printf. 2003-02-11 10:59:43 +00:00
phk
ee425616b7 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
phk
384af30f63 Put the name of the /dev entry in the .h file, userland will need it. 2003-02-08 14:50:27 +00:00
phk
04a4ba381f 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
15f4f6a52b 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
phk
e8f2dea5dd 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
329bf7c30c Fix some sleep strings to make more sense. 2003-02-07 21:53:55 +00:00
phk
7a3625aca3 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
phk
0d87d64253 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
56209777d7 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
phk
63f412ef74 Check return value of g_clone_bio(). 2003-02-06 22:00:47 +00:00
phk
84f57209a4 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
phk
ef9c55f6aa 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
phk
82db7fddb8 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
phk
9d6d3f1673 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
8329fa8951 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
7ec55e9926 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
phk
53aec1a3a4 Add a bio_disk pointer for use between geom_disk and the device drivers. 2003-02-02 11:59:54 +00:00
phk
f9d517f0ed 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
phk
cfd92eb694 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