diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dtrace.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dtrace.c new file mode 100644 index 0000000..4678167 --- /dev/null +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dtrace.c @@ -0,0 +1,69 @@ +/* + * 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 + */ + +#include "opt_kdtrace.h" + +#include +#include +#include +#include + +SDT_PROVIDER_DEFINE(sdt); + +SDT_PROBE_DEFINE1(sdt, , , arc_delete, arc-delete, ""); +SDT_PROBE_DEFINE1(sdt, , , arc_evict, arc-evict, ""); +SDT_PROBE_DEFINE1(sdt, , , arc_hit, arc-hit, ""); +SDT_PROBE_DEFINE4(sdt, , , arc_miss, arc-miss, "", "", "", ""); + +SDT_PROBE_DEFINE1(sdt, , , new_state_mfu, new_state-mfu, ""); +SDT_PROBE_DEFINE1(sdt, , , new_state_mru, new_state-mru, ""); + +SDT_PROBE_DEFINE4(sdt, , , l2arc_evict, l2arc-evict, "", "", "", ""); +SDT_PROBE_DEFINE1(sdt, , , l2arc_hit, l2arc-hit, ""); +SDT_PROBE_DEFINE2(sdt, , , l2arc_iodone, l2arc-iodeont, "", ""); +SDT_PROBE_DEFINE1(sdt, , , l2arc_miss, l2arc-miss, ""); +SDT_PROBE_DEFINE2(sdt, , , l2arc_read, l2arc-read, "", ""); +SDT_PROBE_DEFINE2(sdt, , , l2arc_write, l2arc-write, "", ""); + +SDT_PROBE_DEFINE3(sdt, , , dnode_move, dnode-mov, "", "", ""); + +SDT_PROBE_DEFINE0(sdt, , , pool_sync_1setup, pool_sync-1setup); +SDT_PROBE_DEFINE0(sdt, , , pool_sync_2rootzio, pool_sync-2rootzio); +SDT_PROBE_DEFINE0(sdt, , , pool_sync_3task, pool_sync-3task); +SDT_PROBE_DEFINE2(sdt, , , pool_sync_4io, pool_sync-4io, "", ""); + +SDT_PROBE_DEFINE3(sdt, , , zfs_cp_write, zfs_cp_write, "", "", ""); +SDT_PROBE_DEFINE3(sdt, , , zfs_reqzcbuf_align, zfs_reqzcbuf_align, "", "", + ""); +SDT_PROBE_DEFINE1(sdt, , , zfs_dbgmsg, zfs-dbgmsg, ""); +SDT_PROBE_DEFINE4(sdt, , , zfs_dprintf, zfs-dprintf, "", "", "", ""); +SDT_PROBE_DEFINE0(sdt, , , zfs_rrwfastpath_exitmiss, zfs-rrwfastpath-exitmiss); +SDT_PROBE_DEFINE0(sdt, , , zfs_rrwfastpath_rdmiss, zfs-rrwfastpath-rdmiss); +SDT_PROBE_DEFINE0(sdt, , , zfs_fastpath_execute_access_miss, + zfs-fastpath-execute-access-miss); +SDT_PROBE_DEFINE2(sdt, , , zfs_fastpath_lookup_miss, zfs-fastpath-lookup-miss, + "", ""); +SDT_PROBE_DEFINE3(sdt, , , zfs_ace_denies, zfs-ace-denies, "", "", ""); + +SDT_PROBE_DEFINE1(sdt, , , zil_cw1, zil-cw1, ""); +SDT_PROBE_DEFINE1(sdt, , , zil_cw2, zil-cw2, ""); + +SDT_PROBE_DEFINE2(sdt, , , zrlock_reentry, zrlock-reentry, "", ""); diff --git a/sys/conf/files b/sys/conf/files index 566b4d4..43e484f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -206,6 +206,7 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c optional zfs compile-wit cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/uts/common/fs/zfs/dtrace.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}" diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h index 8c3b184..4b55b7b 100644 --- a/sys/sys/sdt.h +++ b/sys/sys/sdt.h @@ -126,6 +126,12 @@ arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \ xarg6) +#define DTRACE_PROBE(name) +#define DTRACE_PROBE1(name, type0, arg0) +#define DTRACE_PROBE2(name, type0, arg0, type1, arg1) +#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) +#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3) + #else SET_DECLARE(sdt_providers_set, struct sdt_provider); @@ -313,6 +319,29 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); (uintptr_t)arg6); \ } while (0) +/* These macros provide compatibility with Solaris and illumos code. */ +#define DTRACE_PROBE(name) do { \ + SDT_PROBE_DECLARE(sdt, , , name); \ + SDT_PROBE0(sdt, , , name); \ +} while (0) +#define DTRACE_PROBE1(name, type0, arg0) do { \ + SDT_PROBE_DECLARE(sdt, , , name); \ + SDT_PROBE1(sdt, , , arg0); \ +} while (0) +#define DTRACE_PROBE2(name, type0, arg0, type1, arg1) do { \ + SDT_PROBE_DECLARE(sdt, , , name); \ + SDT_PROBE2(sdt, , , arg0, arg1); \ +} while (0) +#define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2) do { \ + SDT_PROBE_DECLARE(sdt, , , name); \ + SDT_PROBE3(sdt, , , arg0, arg1, arg2); \ +} while (0) +#define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3)\ +do { \ + SDT_PROBE_DECLARE(sdt, , , name); \ + SDT_PROBE4(sdt, , , arg0, arg1, arg2, arg3); \ +} while (0) + #endif /* KDTRACE_HOOKS */ /*