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