History log of /freebsd-current/sys/geom/geom_int.h
Revision Date Author Comments
# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 7f16b501 12-Mar-2022 Alexander Motin <mav@FreeBSD.org>

GEOM: Introduce partial confxml API

Traditionally the GEOM's primary channel of information from kernel to
user-space was confxml, fetched by libgeom through kern.geom.confxml
sysctl. It is convenient and informative, representing full state of
GEOM in a single XML document. But problems start to arise on systems
with hundreds of disks, where the full confxml size reaches many
megabytes, taking significant time to first write it and then parse.

This patch introduces alternative solution, allowing to fetch much
smaller XML document, subset of the full confxml, limited to 64KB and
representing only one specified geom and optionally its parents. It
uses existing GEOM control interface, extended with new "getxml" verb.
In case of any error, such as the buffer overflow, it just transparently
falls back to traditional full confxml. This patch uses the new API in
user-space GEOM tools where it is possible.

Reviewed by: imp
MFC after: 2 month
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D34529


# 67c58cd7 29-Jan-2022 Alexander Motin <mav@FreeBSD.org>

GEOM: Remove g_wait_sim.

It seems never been used since addition.


# ffc1cc95 28-Jan-2022 Alexander Motin <mav@FreeBSD.org>

GEOM: Relax direct dispatch for GEOM threads.

The only cases when direct dispatch does not make sense is for I/O
submission from down thread and for completion from up thread. In
all other cases, if both consumer and producer are OK about it, we
can save on context switches.

MFC after: 2 weeks


# c4c88d47 05-Dec-2019 Alexander Motin <mav@FreeBSD.org>

Remove duplicate g_debugflags declaration.

While there, define G_F_FOOTSHOOTING instead of numeric constants.

MFC after: 13 days
X-MFX-with: r355412


# 49ee0fce 19-Jun-2019 Alexander Motin <mav@FreeBSD.org>

Use sbuf_cat() in GEOM confxml generation.

When it comes to megabytes of text, difference between sbuf_printf() and
sbuf_cat() becomes substantial.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.


# 3728855a 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/geom: adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 7ae1a87b 27-Nov-2013 Alexander Motin <mav@FreeBSD.org>

Escape special XML chars, returned by some devices, confusing XML parsers.

MFC after: 1 month


# 40ea77a0 22-Oct-2013 Alexander Motin <mav@FreeBSD.org>

Merge GEOM direct dispatch changes from the projects/camlock branch.

When safety requirements are met, it allows to avoid passing I/O requests
to GEOM g_up/g_down thread, executing them directly in the caller context.
That allows to avoid CPU bottlenecks in g_up/g_down threads, plus avoid
several context switches per I/O.

The defined now safety requirements are:
- caller should not hold any locks and should be reenterable;
- callee should not depend on GEOM dual-threaded concurency semantics;
- on the way down, if request is unmapped while callee doesn't support it,
the context should be sleepable;
- kernel thread stack usage should be below 50%.

To keep compatibility with GEOM classes not meeting above requirements
new provider and consumer flags added:
- G_CF_DIRECT_SEND -- consumer code meets caller requirements (request);
- G_CF_DIRECT_RECEIVE -- consumer code meets callee requirements (done);
- G_PF_DIRECT_SEND -- provider code meets caller requirements (done);
- G_PF_DIRECT_RECEIVE -- provider code meets callee requirements (request).
Capable GEOM class can set them, allowing direct dispatch in cases where
it is safe. If any of requirements are not met, request is queued to
g_up or g_down thread same as before.

Such GEOM classes were reviewed and updated to support direct dispatch:
CONCAT, DEV, DISK, GATE, MD, MIRROR, MULTIPATH, NOP, PART, RAID, STRIPE,
VFS, ZERO, ZFS::VDEV, ZFS::ZVOL, all classes based on g_slice KPI (LABEL,
MAP, FLASHMAP, etc).

To declare direct completion capability disk(9) KPI got new flag equivalent
to G_PF_DIRECT_SEND -- DISKFLAG_DIRECT_COMPLETION. da(4) and ada(4) disk
drivers got it set now thanks to earlier CAM locking work.

This change more then twice increases peak block storage performance on
systems with manu CPUs, together with earlier CAM locking changes reaching
more then 1 million IOPS (512 byte raw reads from 16 SATA SSDs on 4 HBAs to
256 user-level threads).

Sponsored by: iXsystems, Inc.
MFC after: 2 months


# 1b2cb2b3 24-Sep-2013 Dag-Erling Smørgrav <des@FreeBSD.org>

Introduce a kern.geom.notaste sysctl that can be used to temporarily
disable GEOM tasting to avoid the "bouncing GEOM" problem where, when
you shut down the consumer of a provider which can be viewed in multiple
ways (typically a mirror whose members are labeled partitions), GEOM
will immediately taste that provider's alter ego and reattach the
consumer.

Approved by: re (glebius)


# 50199fa0 23-Mar-2013 Alexander Motin <mav@FreeBSD.org>

Make g_wither_washer() to not loop by itself, but only when there was some
more topology change done that may require its attention. Add few missing
g_do_wither() calls in respective places to signal it.

This fixes potential infinite loop here when some provider is withered, but
still opened or connected for some reason and so can not be destroyed. For
example, see r227009 and r227510.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 8c24ef5f 24-Oct-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Use unit number allocation functions for GEOM minor numbers.


# 1b464bd8 08-Jul-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Make withering water tight.

When we orphan/wither a provider, an attached geom+consumer could
end up being withered as a result and it may be in front of us in
the normal object scanning order so we need to do multi-pass. On
the other hand, there may be withering stuff we can't get rid off
(yet), so we need to keep track of both the existence of withering
stuff and if there is more we can do at this time.


# 3d1d5bc3 10-Mar-2004 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# a974614b 23-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

More of the event stuff can now be private to geom_event.c


# 8cd1535a 23-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Rename g_call_me() to g_post_event(), and give it a flag
argument to determine if we can M_WAITOK in malloc.


# d98777f8 23-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Remove the now unused hardcoded g_post_event() event support.


# 9ab3ea78 23-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Turn EV_NEW_PROVIDER into a g_call_me() event.


# f2e9a094 23-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Convert EV_SPOILED event to use g_call_me().


# 9972896c 23-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Turn the hardwired NEW_CLASS event into a g_call_me() event.


# b5cba416 23-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Move the shutdown eventhandler stuff to a more logical place.


# 316aed03 02-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Add handling for cancelled events in the g_call_me() methods.


# afcbcfae 02-Apr-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# afa2a5aa 31-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# d49d7ca5 24-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# dddc28bf 23-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Introduce g_cancel_events() and use it a couple of places where it makes
sense.


# d943f1b0 23-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Introduce an SX lock which allows us to stall event processing
during OAM operations.


# 7da1ebfd 21-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Mitigate deadlock situation pending a more complete solution.


# e24cbd90 18-Mar-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Retire the GEOM private statistics code and use devstat instead.


# 8ebd558f 12-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 4ec35300 08-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 91cd3dc6 07-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Move #defines of major/minor to internal header file so other bits can
share and coordinate with geom_dev.


# 801bb689 07-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# d518e539 28-Oct-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Add the remaning part of the new libdisk interaction.

WARNING: This is not a published interface, it is a stopgap measure for
WARNING: libdisk so we can get 5.0-R out of the door.

Sponsored by: DARPA & NAI Labs


# 2874f1cf 04-Oct-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Properly isolate the locking domains of sysctl from the topology lock
for the sysctls which report the configuration.

Sponsored by: DARPA & NAI Labs.


# 5dcf28b2 30-Sep-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Disable the g_sanity() check unless people ask for it in the debugflags.

Sponsored by: DARPA & NAI Labs.


# 4ae67700 28-Sep-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Style, whitespace and lint fixes.

Sponsored by: DARPA & NAI Labs.


# 346cd5fe 27-Sep-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Implement g_call_me() as a way for geom methods to schedule operations
to be performed in the event-thread.

To do this, we need to lock the eventlist with g_eventlock (nee g_doorlock),
since g_call_me() being called from the UP/DOWN paths will not be able to
aquire g_topology_lock.

This also means that for now these events are not referenced on any
particular consumer/provider/geom.

For UP/DOWN path use, this will not become a problem since the access()
function will make sure we drain any bio's before we dismantle.

Sponsored by: DARPA & NAI Labs.


# 2654e1fc 04-Apr-2002 Poul-Henning Kamp <phk@FreeBSD.org>

s/classs/classes/ to fixup grammer after the previous global renaming.

Sponsored by: DARPA & NAI Labs


# b1876192 26-Mar-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Eliminate some thread pointers which do not make sense anymore.

Split private parts of geom.h into geom_int.h. The latter should
never be included in class implemtations.