Commit Graph

62 Commits

Author SHA1 Message Date
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
3bae8877f4 Remove unused variables.
Found by:       FlexeLint
2003-05-31 19:40:43 +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
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
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
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
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
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
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
564632b081 Remove unneeded #include of geom_stats.h 2003-03-09 10:04:21 +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
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
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +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
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
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
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
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
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
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
105df8c3d7 Update si_bsize_phys on open.
MFC candidate.
2003-01-02 09:38:22 +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
cc0163a3c4 Add a couple of KASSERTS, just in case. 2002-12-13 22:04:45 +00:00
Poul-Henning Kamp
b630d83f28 Add KASSERT for bio_cmd validity here as well. Various hacks still
bypass specfs.
2002-11-01 15:56:26 +00:00
Poul-Henning Kamp
ce225127b9 Add a g_dev_print() function which prints all the /dev entries GEOM
know about.
2002-10-25 18:42:42 +00:00
Poul-Henning Kamp
c03bf4f225 Loose the g_dev_clone() noise. 2002-10-25 17:00:15 +00:00
Poul-Henning Kamp
3f12caa180 Now that the sectorsize and mediasize are properties of the provider,
don't take the detour over the I/O path to discover them using getattr(),
we can just pick them out directly.

Do note though, that for now they are only valid after the first open
of the underlying disk device due compatibility with the old disk_create()
API.  This will change in the future so they will always be valid.

Sponsored by:   DARPA & NAI Labs.
2002-10-20 20:28:24 +00:00
Poul-Henning Kamp
14ac6812b9 Use %jd instead of %lld now that we have it. 2002-10-20 18:48:12 +00:00
Thomas Moestl
2408cfebf9 The argument to the DIOCGMEDIASIZE ioctl() is an off_t, not an u_int.
Reviewed by:	phk
2002-10-19 15:40:39 +00:00
Nate Lawson
02fcfac0ad Return an error if the drive reports heads/sectors that do not make sense.
This fixes a divide by zero in fdisk(8)

Reviewed by:	phk
2002-10-15 21:28:50 +00:00
Poul-Henning Kamp
adfa3213c7 Copyin and copyout are only possible from a process-native thread,
and therefore we need a way for ioctl handlers to run in that thread
in GEOM.  Rather than invent a complicated registration system to
recognize which ioctl handler to use for a given ioctl, we still
schedule all ioctls down the tree as bio transactions but add a
special return code that means "call me directly" and have the
geom_dev layer do that.

Use this for all ioctls that make it as far as a diskdriver to
avoid any backwards compatibility problems.

Requested by:   scottl
Sponsored by:   DARPA & NAI Labs
2002-10-07 06:25:26 +00:00
Poul-Henning Kamp
2874f1cf36 Properly isolate the locking domains of sysctl from the topology lock
for the sysctls which report the configuration.

Sponsored by:	DARPA & NAI Labs.
2002-10-04 10:38:36 +00:00
Poul-Henning Kamp
a4319fd03d Put some failing ioctl related printfs under a suitable debug flag.
Sponsored by:	DARPA & NAI Labs.
2002-10-02 07:48:39 +00:00
Poul-Henning Kamp
0a2ece0481 Use the canonical root:operator 0640 for GEOM disk devices.
Spotted by:	brooks
Sponsored by:	DARPA & NAI Labs.
2002-10-01 19:33:09 +00:00
Poul-Henning Kamp
4ae677009e Style, whitespace and lint fixes.
Sponsored by:	DARPA & NAI Labs.
2002-09-28 11:57:20 +00:00
Poul-Henning Kamp
9169e8004d Various no-ops:
Add a __unused.

Make the 2byte decoder functions return 16 bits for the benefits
of picky lints.

No need to grab giant around a tsleep() when we have a timeout.

Sponsored by:	DARPA & NAI Labs.
2002-09-27 21:05:05 +00:00
Poul-Henning Kamp
46714777f5 Retire now unused DIOCGDVIRGIN kludge.
Sponsored by:	DARPA & NAI Labs.
2002-09-20 09:31:14 +00:00
Poul-Henning Kamp
02945fefb7 Don't respect the O_EXCL flag, we don't get it back on close so we cannot
correctly track it.

Spotted by:	peter
Sponsored by:	DARPA & NAI Labs.
2002-09-06 07:57:29 +00:00
Poul-Henning Kamp
503abe4540 Improve some on the naming.
Submitted by:	iedowse
2002-06-09 10:57:34 +00:00
Poul-Henning Kamp
3abe4a80a5 Remove the "-class" suffix from classes, they will not be ambiguous.
Sponsored by:	DARPA & NAI Labs.
2002-05-21 19:50:04 +00:00
Poul-Henning Kamp
4b8374a778 Don't grab Giant around malloc(9) and free(9).
Don't grab Giant around wakeup(9).
Don't print verbose messages about each device found in geom_dev.
Various cleanups.

Sponsored by: DARPA & NAI Labs.
2002-05-20 10:03:15 +00:00
Poul-Henning Kamp
53705e35ae Implement the GEOMGETCONF ioctl which returns vital stats for the
current device in XML in an sbuf.

Sponsored by:	DARPA & NAI Labs
2002-04-23 19:54:02 +00:00
Poul-Henning Kamp
95c24b31df Make kernel dumps work with GEOM.
Notice that if the device on which the dump is set is destroyed for
any reason, the dump setting is lost.  This in particular will
happen in the case of spoilage.  For instance if you set dump on
ad0s1b and open ad0 for writing, ad0s* will be spoilt and the dump
setting lost.  See geom(4) for more about spoiling.

Sponsored by: DARPA & NAI Labs.
2002-04-19 09:24:12 +00:00