^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define TRACE_SYSTEM gfs2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #if !defined(_TRACE_GFS2_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define _TRACE_GFS2_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/buffer_head.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/dlmconstants.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/gfs2_ondisk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/writeback.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/ktime.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/iomap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "incore.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "glock.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include "rgrp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define dlm_state_name(nn) { DLM_LOCK_##nn, #nn }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define glock_trace_name(x) __print_symbolic(x, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) dlm_state_name(IV), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) dlm_state_name(NL), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) dlm_state_name(CR), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) dlm_state_name(CW), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) dlm_state_name(PR), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) dlm_state_name(PW), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) dlm_state_name(EX))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define block_state_name(x) __print_symbolic(x, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) { GFS2_BLKST_FREE, "free" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) { GFS2_BLKST_USED, "used" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) { GFS2_BLKST_DINODE, "dinode" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) { GFS2_BLKST_UNLINKED, "unlinked" })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define TRACE_RS_DELETE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define TRACE_RS_TREEDEL 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define TRACE_RS_INSERT 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define TRACE_RS_CLAIM 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define rs_func_name(x) __print_symbolic(x, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) { 0, "del " }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) { 1, "tdel" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) { 2, "ins " }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) { 3, "clm " })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define show_glock_flags(flags) __print_flags(flags, "", \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) {(1UL << GLF_LOCK), "l" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {(1UL << GLF_DEMOTE), "D" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) {(1UL << GLF_PENDING_DEMOTE), "d" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {(1UL << GLF_DEMOTE_IN_PROGRESS), "p" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) {(1UL << GLF_DIRTY), "y" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {(1UL << GLF_LFLUSH), "f" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) {(1UL << GLF_INVALIDATE_IN_PROGRESS), "i" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {(1UL << GLF_REPLY_PENDING), "r" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {(1UL << GLF_INITIAL), "I" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) {(1UL << GLF_FROZEN), "F" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) {(1UL << GLF_LRU), "L" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {(1UL << GLF_OBJECT), "o" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) {(1UL << GLF_BLOCKING), "b" })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #ifndef NUMPTY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define NUMPTY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) static inline u8 glock_trace_state(unsigned int state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) switch(state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) case LM_ST_SHARED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) return DLM_LOCK_PR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) case LM_ST_DEFERRED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) return DLM_LOCK_CW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) case LM_ST_EXCLUSIVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) return DLM_LOCK_EX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) return DLM_LOCK_NL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* Section 1 - Locking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * Objectives:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * Latency: Remote demote request to state change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * Latency: Local lock request to state change
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * Latency: State change to lock grant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * Correctness: Ordering of local lock state vs. I/O requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * Correctness: Responses to remote demote requests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) /* General glock state change (DLM lock request completes) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) TRACE_EVENT(gfs2_glock_state_change,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) TP_PROTO(const struct gfs2_glock *gl, unsigned int new_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) TP_ARGS(gl, new_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) __field( u64, glnum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) __field( u32, gltype )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) __field( u8, cur_state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) __field( u8, new_state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) __field( u8, dmt_state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) __field( u8, tgt_state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) __field( unsigned long, flags )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) __entry->glnum = gl->gl_name.ln_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) __entry->gltype = gl->gl_name.ln_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) __entry->cur_state = glock_trace_state(gl->gl_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) __entry->new_state = glock_trace_state(new_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) __entry->tgt_state = glock_trace_state(gl->gl_target);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) __entry->dmt_state = glock_trace_state(gl->gl_demote_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) TP_printk("%u,%u glock %d:%lld state %s to %s tgt:%s dmt:%s flags:%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) (unsigned long long)__entry->glnum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) glock_trace_name(__entry->cur_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) glock_trace_name(__entry->new_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) glock_trace_name(__entry->tgt_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) glock_trace_name(__entry->dmt_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) show_glock_flags(__entry->flags))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /* State change -> unlocked, glock is being deallocated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) TRACE_EVENT(gfs2_glock_put,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) TP_PROTO(const struct gfs2_glock *gl),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) TP_ARGS(gl),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) __field( u64, glnum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) __field( u32, gltype )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) __field( u8, cur_state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) __field( unsigned long, flags )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) __entry->gltype = gl->gl_name.ln_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) __entry->glnum = gl->gl_name.ln_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) __entry->cur_state = glock_trace_state(gl->gl_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) TP_printk("%u,%u glock %d:%lld state %s => %s flags:%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) MAJOR(__entry->dev), MINOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) __entry->gltype, (unsigned long long)__entry->glnum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) glock_trace_name(__entry->cur_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) glock_trace_name(DLM_LOCK_IV),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) show_glock_flags(__entry->flags))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) /* Callback (local or remote) requesting lock demotion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) TRACE_EVENT(gfs2_demote_rq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) TP_PROTO(const struct gfs2_glock *gl, bool remote),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) TP_ARGS(gl, remote),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) __field( u64, glnum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) __field( u32, gltype )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) __field( u8, cur_state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) __field( u8, dmt_state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) __field( unsigned long, flags )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) __field( bool, remote )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) __entry->gltype = gl->gl_name.ln_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) __entry->glnum = gl->gl_name.ln_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) __entry->cur_state = glock_trace_state(gl->gl_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) __entry->dmt_state = glock_trace_state(gl->gl_demote_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) __entry->remote = remote;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) TP_printk("%u,%u glock %d:%lld demote %s to %s flags:%s %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) (unsigned long long)__entry->glnum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) glock_trace_name(__entry->cur_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) glock_trace_name(__entry->dmt_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) show_glock_flags(__entry->flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) __entry->remote ? "remote" : "local")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /* Promotion/grant of a glock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) TRACE_EVENT(gfs2_promote,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) TP_PROTO(const struct gfs2_holder *gh, int first),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) TP_ARGS(gh, first),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) __field( u64, glnum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) __field( u32, gltype )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) __field( int, first )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) __field( u8, state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) __entry->glnum = gh->gh_gl->gl_name.ln_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) __entry->gltype = gh->gh_gl->gl_name.ln_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) __entry->first = first;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) __entry->state = glock_trace_state(gh->gh_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) TP_printk("%u,%u glock %u:%llu promote %s %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) (unsigned long long)__entry->glnum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) __entry->first ? "first": "other",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) glock_trace_name(__entry->state))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) /* Queue/dequeue a lock request */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) TRACE_EVENT(gfs2_glock_queue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) TP_PROTO(const struct gfs2_holder *gh, int queue),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) TP_ARGS(gh, queue),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) __field( u64, glnum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) __field( u32, gltype )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) __field( int, queue )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) __field( u8, state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) __entry->glnum = gh->gh_gl->gl_name.ln_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) __entry->gltype = gh->gh_gl->gl_name.ln_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) __entry->queue = queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) __entry->state = glock_trace_state(gh->gh_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) TP_printk("%u,%u glock %u:%llu %squeue %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) (unsigned long long)__entry->glnum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) __entry->queue ? "" : "de",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) glock_trace_name(__entry->state))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) /* DLM sends a reply to GFS2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) TRACE_EVENT(gfs2_glock_lock_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) TP_PROTO(const struct gfs2_glock *gl, s64 tdiff),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) TP_ARGS(gl, tdiff),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) __field( u64, glnum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) __field( u32, gltype )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) __field( int, status )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) __field( char, flags )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) __field( s64, tdiff )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) __field( u64, srtt )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) __field( u64, srttvar )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) __field( u64, srttb )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) __field( u64, srttvarb )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) __field( u64, sirt )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) __field( u64, sirtvar )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) __field( u64, dcount )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) __field( u64, qcount )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) __entry->glnum = gl->gl_name.ln_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) __entry->gltype = gl->gl_name.ln_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) __entry->status = gl->gl_lksb.sb_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) __entry->flags = gl->gl_lksb.sb_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) __entry->tdiff = tdiff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) __entry->srtt = gl->gl_stats.stats[GFS2_LKS_SRTT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) __entry->srttvar = gl->gl_stats.stats[GFS2_LKS_SRTTVAR];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) __entry->srttb = gl->gl_stats.stats[GFS2_LKS_SRTTB];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) __entry->srttvarb = gl->gl_stats.stats[GFS2_LKS_SRTTVARB];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) __entry->sirt = gl->gl_stats.stats[GFS2_LKS_SIRT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) __entry->sirtvar = gl->gl_stats.stats[GFS2_LKS_SIRTVAR];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) __entry->dcount = gl->gl_stats.stats[GFS2_LKS_DCOUNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) __entry->qcount = gl->gl_stats.stats[GFS2_LKS_QCOUNT];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) TP_printk("%u,%u glock %d:%lld status:%d flags:%02x tdiff:%lld srtt:%lld/%lld srttb:%lld/%lld sirt:%lld/%lld dcnt:%lld qcnt:%lld",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) (unsigned long long)__entry->glnum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) __entry->status, __entry->flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) (long long)__entry->tdiff,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) (long long)__entry->srtt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) (long long)__entry->srttvar,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) (long long)__entry->srttb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) (long long)__entry->srttvarb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) (long long)__entry->sirt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) (long long)__entry->sirtvar,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) (long long)__entry->dcount,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) (long long)__entry->qcount)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) /* Section 2 - Log/journal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) * Objectives:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) * Latency: Log flush time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) * Correctness: pin/unpin vs. disk I/O ordering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) * Performance: Log usage stats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) /* Pin/unpin a block in the log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) TRACE_EVENT(gfs2_pin,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) TP_PROTO(const struct gfs2_bufdata *bd, int pin),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) TP_ARGS(bd, pin),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) __field( int, pin )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) __field( u32, len )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) __field( sector_t, block )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) __field( u64, ino )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) __entry->dev = bd->bd_gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) __entry->pin = pin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) __entry->len = bd->bd_bh->b_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) __entry->block = bd->bd_bh->b_blocknr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) __entry->ino = bd->bd_gl->gl_name.ln_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) TP_printk("%u,%u log %s %llu/%lu inode %llu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) MAJOR(__entry->dev), MINOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) __entry->pin ? "pin" : "unpin",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) (unsigned long long)__entry->block,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) (unsigned long)__entry->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) (unsigned long long)__entry->ino)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) /* Flushing the log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) TRACE_EVENT(gfs2_log_flush,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) TP_PROTO(const struct gfs2_sbd *sdp, int start, u32 flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) TP_ARGS(sdp, start, flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) __field( int, start )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) __field( u64, log_seq )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) __field( u32, flags )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) __entry->dev = sdp->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) __entry->start = start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) __entry->log_seq = sdp->sd_log_sequence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) __entry->flags = flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) TP_printk("%u,%u log flush %s %llu %llx",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) MAJOR(__entry->dev), MINOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) __entry->start ? "start" : "end",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) (unsigned long long)__entry->log_seq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) (unsigned long long)__entry->flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) /* Reserving/releasing blocks in the log */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) TRACE_EVENT(gfs2_log_blocks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) TP_PROTO(const struct gfs2_sbd *sdp, int blocks),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) TP_ARGS(sdp, blocks),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) __field( int, blocks )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) __field( int, blks_free )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) __entry->dev = sdp->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) __entry->blocks = blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) __entry->blks_free = atomic_read(&sdp->sd_log_blks_free);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) TP_printk("%u,%u log reserve %d %d", MAJOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) MINOR(__entry->dev), __entry->blocks, __entry->blks_free)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) /* Writing back the AIL */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) TRACE_EVENT(gfs2_ail_flush,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) TP_PROTO(const struct gfs2_sbd *sdp, const struct writeback_control *wbc, int start),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) TP_ARGS(sdp, wbc, start),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) __field( int, start )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) __field( int, sync_mode )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) __field( long, nr_to_write )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) __entry->dev = sdp->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) __entry->start = start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) __entry->sync_mode = wbc->sync_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) __entry->nr_to_write = wbc->nr_to_write;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) TP_printk("%u,%u ail flush %s %s %ld", MAJOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) MINOR(__entry->dev), __entry->start ? "start" : "end",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) __entry->sync_mode == WB_SYNC_ALL ? "all" : "none",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) __entry->nr_to_write)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) /* Section 3 - bmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * Objectives:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * Latency: Bmap request time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * Performance: Block allocator tracing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * Correctness: Test of disard generation vs. blocks allocated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) /* Map an extent of blocks, possibly a new allocation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) TRACE_EVENT(gfs2_bmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) TP_PROTO(const struct gfs2_inode *ip, const struct buffer_head *bh,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) sector_t lblock, int create, int errno),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) TP_ARGS(ip, bh, lblock, create, errno),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) __field( sector_t, lblock )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) __field( sector_t, pblock )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) __field( u64, inum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) __field( unsigned long, state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) __field( u32, len )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) __field( int, create )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) __field( int, errno )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) __entry->lblock = lblock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) __entry->pblock = buffer_mapped(bh) ? bh->b_blocknr : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) __entry->inum = ip->i_no_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) __entry->state = bh->b_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) __entry->len = bh->b_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) __entry->create = create;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) __entry->errno = errno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) TP_printk("%u,%u bmap %llu map %llu/%lu to %llu flags:%08lx %s %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) MAJOR(__entry->dev), MINOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) (unsigned long long)__entry->inum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) (unsigned long long)__entry->lblock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) (unsigned long)__entry->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) (unsigned long long)__entry->pblock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) __entry->state, __entry->create ? "create " : "nocreate",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) __entry->errno)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) TRACE_EVENT(gfs2_iomap_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) TP_PROTO(const struct gfs2_inode *ip, loff_t pos, ssize_t length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) u16 flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) TP_ARGS(ip, pos, length, flags),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) __field( u64, inum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) __field( loff_t, pos )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) __field( ssize_t, length )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) __field( u16, flags )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) __entry->inum = ip->i_no_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) __entry->pos = pos;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) __entry->length = length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) __entry->flags = flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) TP_printk("%u,%u bmap %llu iomap start %llu/%lu flags:%08x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) MAJOR(__entry->dev), MINOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) (unsigned long long)__entry->inum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) (unsigned long long)__entry->pos,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) (unsigned long)__entry->length, (u16)__entry->flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) TRACE_EVENT(gfs2_iomap_end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) TP_PROTO(const struct gfs2_inode *ip, struct iomap *iomap, int ret),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) TP_ARGS(ip, iomap, ret),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) __field( u64, inum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) __field( loff_t, offset )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) __field( ssize_t, length )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) __field( sector_t, pblock )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) __field( u16, flags )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) __field( u16, type )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) __field( int, ret )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) __entry->inum = ip->i_no_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) __entry->offset = iomap->offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) __entry->length = iomap->length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) __entry->pblock = iomap->addr == IOMAP_NULL_ADDR ? 0 :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) (iomap->addr >> ip->i_inode.i_blkbits);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) __entry->flags = iomap->flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) __entry->type = iomap->type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) __entry->ret = ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) TP_printk("%u,%u bmap %llu iomap end %llu/%lu to %llu ty:%d flags:%08x rc:%d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) MAJOR(__entry->dev), MINOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) (unsigned long long)__entry->inum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) (unsigned long long)__entry->offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) (unsigned long)__entry->length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) (long long)__entry->pblock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) (u16)__entry->type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) (u16)__entry->flags, __entry->ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) /* Keep track of blocks as they are allocated/freed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) TRACE_EVENT(gfs2_block_alloc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) TP_PROTO(const struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) u64 block, unsigned len, u8 block_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) TP_ARGS(ip, rgd, block, len, block_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) __field( u64, start )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) __field( u64, inum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) __field( u32, len )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) __field( u8, block_state )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) __field( u64, rd_addr )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) __field( u32, rd_free_clone )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) __field( u32, rd_reserved )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) __entry->dev = rgd->rd_gl->gl_name.ln_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) __entry->start = block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) __entry->inum = ip->i_no_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) __entry->len = len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) __entry->block_state = block_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) __entry->rd_addr = rgd->rd_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) __entry->rd_free_clone = rgd->rd_free_clone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) __entry->rd_reserved = rgd->rd_reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) TP_printk("%u,%u bmap %llu alloc %llu/%lu %s rg:%llu rf:%u rr:%lu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) MAJOR(__entry->dev), MINOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) (unsigned long long)__entry->inum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) (unsigned long long)__entry->start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) (unsigned long)__entry->len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) block_state_name(__entry->block_state),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) (unsigned long long)__entry->rd_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) __entry->rd_free_clone, (unsigned long)__entry->rd_reserved)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) /* Keep track of multi-block reservations as they are allocated/freed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) TRACE_EVENT(gfs2_rs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) TP_PROTO(const struct gfs2_blkreserv *rs, u8 func),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) TP_ARGS(rs, func),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) __field( dev_t, dev )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) __field( u64, rd_addr )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) __field( u32, rd_free_clone )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) __field( u32, rd_reserved )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) __field( u64, inum )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) __field( u64, start )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) __field( u32, free )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) __field( u8, func )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) __entry->dev = rs->rs_rbm.rgd->rd_sbd->sd_vfs->s_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) __entry->rd_addr = rs->rs_rbm.rgd->rd_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) __entry->rd_free_clone = rs->rs_rbm.rgd->rd_free_clone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) __entry->rd_reserved = rs->rs_rbm.rgd->rd_reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) __entry->inum = container_of(rs, struct gfs2_inode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) i_res)->i_no_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) __entry->start = gfs2_rbm_to_block(&rs->rs_rbm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) __entry->free = rs->rs_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) __entry->func = func;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) TP_printk("%u,%u bmap %llu resrv %llu rg:%llu rf:%lu rr:%lu %s f:%lu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) MAJOR(__entry->dev), MINOR(__entry->dev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) (unsigned long long)__entry->inum,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) (unsigned long long)__entry->start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) (unsigned long long)__entry->rd_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) (unsigned long)__entry->rd_free_clone,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) (unsigned long)__entry->rd_reserved,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) rs_func_name(__entry->func), (unsigned long)__entry->free)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) #endif /* _TRACE_GFS2_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) #undef TRACE_INCLUDE_PATH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) #define TRACE_INCLUDE_PATH .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) #define TRACE_INCLUDE_FILE trace_gfs2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) #include <trace/define_trace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634)