dlm.h (5889B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2#undef TRACE_SYSTEM 3#define TRACE_SYSTEM dlm 4 5#if !defined(_TRACE_DLM_H) || defined(TRACE_HEADER_MULTI_READ) 6#define _TRACE_DLM_H 7 8#include <linux/dlm.h> 9#include <linux/dlmconstants.h> 10#include <linux/tracepoint.h> 11 12#include "../../../fs/dlm/dlm_internal.h" 13 14#define show_lock_flags(flags) __print_flags(flags, "|", \ 15 { DLM_LKF_NOQUEUE, "NOQUEUE" }, \ 16 { DLM_LKF_CANCEL, "CANCEL" }, \ 17 { DLM_LKF_CONVERT, "CONVERT" }, \ 18 { DLM_LKF_VALBLK, "VALBLK" }, \ 19 { DLM_LKF_QUECVT, "QUECVT" }, \ 20 { DLM_LKF_IVVALBLK, "IVVALBLK" }, \ 21 { DLM_LKF_CONVDEADLK, "CONVDEADLK" }, \ 22 { DLM_LKF_PERSISTENT, "PERSISTENT" }, \ 23 { DLM_LKF_NODLCKWT, "NODLCKWT" }, \ 24 { DLM_LKF_NODLCKBLK, "NODLCKBLK" }, \ 25 { DLM_LKF_EXPEDITE, "EXPEDITE" }, \ 26 { DLM_LKF_NOQUEUEBAST, "NOQUEUEBAST" }, \ 27 { DLM_LKF_HEADQUE, "HEADQUE" }, \ 28 { DLM_LKF_NOORDER, "NOORDER" }, \ 29 { DLM_LKF_ORPHAN, "ORPHAN" }, \ 30 { DLM_LKF_ALTPR, "ALTPR" }, \ 31 { DLM_LKF_ALTCW, "ALTCW" }, \ 32 { DLM_LKF_FORCEUNLOCK, "FORCEUNLOCK" }, \ 33 { DLM_LKF_TIMEOUT, "TIMEOUT" }) 34 35#define show_lock_mode(mode) __print_symbolic(mode, \ 36 { DLM_LOCK_IV, "IV"}, \ 37 { DLM_LOCK_NL, "NL"}, \ 38 { DLM_LOCK_CR, "CR"}, \ 39 { DLM_LOCK_CW, "CW"}, \ 40 { DLM_LOCK_PR, "PR"}, \ 41 { DLM_LOCK_PW, "PW"}, \ 42 { DLM_LOCK_EX, "EX"}) 43 44#define show_dlm_sb_flags(flags) __print_flags(flags, "|", \ 45 { DLM_SBF_DEMOTED, "DEMOTED" }, \ 46 { DLM_SBF_VALNOTVALID, "VALNOTVALID" }, \ 47 { DLM_SBF_ALTMODE, "ALTMODE" }) 48 49/* note: we begin tracing dlm_lock_start() only if ls and lkb are found */ 50TRACE_EVENT(dlm_lock_start, 51 52 TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, int mode, 53 __u32 flags), 54 55 TP_ARGS(ls, lkb, mode, flags), 56 57 TP_STRUCT__entry( 58 __field(__u32, ls_id) 59 __field(__u32, lkb_id) 60 __field(int, mode) 61 __field(__u32, flags) 62 ), 63 64 TP_fast_assign( 65 __entry->ls_id = ls->ls_global_id; 66 __entry->lkb_id = lkb->lkb_id; 67 __entry->mode = mode; 68 __entry->flags = flags; 69 ), 70 71 TP_printk("ls_id=%u lkb_id=%x mode=%s flags=%s", 72 __entry->ls_id, __entry->lkb_id, 73 show_lock_mode(__entry->mode), 74 show_lock_flags(__entry->flags)) 75 76); 77 78TRACE_EVENT(dlm_lock_end, 79 80 TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, int mode, __u32 flags, 81 int error), 82 83 TP_ARGS(ls, lkb, mode, flags, error), 84 85 TP_STRUCT__entry( 86 __field(__u32, ls_id) 87 __field(__u32, lkb_id) 88 __field(int, mode) 89 __field(__u32, flags) 90 __field(int, error) 91 ), 92 93 TP_fast_assign( 94 __entry->ls_id = ls->ls_global_id; 95 __entry->lkb_id = lkb->lkb_id; 96 __entry->mode = mode; 97 __entry->flags = flags; 98 99 /* return value will be zeroed in those cases by dlm_lock() 100 * we do it here again to not introduce more overhead if 101 * trace isn't running and error reflects the return value. 102 */ 103 if (error == -EAGAIN || error == -EDEADLK) 104 __entry->error = 0; 105 else 106 __entry->error = error; 107 ), 108 109 TP_printk("ls_id=%u lkb_id=%x mode=%s flags=%s error=%d", 110 __entry->ls_id, __entry->lkb_id, 111 show_lock_mode(__entry->mode), 112 show_lock_flags(__entry->flags), __entry->error) 113 114); 115 116TRACE_EVENT(dlm_bast, 117 118 TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, int mode), 119 120 TP_ARGS(ls, lkb, mode), 121 122 TP_STRUCT__entry( 123 __field(__u32, ls_id) 124 __field(__u32, lkb_id) 125 __field(int, mode) 126 ), 127 128 TP_fast_assign( 129 __entry->ls_id = ls->ls_global_id; 130 __entry->lkb_id = lkb->lkb_id; 131 __entry->mode = mode; 132 ), 133 134 TP_printk("ls_id=%u lkb_id=%x mode=%s", __entry->ls_id, 135 __entry->lkb_id, show_lock_mode(__entry->mode)) 136 137); 138 139TRACE_EVENT(dlm_ast, 140 141 TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, struct dlm_lksb *lksb), 142 143 TP_ARGS(ls, lkb, lksb), 144 145 TP_STRUCT__entry( 146 __field(__u32, ls_id) 147 __field(__u32, lkb_id) 148 __field(u8, sb_flags) 149 __field(int, sb_status) 150 ), 151 152 TP_fast_assign( 153 __entry->ls_id = ls->ls_global_id; 154 __entry->lkb_id = lkb->lkb_id; 155 __entry->sb_flags = lksb->sb_flags; 156 __entry->sb_status = lksb->sb_status; 157 ), 158 159 TP_printk("ls_id=%u lkb_id=%x sb_flags=%s sb_status=%d", 160 __entry->ls_id, __entry->lkb_id, 161 show_dlm_sb_flags(__entry->sb_flags), __entry->sb_status) 162 163); 164 165/* note: we begin tracing dlm_unlock_start() only if ls and lkb are found */ 166TRACE_EVENT(dlm_unlock_start, 167 168 TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, __u32 flags), 169 170 TP_ARGS(ls, lkb, flags), 171 172 TP_STRUCT__entry( 173 __field(__u32, ls_id) 174 __field(__u32, lkb_id) 175 __field(__u32, flags) 176 ), 177 178 TP_fast_assign( 179 __entry->ls_id = ls->ls_global_id; 180 __entry->lkb_id = lkb->lkb_id; 181 __entry->flags = flags; 182 ), 183 184 TP_printk("ls_id=%u lkb_id=%x flags=%s", 185 __entry->ls_id, __entry->lkb_id, 186 show_lock_flags(__entry->flags)) 187 188); 189 190TRACE_EVENT(dlm_unlock_end, 191 192 TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, __u32 flags, 193 int error), 194 195 TP_ARGS(ls, lkb, flags, error), 196 197 TP_STRUCT__entry( 198 __field(__u32, ls_id) 199 __field(__u32, lkb_id) 200 __field(__u32, flags) 201 __field(int, error) 202 ), 203 204 TP_fast_assign( 205 __entry->ls_id = ls->ls_global_id; 206 __entry->lkb_id = lkb->lkb_id; 207 __entry->flags = flags; 208 __entry->error = error; 209 ), 210 211 TP_printk("ls_id=%u lkb_id=%x flags=%s error=%d", 212 __entry->ls_id, __entry->lkb_id, 213 show_lock_flags(__entry->flags), __entry->error) 214 215); 216 217TRACE_EVENT(dlm_send, 218 219 TP_PROTO(int nodeid, int ret), 220 221 TP_ARGS(nodeid, ret), 222 223 TP_STRUCT__entry( 224 __field(int, nodeid) 225 __field(int, ret) 226 ), 227 228 TP_fast_assign( 229 __entry->nodeid = nodeid; 230 __entry->ret = ret; 231 ), 232 233 TP_printk("nodeid=%d ret=%d", __entry->nodeid, __entry->ret) 234 235); 236 237TRACE_EVENT(dlm_recv, 238 239 TP_PROTO(int nodeid, int ret), 240 241 TP_ARGS(nodeid, ret), 242 243 TP_STRUCT__entry( 244 __field(int, nodeid) 245 __field(int, ret) 246 ), 247 248 TP_fast_assign( 249 __entry->nodeid = nodeid; 250 __entry->ret = ret; 251 ), 252 253 TP_printk("nodeid=%d ret=%d", __entry->nodeid, __entry->ret) 254 255); 256 257#endif /* if !defined(_TRACE_DLM_H) || defined(TRACE_HEADER_MULTI_READ) */ 258 259/* This part must be outside protection */ 260#include <trace/define_trace.h>