1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or https://opensource.org/licenses/CDDL-1.0. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 23 #if defined(_KERNEL) 24 #if defined(HAVE_DECLARE_EVENT_CLASS) 25 26 #undef TRACE_SYSTEM 27 #define TRACE_SYSTEM zfs 28 29 #undef TRACE_SYSTEM_VAR 30 #define TRACE_SYSTEM_VAR zfs_dmu 31 32 #if !defined(_TRACE_DMU_H) || defined(TRACE_HEADER_MULTI_READ) 33 #define _TRACE_DMU_H 34 35 #include <linux/tracepoint.h> 36 #include <sys/types.h> 37 38 /* 39 * Generic support for three argument tracepoints of the form: 40 * 41 * DTRACE_PROBE3(..., 42 * dmu_tx_t *, ..., 43 * uint64_t, ..., 44 * uint64_t, ...); 45 */ 46 /* BEGIN CSTYLED */ 47 DECLARE_EVENT_CLASS(zfs_delay_mintime_class, 48 TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time), 49 TP_ARGS(tx, dirty, min_tx_time), 50 TP_STRUCT__entry( 51 __field(uint64_t, tx_txg) 52 __field(uint64_t, tx_lastsnap_txg) 53 __field(uint64_t, tx_lasttried_txg) 54 __field(boolean_t, tx_anyobj) 55 __field(boolean_t, tx_dirty_delayed) 56 __field(hrtime_t, tx_start) 57 __field(boolean_t, tx_wait_dirty) 58 __field(int, tx_err) 59 __field(uint64_t, min_tx_time) 60 __field(uint64_t, dirty) 61 ), 62 TP_fast_assign( 63 __entry->tx_txg = tx->tx_txg; 64 __entry->tx_lastsnap_txg = tx->tx_lastsnap_txg; 65 __entry->tx_lasttried_txg = tx->tx_lasttried_txg; 66 __entry->tx_anyobj = tx->tx_anyobj; 67 __entry->tx_dirty_delayed = tx->tx_dirty_delayed; 68 __entry->tx_start = tx->tx_start; 69 __entry->tx_wait_dirty = tx->tx_wait_dirty; 70 __entry->tx_err = tx->tx_err; 71 __entry->dirty = dirty; 72 __entry->min_tx_time = min_tx_time; 73 ), 74 TP_printk("tx { txg %llu lastsnap_txg %llu tx_lasttried_txg %llu " 75 "anyobj %d dirty_delayed %d start %llu wait_dirty %d err %i " 76 "} dirty %llu min_tx_time %llu", 77 __entry->tx_txg, __entry->tx_lastsnap_txg, 78 __entry->tx_lasttried_txg, __entry->tx_anyobj, 79 __entry->tx_dirty_delayed, __entry->tx_start, 80 __entry->tx_wait_dirty, __entry->tx_err, 81 __entry->dirty, __entry->min_tx_time) 82 ); 83 /* END CSTYLED */ 84 85 #define DEFINE_DELAY_MINTIME_EVENT(name) \ 86 DEFINE_EVENT(zfs_delay_mintime_class, name, \ 87 TP_PROTO(dmu_tx_t *tx, uint64_t dirty, uint64_t min_tx_time), \ 88 TP_ARGS(tx, dirty, min_tx_time)) 89 DEFINE_DELAY_MINTIME_EVENT(zfs_delay__mintime); 90 91 /* BEGIN CSTYLED */ 92 DECLARE_EVENT_CLASS(zfs_free_long_range_class, 93 TP_PROTO(uint64_t long_free_dirty_all_txgs, uint64_t chunk_len, \ 94 uint64_t txg), 95 TP_ARGS(long_free_dirty_all_txgs, chunk_len, txg), 96 TP_STRUCT__entry( 97 __field(uint64_t, long_free_dirty_all_txgs) 98 __field(uint64_t, chunk_len) 99 __field(uint64_t, txg) 100 ), 101 TP_fast_assign( 102 __entry->long_free_dirty_all_txgs = long_free_dirty_all_txgs; 103 __entry->chunk_len = chunk_len; 104 __entry->txg = txg; 105 ), 106 TP_printk("long_free_dirty_all_txgs %llu chunk_len %llu txg %llu", 107 __entry->long_free_dirty_all_txgs, 108 __entry->chunk_len, __entry->txg) 109 ); 110 /* END CSTYLED */ 111 112 #define DEFINE_FREE_LONG_RANGE_EVENT(name) \ 113 DEFINE_EVENT(zfs_free_long_range_class, name, \ 114 TP_PROTO(uint64_t long_free_dirty_all_txgs, \ 115 uint64_t chunk_len, uint64_t txg), \ 116 TP_ARGS(long_free_dirty_all_txgs, chunk_len, txg)) 117 DEFINE_FREE_LONG_RANGE_EVENT(zfs_free__long__range); 118 119 #endif /* _TRACE_DMU_H */ 120 121 #undef TRACE_INCLUDE_PATH 122 #undef TRACE_INCLUDE_FILE 123 #define TRACE_INCLUDE_PATH sys 124 #define TRACE_INCLUDE_FILE trace_dmu 125 #include <trace/define_trace.h> 126 127 #else 128 129 DEFINE_DTRACE_PROBE3(delay__mintime); 130 DEFINE_DTRACE_PROBE3(free__long__range); 131 132 #endif /* HAVE_DECLARE_EVENT_CLASS */ 133 #endif /* _KERNEL */ 134