diff --git a/include/os/linux/zfs/sys/Makefile.am b/include/os/linux/zfs/sys/Makefile.am index a075db476e..71c1dbda39 100644 --- a/include/os/linux/zfs/sys/Makefile.am +++ b/include/os/linux/zfs/sys/Makefile.am @@ -11,6 +11,7 @@ KERNEL_H = \ trace_dnode.h \ trace_multilist.h \ trace_rrwlock.h \ + trace_spa_taskqs.h \ trace_txg.h \ trace_vdev.h \ trace_zil.h \ diff --git a/include/os/linux/zfs/sys/trace_spa_taskqs.h b/include/os/linux/zfs/sys/trace_spa_taskqs.h new file mode 100644 index 0000000000..77e2b8ea1f --- /dev/null +++ b/include/os/linux/zfs/sys/trace_spa_taskqs.h @@ -0,0 +1,74 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +#if defined(_KERNEL) +#if defined(HAVE_DECLARE_EVENT_CLASS) + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM zfs + +#undef TRACE_SYSTEM_VAR +#define TRACE_SYSTEM_VAR zfs_spa_taskqs + +#if !defined(_TRACE_SPA_TASKQS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_SPA_TASKQS_H + +#include +#include + +/* + * Generic support for two argument tracepoints of the form: + * + * DTRACE_PROBE2(..., + * spa_taskqs_t *stqs, ..., + * taskq_ent_t *ent, ...); + */ +/* BEGIN CSTYLED */ +DECLARE_EVENT_CLASS(zfs_spa_taskqs_ent_class, + TP_PROTO(spa_taskqs_t *stqs, taskq_ent_t *ent), + TP_ARGS(stqs, ent), +); +/* END CSTYLED */ + +/* BEGIN CSTYLED */ +#define DEFINE_SPA_TASKQS_ENT_EVENT(name) \ +DEFINE_EVENT(zfs_spa_taskqs_ent_class, name, \ + TP_PROTO(spa_taskqs_t *stqs, taskq_ent_t *ent), \ + TP_ARGS(stqs, ent)) +/* END CSTYLED */ +DEFINE_SPA_TASKQS_ENT_EVENT(zfs_spa_taskqs_ent__dispatch); +DEFINE_SPA_TASKQS_ENT_EVENT(zfs_spa_taskqs_ent__dispatched); + +#endif /* _TRACE_SPA_TASKQS_H */ + +#undef TRACE_INCLUDE_PATH +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_PATH sys +#define TRACE_INCLUDE_FILE trace_spa_taskqs +#include + +#else + +DEFINE_DTRACE_PROBE2(spa_taskqs_ent__dispatch); +DEFINE_DTRACE_PROBE2(spa_taskqs_ent__dispatched); + +#endif /* HAVE_DECLARE_EVENT_CLASS */ +#endif /* _KERNEL */ diff --git a/include/os/linux/zfs/sys/trace_zfs.h b/include/os/linux/zfs/sys/trace_zfs.h index 0e19f8d186..0b0ac94e01 100644 --- a/include/os/linux/zfs/sys/trace_zfs.h +++ b/include/os/linux/zfs/sys/trace_zfs.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h index b2a718af0f..d9f1b5c4f3 100644 --- a/include/sys/spa_impl.h +++ b/include/sys/spa_impl.h @@ -183,6 +183,8 @@ typedef enum spa_proc_state { } spa_proc_state_t; typedef struct spa_taskqs { + zio_taskq_type_t stqs_type; + zio_type_t stqs_zio_type; uint_t stqs_count; taskq_t **stqs_taskq; } spa_taskqs_t; diff --git a/module/os/linux/zfs/trace.c b/module/os/linux/zfs/trace.c index a690822ae1..9c09baee03 100644 --- a/module/os/linux/zfs/trace.c +++ b/module/os/linux/zfs/trace.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include diff --git a/module/zfs/spa.c b/module/zfs/spa.c index d790d663de..8d93088518 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -87,6 +87,7 @@ #include #include #include +#include #ifdef _KERNEL #include @@ -982,6 +983,9 @@ spa_taskqs_init(spa_t *spa, zio_type_t t, zio_taskq_type_t q) uint_t cpus, flags = TASKQ_DYNAMIC; boolean_t batch = B_FALSE; + tqs->stqs_type = q; + tqs->stqs_zio_type = t; + switch (mode) { case ZTI_MODE_FIXED: ASSERT3U(value, >, 0); @@ -1399,6 +1403,9 @@ spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q, ASSERT3P(tqs->stqs_taskq, !=, NULL); ASSERT3U(tqs->stqs_count, !=, 0); + DTRACE_PROBE2(spa_taskqs_ent__dispatch, + spa_taskqs_t *, tqs, taskq_ent_t *, ent); + if (tqs->stqs_count == 1) { tq = tqs->stqs_taskq[0]; } else { @@ -1406,6 +1413,9 @@ spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q, } taskq_dispatch_ent(tq, func, arg, flags, ent); + + DTRACE_PROBE2(spa_taskqs_ent__dispatched, + spa_taskqs_t *, tqs, taskq_ent_t *, ent); } /*