GEOM: Reduce unnecessary log interleaving with sbufs

Similar to what was done for device_printfs in r347229.

Convert g_print_bio() to a thin shim around g_format_bio(), which acts on an
sbuf; documented in g_bio.9.

Reviewed by:	markj
Discussed with:	rlibby
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D21165
This commit is contained in:
Conrad Meyer 2019-08-07 19:28:35 +00:00
parent 76cb1112da
commit ac03832ef3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=350694
73 changed files with 279 additions and 368 deletions

View File

@ -1004,6 +1004,7 @@ MLINKS+=g_bio.9 g_alloc_bio.9 \
g_bio.9 g_clone_bio.9 \
g_bio.9 g_destroy_bio.9 \
g_bio.9 g_duplicate_bio.9 \
g_bio.9 g_format_bio.9 \
g_bio.9 g_new_bio.9 \
g_bio.9 g_print_bio.9 \
g_bio.9 g_reset_bio.9

View File

@ -24,13 +24,14 @@
.\"
.\" $FreeBSD$
.\"
.Dd Mar 7, 2018
.Dd August 7, 2019
.Dt G_BIO 9
.Os
.Sh NAME
.Nm g_new_bio ,
.Nm g_clone_bio ,
.Nm g_destroy_bio ,
.Nm g_format_bio ,
.Nm g_print_bio ,
.Nm g_reset_bio
.Nd "GEOM bio controlling functions"
@ -48,7 +49,12 @@
.Ft void
.Fn g_destroy_bio "struct bio *bp"
.Ft void
.Fn g_print_bio "struct bio *bp"
.Fn g_format_bio "struct sbuf *sb" "const struct bio *bp"
.Ft void
.Fo g_print_bio
.Fa "struct sbuf *sb" "const char *prefix" "const struct bio *bp"
.Fa "const char *fmtsuffix" ...
.Fc
.Ft void
.Fn g_reset_bio "struct bio *bp"
.Sh DESCRIPTION
@ -204,10 +210,28 @@ function deallocates and destroys the given
structure.
.Pp
The
.Fn g_print_bio
.Fn g_format_bio
function prints information about the given
.Vt bio
structure (for debugging purposes).
structure into the provided
.Vt sbuf .
.Pp
The
.Fn g_print_bio
function is a convenience wrapper around
.Fn g_format_bio
that can be used for debugging purposes.
It prints a provided
.Fa prefix
string, followed by the formatted
.Vt bio ,
followed by a
.Fa fmtsuffix
in the style of
.Xr 9 printf .
Any of the prefix or suffix strings may be the empty string.
.Fn g_print_bio
always prints a newline character at the end of the line.
.Pp
The
.Fn g_reset_bio
@ -261,9 +285,7 @@ example_start(struct bio *bp)
struct example_softc *sc;
struct bio *cbp;
printf("Request received: ");
g_print_bio(bp);
printf("\\n");
g_print_bio("Request received: ", bp, "");
sc = bp->bio_to->geom->softc;
if (sc == NULL) {

View File

@ -1160,10 +1160,8 @@ fdc_thread(void *arg)
mtx_unlock(&fdc->fdc_mtx);
i = fdc_worker(fdc);
if (i && debugflags & 0x20) {
if (fdc->bp != NULL) {
g_print_bio(fdc->bp);
printf("\n");
}
if (fdc->bp != NULL)
g_print_bio("", fdc->bp, "");
printf("Retry line %d\n", retry_line);
}
fdc->retry += i;

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/cache/g_cache.h>
FEATURE(geom_cache, "GEOM cache module");

View File

@ -41,25 +41,10 @@
#define G_CACHE_TYPE_MANUAL 0
#define G_CACHE_TYPE_AUTOMATIC 1
#define G_CACHE_DEBUG(lvl, ...) do { \
if (g_cache_debug >= (lvl)) { \
printf("GEOM_CACHE"); \
if (g_cache_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_CACHE_LOGREQ(bp, ...) do { \
if (g_cache_debug >= 2) { \
printf("GEOM_CACHE[2]: "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_CACHE_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_CACHE", g_cache_debug, (lvl), NULL, __VA_ARGS__)
#define G_CACHE_LOGREQ(bp, ...) \
_GEOM_DEBUG("GEOM_CACHE", g_cache_debug, 2, (bp), __VA_ARGS__)
#define G_CACHE_BUCKETS (1 << 3)
#define G_CACHE_BUCKET(bno) ((bno) & (G_CACHE_BUCKETS - 1))

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/concat/g_concat.h>
FEATURE(geom_concat, "GEOM concatenation support");

View File

@ -49,25 +49,10 @@
#define G_CONCAT_TYPE_MANUAL 0
#define G_CONCAT_TYPE_AUTOMATIC 1
#define G_CONCAT_DEBUG(lvl, ...) do { \
if (g_concat_debug >= (lvl)) { \
printf("GEOM_CONCAT"); \
if (g_concat_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_CONCAT_LOGREQ(bp, ...) do { \
if (g_concat_debug >= 2) { \
printf("GEOM_CONCAT[2]: "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_CONCAT_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_CONCAT", g_concat_debug, (lvl), NULL, __VA_ARGS__)
#define G_CONCAT_LOGREQ(bp, ...) \
_GEOM_DEBUG("GEOM_CONCAT", g_concat_debug, 2, (bp), __VA_ARGS__)
struct g_concat_disk {
struct g_consumer *d_consumer;

View File

@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/eli/g_eli.h>
#include <geom/eli/pkcs5v2.h>

View File

@ -155,28 +155,10 @@ extern int g_eli_debug;
extern u_int g_eli_overwrites;
extern u_int g_eli_batch;
#define G_ELI_DEBUG(lvl, ...) do { \
if (g_eli_debug >= (lvl)) { \
printf("GEOM_ELI"); \
if (g_eli_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_ELI_LOGREQ(lvl, bp, ...) do { \
if (g_eli_debug >= (lvl)) { \
printf("GEOM_ELI"); \
if (g_eli_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_ELI_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_ELI", g_eli_debug, (lvl), NULL, __VA_ARGS__)
#define G_ELI_LOGREQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_ELI", g_eli_debug, (lvl), (bp), __VA_ARGS__)
struct g_eli_worker {
struct g_eli_softc *w_softc;

View File

@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/eli/g_eli.h>

View File

@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/eli/g_eli.h>
#include <geom/eli/pkcs5v2.h>

View File

@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/eli/g_eli.h>
#include <geom/eli/pkcs5v2.h>

View File

@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <machine/atomic.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/gate/g_gate.h>
FEATURE(geom_gate, "GEOM Gate module");

View File

@ -103,28 +103,10 @@ struct g_gate_softc {
char sc_info[G_GATE_INFOSIZE]; /* P: (read-only) */
};
#define G_GATE_DEBUG(lvl, ...) do { \
if (g_gate_debug >= (lvl)) { \
printf("GEOM_GATE"); \
if (g_gate_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_GATE_LOGREQ(lvl, bp, ...) do { \
if (g_gate_debug >= (lvl)) { \
printf("GEOM_GATE"); \
if (g_gate_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_GATE_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_GATE", g_gate_debug, (lvl), NULL, __VA_ARGS__)
#define G_GATE_LOGREQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_GATE", g_gate_debug, (lvl), (bp), __VA_ARGS__)
#endif /* !_KERNEL */
struct g_gate_ctl_create {

View File

@ -345,7 +345,8 @@ void g_reset_bio(struct bio *);
void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error);
int g_write_data(struct g_consumer *cp, off_t offset, void *ptr, off_t length);
int g_delete_data(struct g_consumer *cp, off_t offset, off_t length);
void g_print_bio(struct bio *bp);
void g_format_bio(struct sbuf *, const struct bio *bp);
void g_print_bio(const char *prefix, const struct bio *bp, const char *fmtsuffix, ...) __printflike(3, 4);
int g_use_g_read_data(void *, off_t, void **, int);
int g_use_g_write_data(void *, off_t, void *, int);

49
sys/geom/geom_dbg.h Normal file
View File

@ -0,0 +1,49 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2019 Conrad Meyer <cem@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#pragma once
#ifdef _KERNEL
#define _GEOM_DEBUG(classname, ctrlvar, loglvl, biop, formatstr, ...) \
do { \
const int __control = (ctrlvar); \
const int __level = (loglvl); \
\
if (__control < __level) \
break; \
\
g_dbg_printf((classname), (__control > 0) ? __level : -1, \
(biop), ": " formatstr, ## __VA_ARGS__); \
} while (0)
void g_dbg_printf(const char *classname, int lvl, struct bio *bp,
const char *format, ...) __printflike(4, 5);
#endif /* _KERNEL */

View File

@ -49,9 +49,11 @@ __FBSDID("$FreeBSD$");
#include <sys/bio.h>
#include <sys/ktr.h>
#include <sys/proc.h>
#include <sys/sbuf.h>
#include <sys/stack.h>
#include <sys/sysctl.h>
#include <sys/vmem.h>
#include <machine/stdarg.h>
#include <sys/errno.h>
#include <geom/geom.h>
@ -1029,7 +1031,36 @@ g_delete_data(struct g_consumer *cp, off_t offset, off_t length)
}
void
g_print_bio(struct bio *bp)
g_print_bio(const char *prefix, const struct bio *bp, const char *fmtsuffix,
...)
{
#ifndef PRINTF_BUFR_SIZE
#define PRINTF_BUFR_SIZE 64
#endif
char bufr[PRINTF_BUFR_SIZE];
struct sbuf sb, *sbp __unused;
va_list ap;
sbp = sbuf_new(&sb, bufr, sizeof(bufr), SBUF_FIXEDLEN);
KASSERT(sbp != NULL, ("sbuf_new misused?"));
sbuf_set_drain(&sb, sbuf_printf_drain, NULL);
sbuf_cat(&sb, prefix);
g_format_bio(&sb, bp);
va_start(ap, fmtsuffix);
sbuf_vprintf(&sb, fmtsuffix, ap);
va_end(ap);
sbuf_nl_terminate(&sb);
sbuf_finish(&sb);
sbuf_delete(&sb);
}
void
g_format_bio(struct sbuf *sb, const struct bio *bp)
{
const char *pname, *cmd = NULL;
@ -1041,11 +1072,12 @@ g_print_bio(struct bio *bp)
switch (bp->bio_cmd) {
case BIO_GETATTR:
cmd = "GETATTR";
printf("%s[%s(attr=%s)]", pname, cmd, bp->bio_attribute);
sbuf_printf(sb, "%s[%s(attr=%s)]", pname, cmd,
bp->bio_attribute);
return;
case BIO_FLUSH:
cmd = "FLUSH";
printf("%s[%s]", pname, cmd);
sbuf_printf(sb, "%s[%s]", pname, cmd);
return;
case BIO_ZONE: {
char *subcmd = NULL;
@ -1073,7 +1105,7 @@ g_print_bio(struct bio *bp)
subcmd = "UNKNOWN";
break;
}
printf("%s[%s,%s]", pname, cmd, subcmd);
sbuf_printf(sb, "%s[%s,%s]", pname, cmd, subcmd);
return;
}
case BIO_READ:
@ -1087,9 +1119,9 @@ g_print_bio(struct bio *bp)
break;
default:
cmd = "UNKNOWN";
printf("%s[%s()]", pname, cmd);
sbuf_printf(sb, "%s[%s()]", pname, cmd);
return;
}
printf("%s[%s(offset=%jd, length=%jd)]", pname, cmd,
sbuf_printf(sb, "%s[%s(offset=%jd, length=%jd)]", pname, cmd,
(intmax_t)bp->bio_offset, (intmax_t)bp->bio_length);
}

View File

@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <sys/errno.h>
#include <sys/sbuf.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/geom_int.h>
#include <machine/stdarg.h>
@ -77,6 +78,44 @@ struct g_hh00 {
int post;
};
void
g_dbg_printf(const char *classname, int lvl, struct bio *bp,
const char *format,
...)
{
#ifndef PRINTF_BUFR_SIZE
#define PRINTF_BUFR_SIZE 64
#endif
char bufr[PRINTF_BUFR_SIZE];
struct sbuf sb, *sbp __unused;
va_list ap;
sbp = sbuf_new(&sb, bufr, sizeof(bufr), SBUF_FIXEDLEN);
KASSERT(sbp != NULL, ("sbuf_new misused?"));
sbuf_set_drain(&sb, sbuf_printf_drain, NULL);
sbuf_cat(&sb, classname);
if (lvl >= 0)
sbuf_printf(&sb, "[%d]", lvl);
va_start(ap, format);
sbuf_vprintf(&sb, format, ap);
va_end(ap);
if (bp != NULL) {
sbuf_putc(&sb, ' ');
g_format_bio(&sb, bp);
}
/* Terminate the debug line with a single '\n'. */
sbuf_nl_terminate(&sb);
/* Flush line to printf. */
sbuf_finish(&sb);
sbuf_delete(&sb);
}
/*
* This event offers a new class a chance to taste all preexisting providers.
*/

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/sbuf.h>
#include <sys/vnode.h>
#include <sys/mount.h>
@ -138,11 +139,9 @@ g_vfs_done(struct bio *bip)
cp = bip->bio_from;
sc = cp->geom->softc;
if (bip->bio_error) {
printf("g_vfs_done():");
g_print_bio(bip);
printf("error = %d\n", bip->bio_error);
}
if (bip->bio_error)
g_print_bio("g_vfs_done():", bip, "error = %d",
bip->bio_error);
bp->b_error = bip->bio_error;
bp->b_ioflags = bip->bio_flags;
if (bip->bio_error)

View File

@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/vm_kern.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/journal/g_journal.h>

View File

@ -49,28 +49,10 @@
#ifdef _KERNEL
extern int g_journal_debug;
#define GJ_DEBUG(lvl, ...) do { \
if (g_journal_debug >= (lvl)) { \
printf("GEOM_JOURNAL"); \
if (g_journal_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define GJ_LOGREQ(lvl, bp, ...) do { \
if (g_journal_debug >= (lvl)) { \
printf("GEOM_JOURNAL"); \
if (g_journal_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define GJ_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_JOURNAL", g_journal_debug, (lvl), NULL, __VA_ARGS__)
#define GJ_LOGREQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_JOURNAL", g_journal_debug, (lvl), (bp), __VA_ARGS__)
#define JEMPTY(sc) ((sc)->sc_journal_offset - \
(sc)->sc_jprovider->sectorsize == \

View File

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <ufs/ffs/ffs_extern.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/journal/g_journal.h>
static int

View File

@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
#include <sys/stddef.h>
#include <sys/sysctl.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/geom_slice.h>
#include <geom/label/g_label.h>

View File

@ -50,16 +50,8 @@
#ifdef _KERNEL
extern u_int g_label_debug;
#define G_LABEL_DEBUG(lvl, ...) do { \
if (g_label_debug >= (lvl)) { \
printf("GEOM_LABEL"); \
if (g_label_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_LABEL_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_LABEL", g_label_debug, (lvl), NULL, __VA_ARGS__)
SYSCTL_DECL(_kern_geom_label);

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/label/g_label.h>
#define EXT2FS_SB_OFFSET 1024

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/label/g_label.h>
#define G_LABEL_ISO9660_DIR "iso9660"

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/label/g_label.h>
#include <geom/label/g_label_msdosfs.h>

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/label/g_label.h>
#define REISERFS_NEW_DISK_OFFSET 64 * 1024

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <ufs/ffs/ffs_extern.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/label/g_label.h>
#define G_LABEL_UFS_VOLUME_DIR "ufs"

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <sys/endian.h>
#include <geom/linux_lvm/g_linux_lvm.h>

View File

@ -28,16 +28,8 @@
* $FreeBSD$
*/
#define G_LLVM_DEBUG(lvl, ...) do { \
if (g_llvm_debug >= (lvl)) { \
printf("GEOM_LINUX_LVM"); \
if (g_llvm_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_LLVM_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_LINUX_LVM", g_llvm_debug, (lvl), NULL, __VA_ARGS__)
#define G_LLVM_CLASS_NAME "LINUX_LVM"
#define G_LLVM_NAMELEN 128

View File

@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/mirror/g_mirror.h>
FEATURE(geom_mirror, "GEOM mirroring support");

View File

@ -86,28 +86,10 @@
extern int g_mirror_debug;
#define G_MIRROR_DEBUG(lvl, ...) do { \
if (g_mirror_debug >= (lvl)) { \
printf("GEOM_MIRROR"); \
if (g_mirror_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_MIRROR_LOGREQ(lvl, bp, ...) do { \
if (g_mirror_debug >= (lvl)) { \
printf("GEOM_MIRROR"); \
if (g_mirror_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_MIRROR_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_MIRROR", g_mirror_debug, (lvl), NULL, __VA_ARGS__)
#define G_MIRROR_LOGREQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_MIRROR", g_mirror_debug, (lvl), (bp), __VA_ARGS__)
#define G_MIRROR_BIO_FLAG_REGULAR 0x01
#define G_MIRROR_BIO_FLAG_SYNC 0x02

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sx.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/geom_int.h>
#include <geom/mirror/g_mirror.h>

View File

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/eventhandler.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/mountver/g_mountver.h>

View File

@ -38,25 +38,10 @@
#ifdef _KERNEL
#define G_MOUNTVER_DEBUG(lvl, ...) do { \
if (g_mountver_debug >= (lvl)) { \
printf("GEOM_MOUNTVER"); \
if (g_mountver_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_MOUNTVER_LOGREQ(bp, ...) do { \
if (g_mountver_debug >= 2) { \
printf("GEOM_MOUNTVER[2]: "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_MOUNTVER_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_MOUNTVER", g_mountver_debug, (lvl), NULL, __VA_ARGS__)
#define G_MOUNTVER_LOGREQ(bp, ...) \
_GEOM_DEBUG("GEOM_MOUNTVER", g_mountver_debug, 2, (bp), __VA_ARGS__)
struct g_mountver_softc {
TAILQ_HEAD(, bio) sc_queue;

View File

@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/nop/g_nop.h>

View File

@ -41,26 +41,11 @@
#define G_NOP_PHYSPATH_PASSTHROUGH "\255"
#ifdef _KERNEL
#define G_NOP_DEBUG(lvl, ...) do { \
if (g_nop_debug >= (lvl)) { \
printf("GEOM_NOP"); \
if (g_nop_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_NOP_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_NOP", g_nop_debug, (lvl), NULL, __VA_ARGS__)
#define G_NOP_LOGREQLVL(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_NOP", g_nop_debug, (lvl), (bp), __VA_ARGS__)
#define G_NOP_LOGREQ(bp, ...) G_NOP_LOGREQLVL(2, bp, __VA_ARGS__)
#define G_NOP_LOGREQLVL(lvl, bp, ...) do { \
if (g_nop_debug >= (lvl)) { \
printf("GEOM_NOP[%d]: ", (lvl)); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
struct g_nop_delay;

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/eventhandler.h>
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <sys/proc.h>
#include <sys/kthread.h>
#include <sys/sched.h>

View File

@ -61,39 +61,13 @@ extern int g_raid_read_err_thresh;
extern u_int g_raid_start_timeout;
extern struct g_class g_raid_class;
#define G_RAID_DEBUG(lvl, fmt, ...) do { \
if (g_raid_debug >= (lvl)) { \
if (g_raid_debug > 0) { \
printf("GEOM_RAID[%u]: " fmt "\n", \
lvl, ## __VA_ARGS__); \
} else { \
printf("GEOM_RAID: " fmt "\n", \
## __VA_ARGS__); \
} \
} \
} while (0)
#define G_RAID_DEBUG1(lvl, sc, fmt, ...) do { \
if (g_raid_debug >= (lvl)) { \
if (g_raid_debug > 0) { \
printf("GEOM_RAID[%u]: %s: " fmt "\n", \
lvl, (sc)->sc_name, ## __VA_ARGS__); \
} else { \
printf("GEOM_RAID: %s: " fmt "\n", \
(sc)->sc_name, ## __VA_ARGS__); \
} \
} \
} while (0)
#define G_RAID_LOGREQ(lvl, bp, fmt, ...) do { \
if (g_raid_debug >= (lvl)) { \
if (g_raid_debug > 0) { \
printf("GEOM_RAID[%u]: " fmt " ", \
lvl, ## __VA_ARGS__); \
} else \
printf("GEOM_RAID: " fmt " ", ## __VA_ARGS__); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_RAID_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), NULL, __VA_ARGS__)
#define G_RAID_DEBUG1(lvl, sc, fmt, ...) \
_GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), NULL, "%s: " fmt, \
(sc)->sc_name, ## __VA_ARGS__)
#define G_RAID_LOGREQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_RAID", g_raid_debug, (lvl), (bp), __VA_ARGS__)
/*
* Flags we use to distinguish I/O initiated by the TR layer to maintain

View File

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/clock.h>
#include <sys/disk.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "geom/raid/md_ddf.h"
#include "g_raid_md_if.h"

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/taskqueue.h>
#include <sys/disk.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_md_if.h"

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/taskqueue.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_md_if.h"

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/taskqueue.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_md_if.h"

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_md_if.h"

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/taskqueue.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_md_if.h"

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_tr_if.h"

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_tr_if.h"

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_tr_if.h"

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "geom/raid/g_raid.h"
#include "g_raid_tr_if.h"

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/eventhandler.h>
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <sys/proc.h>
#include <sys/kthread.h>
#include <sys/sched.h>

View File

@ -69,28 +69,10 @@
#ifdef _KERNEL
extern u_int g_raid3_debug;
#define G_RAID3_DEBUG(lvl, ...) do { \
if (g_raid3_debug >= (lvl)) { \
printf("GEOM_RAID3"); \
if (g_raid3_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_RAID3_LOGREQ(lvl, bp, ...) do { \
if (g_raid3_debug >= (lvl)) { \
printf("GEOM_RAID3"); \
if (g_raid3_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_RAID3_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_RAID3", g_raid3_debug, (lvl), NULL, __VA_ARGS__)
#define G_RAID3_LOGREQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_RAID3", g_raid3_debug, (lvl), (bp), __VA_ARGS__)
#define G_RAID3_BIO_CFLAG_REGULAR 0x01
#define G_RAID3_BIO_CFLAG_SYNC 0x02

View File

@ -118,6 +118,7 @@
#include <sys/malloc.h>
#include <sys/proc.h> /* we access curthread */
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include "gs_scheduler.h"
#include "g_sched.h" /* geom hooks */

View File

@ -44,26 +44,10 @@
#define G_SCHED_SUFFIX ".sched."
#ifdef _KERNEL
#define G_SCHED_DEBUG(lvl, ...) do { \
if (me.gs_debug >= (lvl)) { \
printf("GEOM_SCHED"); \
if (me.gs_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_SCHED_LOGREQ(bp, ...) do { \
if (me.gs_debug >= 2) { \
printf("GEOM_SCHED[2]: "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_SCHED_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_SCHED", me.gs_debug, (lvl), NULL, __VA_ARGS__)
#define G_SCHED_LOGREQ(bp, ...) \
_GEOM_DEBUG("GEOM_SCHED", me.gs_debug, 2, (bp), __VA_ARGS__)
LIST_HEAD(g_hash, g_sched_class);

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/shsec/g_shsec.h>
FEATURE(geom_shsec, "GEOM shared secret device support");

View File

@ -46,28 +46,10 @@
#ifdef _KERNEL
#define G_SHSEC_BFLAG_FIRST 0x1
#define G_SHSEC_DEBUG(lvl, ...) do { \
if (g_shsec_debug >= (lvl)) { \
printf("GEOM_SHSEC"); \
if (g_shsec_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_SHSEC_LOGREQ(lvl, bp, ...) do { \
if (g_shsec_debug >= (lvl)) { \
printf("GEOM_SHSEC"); \
if (g_shsec_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_SHSEC_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_SHSEC", g_shsec_debug, (lvl), NULL, __VA_ARGS__)
#define G_SHSEC_LOGREQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_SHSEC", g_shsec_debug, (lvl), (bp), __VA_ARGS__)
struct g_shsec_softc {
u_int sc_type; /* provider type */

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/stripe/g_stripe.h>
FEATURE(geom_stripe, "GEOM striping support");

View File

@ -49,25 +49,10 @@
#define G_STRIPE_TYPE_MANUAL 0
#define G_STRIPE_TYPE_AUTOMATIC 1
#define G_STRIPE_DEBUG(lvl, ...) do { \
if (g_stripe_debug >= (lvl)) { \
printf("GEOM_STRIPE"); \
if (g_stripe_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_STRIPE_LOGREQ(bp, ...) do { \
if (g_stripe_debug >= 2) { \
printf("GEOM_STRIPE[2]: "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_STRIPE_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_STRIPE", g_stripe_debug, (lvl), NULL, __VA_ARGS__)
#define G_STRIPE_LOGREQ(bp, ...) \
_GEOM_DEBUG("GEOM_STRIPE", g_stripe_debug, 2, (bp), __VA_ARGS__)
struct g_stripe_softc {
u_int sc_type; /* provider type */

View File

@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>
#include <geom/vinum/geom_vinum_raid5.h>

View File

@ -157,28 +157,9 @@ int gv_sync_complete(struct gv_plex *, struct bio *);
extern u_int g_vinum_debug;
#define G_VINUM_DEBUG(lvl, ...) do { \
if (g_vinum_debug >= (lvl)) { \
printf("GEOM_VINUM"); \
if (g_vinum_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define G_VINUM_LOGREQ(lvl, bp, ...) do { \
if (g_vinum_debug >= (lvl)) { \
printf("GEOM_VINUM"); \
if (g_vinum_debug > 0) \
printf("[%u]", lvl); \
printf(": "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define G_VINUM_DEBUG(lvl, ...) \
_GEOM_DEBUG("GEOM_VINUM", g_vinum_debug, (lvl), NULL, __VA_ARGS__)
#define G_VINUM_LOGREQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_VINUM", g_vinum_debug, (lvl), (bp), __VA_ARGS__)
#endif /* !_GEOM_VINUM_H_ */

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum_raid5.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum_raid5.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>

View File

@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>
#include <geom/vinum/geom_vinum_share.h>

View File

@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/vinum/geom_vinum_var.h>
#include <geom/vinum/geom_vinum.h>
#include <geom/vinum/geom_vinum_share.h>

View File

@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <vm/uma.h>
#include <geom/geom.h>
#include <geom/geom_dbg.h>
#include <geom/virstor/g_virstor.h>
#include <geom/virstor/g_virstor_md.h>

View File

@ -47,30 +47,12 @@ struct virstor_map_entry {
#ifdef _KERNEL
#define LOG_MSG(lvl, ...) do { \
if (g_virstor_debug >= (lvl)) { \
printf("GEOM_" G_VIRSTOR_CLASS_NAME); \
if ((lvl) > 0) \
printf("[%u]", (lvl)); \
printf(": "); \
printf(__VA_ARGS__); \
printf("\n"); \
} \
} while (0)
#define LOG_MSG(lvl, ...) \
_GEOM_DEBUG("GEOM_VIRSTOR", g_virstor_debug, (lvl), NULL, __VA_ARGS__)
#define LOG_MESSAGE LOG_MSG
#define LOG_REQ(lvl, bp, ...) do { \
if (g_virstor_debug >= (lvl)) { \
printf("GEOM_" G_VIRSTOR_CLASS_NAME); \
if ((lvl) > 0) \
printf("[%u]", (lvl)); \
printf(": "); \
printf(__VA_ARGS__); \
printf(" "); \
g_print_bio(bp); \
printf("\n"); \
} \
} while (0)
#define LOG_REQ(lvl, bp, ...) \
_GEOM_DEBUG("GEOM_VIRSTOR", g_virstor_debug, (lvl), (bp), __VA_ARGS__)
#define LOG_REQUEST LOG_REQ
/* "critical" system announcements (e.g. "geom is up") */