1eda14cbcSMatt Macy /* 2eda14cbcSMatt Macy * CDDL HEADER START 3eda14cbcSMatt Macy * 4eda14cbcSMatt Macy * The contents of this file are subject to the terms of the 5eda14cbcSMatt Macy * Common Development and Distribution License (the "License"). 6eda14cbcSMatt Macy * You may not use this file except in compliance with the License. 7eda14cbcSMatt Macy * 8eda14cbcSMatt Macy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*271171e0SMartin Matuska * or https://opensource.org/licenses/CDDL-1.0. 10eda14cbcSMatt Macy * See the License for the specific language governing permissions 11eda14cbcSMatt Macy * and limitations under the License. 12eda14cbcSMatt Macy * 13eda14cbcSMatt Macy * When distributing Covered Code, include this CDDL HEADER in each 14eda14cbcSMatt Macy * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15eda14cbcSMatt Macy * If applicable, add the following below this CDDL HEADER, with the 16eda14cbcSMatt Macy * fields enclosed by brackets "[]" replaced with your own identifying 17eda14cbcSMatt Macy * information: Portions Copyright [yyyy] [name of copyright owner] 18eda14cbcSMatt Macy * 19eda14cbcSMatt Macy * CDDL HEADER END 20eda14cbcSMatt Macy */ 21eda14cbcSMatt Macy 22eda14cbcSMatt Macy #if defined(_KERNEL) 23eda14cbcSMatt Macy #if defined(HAVE_DECLARE_EVENT_CLASS) 24eda14cbcSMatt Macy 25eda14cbcSMatt Macy /* 26eda14cbcSMatt Macy * If tracepoints are available define dtrace_probe events for vdev 27eda14cbcSMatt Macy * related probes. Definitions in include/os/linux/spl/sys/trace.h 28eda14cbcSMatt Macy * will map DTRACE_PROBE* calls to tracepoints. 29eda14cbcSMatt Macy */ 30eda14cbcSMatt Macy 31eda14cbcSMatt Macy #undef TRACE_SYSTEM 32eda14cbcSMatt Macy #define TRACE_SYSTEM zfs 33eda14cbcSMatt Macy 34eda14cbcSMatt Macy #undef TRACE_SYSTEM_VAR 35eda14cbcSMatt Macy #define TRACE_SYSTEM_VAR zfs_vdev 36eda14cbcSMatt Macy 37eda14cbcSMatt Macy #if !defined(_TRACE_VDEV_H) || defined(TRACE_HEADER_MULTI_READ) 38eda14cbcSMatt Macy #define _TRACE_VDEV_H 39eda14cbcSMatt Macy 40eda14cbcSMatt Macy #include <linux/tracepoint.h> 41eda14cbcSMatt Macy #include <sys/types.h> 42eda14cbcSMatt Macy 43eda14cbcSMatt Macy /* 44eda14cbcSMatt Macy * Generic support for three argument tracepoints of the form: 45eda14cbcSMatt Macy * 46eda14cbcSMatt Macy * DTRACE_PROBE3(..., 47eda14cbcSMatt Macy * spa_t *, ..., 48eda14cbcSMatt Macy * uint64_t, ..., 49eda14cbcSMatt Macy * uint64_t, ...); 50eda14cbcSMatt Macy */ 51eda14cbcSMatt Macy /* BEGIN CSTYLED */ 52eda14cbcSMatt Macy DECLARE_EVENT_CLASS(zfs_removing_class_3, 53eda14cbcSMatt Macy TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size), 54eda14cbcSMatt Macy TP_ARGS(spa, offset, size), 55eda14cbcSMatt Macy TP_STRUCT__entry( 56eda14cbcSMatt Macy __field(spa_t *, vdev_spa) 57eda14cbcSMatt Macy __field(uint64_t, vdev_offset) 58eda14cbcSMatt Macy __field(uint64_t, vdev_size) 59eda14cbcSMatt Macy ), 60eda14cbcSMatt Macy TP_fast_assign( 61eda14cbcSMatt Macy __entry->vdev_spa = spa; 62eda14cbcSMatt Macy __entry->vdev_offset = offset; 63eda14cbcSMatt Macy __entry->vdev_size = size; 64eda14cbcSMatt Macy ), 65eda14cbcSMatt Macy TP_printk("spa %p offset %llu size %llu", 66eda14cbcSMatt Macy __entry->vdev_spa, __entry->vdev_offset, 67eda14cbcSMatt Macy __entry->vdev_size) 68eda14cbcSMatt Macy ); 69eda14cbcSMatt Macy /* END CSTYLED */ 70eda14cbcSMatt Macy 71eda14cbcSMatt Macy #define DEFINE_REMOVE_FREE_EVENT(name) \ 72eda14cbcSMatt Macy DEFINE_EVENT(zfs_removing_class_3, name, \ 73eda14cbcSMatt Macy TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size), \ 74eda14cbcSMatt Macy TP_ARGS(spa, offset, size)) 75eda14cbcSMatt Macy DEFINE_REMOVE_FREE_EVENT(zfs_remove__free__synced); 76eda14cbcSMatt Macy DEFINE_REMOVE_FREE_EVENT(zfs_remove__free__unvisited); 77eda14cbcSMatt Macy 78eda14cbcSMatt Macy /* 79eda14cbcSMatt Macy * Generic support for four argument tracepoints of the form: 80eda14cbcSMatt Macy * 81eda14cbcSMatt Macy * DTRACE_PROBE4(..., 82eda14cbcSMatt Macy * spa_t *, ..., 83eda14cbcSMatt Macy * uint64_t, ..., 84eda14cbcSMatt Macy * uint64_t, ..., 85eda14cbcSMatt Macy * uint64_t, ...); 86eda14cbcSMatt Macy */ 87eda14cbcSMatt Macy /* BEGIN CSTYLED */ 88eda14cbcSMatt Macy DECLARE_EVENT_CLASS(zfs_removing_class_4, 89eda14cbcSMatt Macy TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size, uint64_t txg), 90eda14cbcSMatt Macy TP_ARGS(spa, offset, size, txg), 91eda14cbcSMatt Macy TP_STRUCT__entry( 92eda14cbcSMatt Macy __field(spa_t *, vdev_spa) 93eda14cbcSMatt Macy __field(uint64_t, vdev_offset) 94eda14cbcSMatt Macy __field(uint64_t, vdev_size) 95eda14cbcSMatt Macy __field(uint64_t, vdev_txg) 96eda14cbcSMatt Macy ), 97eda14cbcSMatt Macy TP_fast_assign( 98eda14cbcSMatt Macy __entry->vdev_spa = spa; 99eda14cbcSMatt Macy __entry->vdev_offset = offset; 100eda14cbcSMatt Macy __entry->vdev_size = size; 101eda14cbcSMatt Macy __entry->vdev_txg = txg; 102eda14cbcSMatt Macy ), 103eda14cbcSMatt Macy TP_printk("spa %p offset %llu size %llu txg %llu", 104eda14cbcSMatt Macy __entry->vdev_spa, __entry->vdev_offset, 105eda14cbcSMatt Macy __entry->vdev_size, __entry->vdev_txg) 106eda14cbcSMatt Macy ); 107eda14cbcSMatt Macy 108eda14cbcSMatt Macy #define DEFINE_REMOVE_FREE_EVENT_TXG(name) \ 109eda14cbcSMatt Macy DEFINE_EVENT(zfs_removing_class_4, name, \ 110eda14cbcSMatt Macy TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size,uint64_t txg), \ 111eda14cbcSMatt Macy TP_ARGS(spa, offset, size, txg)) 112eda14cbcSMatt Macy DEFINE_REMOVE_FREE_EVENT_TXG(zfs_remove__free__inflight); 113eda14cbcSMatt Macy 114eda14cbcSMatt Macy #endif /* _TRACE_VDEV_H */ 115eda14cbcSMatt Macy 116eda14cbcSMatt Macy #undef TRACE_INCLUDE_PATH 117eda14cbcSMatt Macy #undef TRACE_INCLUDE_FILE 118eda14cbcSMatt Macy #define TRACE_INCLUDE_PATH sys 119eda14cbcSMatt Macy #define TRACE_INCLUDE_FILE trace_vdev 120eda14cbcSMatt Macy #include <trace/define_trace.h> 121eda14cbcSMatt Macy 122eda14cbcSMatt Macy #else 123eda14cbcSMatt Macy 124eda14cbcSMatt Macy /* 125eda14cbcSMatt Macy * When tracepoints are not available, a DEFINE_DTRACE_PROBE* macro is 126eda14cbcSMatt Macy * needed for each DTRACE_PROBE. These will be used to generate stub 127eda14cbcSMatt Macy * tracing functions and prototypes for those functions. See 128eda14cbcSMatt Macy * include/os/linux/spl/sys/trace.h. 129eda14cbcSMatt Macy */ 130eda14cbcSMatt Macy 131eda14cbcSMatt Macy DEFINE_DTRACE_PROBE3(remove__free__synced); 132eda14cbcSMatt Macy DEFINE_DTRACE_PROBE3(remove__free__unvisited); 133eda14cbcSMatt Macy DEFINE_DTRACE_PROBE4(remove__free__inflight); 134eda14cbcSMatt Macy 135eda14cbcSMatt Macy #endif /* HAVE_DECLARE_EVENT_CLASS */ 136eda14cbcSMatt Macy #endif /* _KERNEL */ 137