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