1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2d0b6e04aSLi Zefan #undef TRACE_SYSTEM 3d0b6e04aSLi Zefan #define TRACE_SYSTEM gfs2 4d0b6e04aSLi Zefan 563997775SSteven Whitehouse #if !defined(_TRACE_GFS2_H) || defined(TRACE_HEADER_MULTI_READ) 663997775SSteven Whitehouse #define _TRACE_GFS2_H 763997775SSteven Whitehouse 863997775SSteven Whitehouse #include <linux/tracepoint.h> 963997775SSteven Whitehouse 1063997775SSteven Whitehouse #include <linux/fs.h> 1163997775SSteven Whitehouse #include <linux/buffer_head.h> 1263997775SSteven Whitehouse #include <linux/dlmconstants.h> 1363997775SSteven Whitehouse #include <linux/gfs2_ondisk.h> 14c83ae9caSSteven Whitehouse #include <linux/writeback.h> 15a245769fSSteven Whitehouse #include <linux/ktime.h> 163974320cSBob Peterson #include <linux/iomap.h> 1763997775SSteven Whitehouse #include "incore.h" 1863997775SSteven Whitehouse #include "glock.h" 198e2e0047SBob Peterson #include "rgrp.h" 2063997775SSteven Whitehouse 2163997775SSteven Whitehouse #define dlm_state_name(nn) { DLM_LOCK_##nn, #nn } 2263997775SSteven Whitehouse #define glock_trace_name(x) __print_symbolic(x, \ 2363997775SSteven Whitehouse dlm_state_name(IV), \ 2463997775SSteven Whitehouse dlm_state_name(NL), \ 2563997775SSteven Whitehouse dlm_state_name(CR), \ 2663997775SSteven Whitehouse dlm_state_name(CW), \ 2763997775SSteven Whitehouse dlm_state_name(PR), \ 2863997775SSteven Whitehouse dlm_state_name(PW), \ 2963997775SSteven Whitehouse dlm_state_name(EX)) 3063997775SSteven Whitehouse 3163997775SSteven Whitehouse #define block_state_name(x) __print_symbolic(x, \ 3263997775SSteven Whitehouse { GFS2_BLKST_FREE, "free" }, \ 3363997775SSteven Whitehouse { GFS2_BLKST_USED, "used" }, \ 3463997775SSteven Whitehouse { GFS2_BLKST_DINODE, "dinode" }, \ 3563997775SSteven Whitehouse { GFS2_BLKST_UNLINKED, "unlinked" }) 3663997775SSteven Whitehouse 378e2e0047SBob Peterson #define TRACE_RS_DELETE 0 388e2e0047SBob Peterson #define TRACE_RS_TREEDEL 1 398e2e0047SBob Peterson #define TRACE_RS_INSERT 2 408e2e0047SBob Peterson #define TRACE_RS_CLAIM 3 418e2e0047SBob Peterson 428e2e0047SBob Peterson #define rs_func_name(x) __print_symbolic(x, \ 438e2e0047SBob Peterson { 0, "del " }, \ 448e2e0047SBob Peterson { 1, "tdel" }, \ 458e2e0047SBob Peterson { 2, "ins " }, \ 468e2e0047SBob Peterson { 3, "clm " }) 478e2e0047SBob Peterson 4863997775SSteven Whitehouse #define show_glock_flags(flags) __print_flags(flags, "", \ 4963997775SSteven Whitehouse {(1UL << GLF_LOCK), "l" }, \ 5063997775SSteven Whitehouse {(1UL << GLF_DEMOTE), "D" }, \ 5163997775SSteven Whitehouse {(1UL << GLF_PENDING_DEMOTE), "d" }, \ 5263997775SSteven Whitehouse {(1UL << GLF_DEMOTE_IN_PROGRESS), "p" }, \ 5363997775SSteven Whitehouse {(1UL << GLF_DIRTY), "y" }, \ 5463997775SSteven Whitehouse {(1UL << GLF_LFLUSH), "f" }, \ 5563997775SSteven Whitehouse {(1UL << GLF_INVALIDATE_IN_PROGRESS), "i" }, \ 5663997775SSteven Whitehouse {(1UL << GLF_REPLY_PENDING), "r" }, \ 5763997775SSteven Whitehouse {(1UL << GLF_INITIAL), "I" }, \ 587b5e3d5fSSteven Whitehouse {(1UL << GLF_FROZEN), "F" }, \ 59627c10b7SSteven Whitehouse {(1UL << GLF_QUEUED), "q" }, \ 60627c10b7SSteven Whitehouse {(1UL << GLF_LRU), "L" }, \ 61a245769fSSteven Whitehouse {(1UL << GLF_OBJECT), "o" }, \ 62a245769fSSteven Whitehouse {(1UL << GLF_BLOCKING), "b" }) 6363997775SSteven Whitehouse 6463997775SSteven Whitehouse #ifndef NUMPTY 6563997775SSteven Whitehouse #define NUMPTY 6663997775SSteven Whitehouse static inline u8 glock_trace_state(unsigned int state) 6763997775SSteven Whitehouse { 6863997775SSteven Whitehouse switch(state) { 6963997775SSteven Whitehouse case LM_ST_SHARED: 7063997775SSteven Whitehouse return DLM_LOCK_PR; 7163997775SSteven Whitehouse case LM_ST_DEFERRED: 7263997775SSteven Whitehouse return DLM_LOCK_CW; 7363997775SSteven Whitehouse case LM_ST_EXCLUSIVE: 7463997775SSteven Whitehouse return DLM_LOCK_EX; 7563997775SSteven Whitehouse } 7663997775SSteven Whitehouse return DLM_LOCK_NL; 7763997775SSteven Whitehouse } 7863997775SSteven Whitehouse #endif 7963997775SSteven Whitehouse 8063997775SSteven Whitehouse /* Section 1 - Locking 8163997775SSteven Whitehouse * 8263997775SSteven Whitehouse * Objectives: 8363997775SSteven Whitehouse * Latency: Remote demote request to state change 8463997775SSteven Whitehouse * Latency: Local lock request to state change 8563997775SSteven Whitehouse * Latency: State change to lock grant 8663997775SSteven Whitehouse * Correctness: Ordering of local lock state vs. I/O requests 8763997775SSteven Whitehouse * Correctness: Responses to remote demote requests 8863997775SSteven Whitehouse */ 8963997775SSteven Whitehouse 9063997775SSteven Whitehouse /* General glock state change (DLM lock request completes) */ 9163997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_state_change, 9263997775SSteven Whitehouse 9363997775SSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, unsigned int new_state), 9463997775SSteven Whitehouse 9563997775SSteven Whitehouse TP_ARGS(gl, new_state), 9663997775SSteven Whitehouse 9763997775SSteven Whitehouse TP_STRUCT__entry( 9863997775SSteven Whitehouse __field( dev_t, dev ) 9963997775SSteven Whitehouse __field( u64, glnum ) 10063997775SSteven Whitehouse __field( u32, gltype ) 10163997775SSteven Whitehouse __field( u8, cur_state ) 10263997775SSteven Whitehouse __field( u8, new_state ) 10363997775SSteven Whitehouse __field( u8, dmt_state ) 10463997775SSteven Whitehouse __field( u8, tgt_state ) 10563997775SSteven Whitehouse __field( unsigned long, flags ) 10663997775SSteven Whitehouse ), 10763997775SSteven Whitehouse 10863997775SSteven Whitehouse TP_fast_assign( 10915562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; 11063997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number; 11163997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type; 11263997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state); 11363997775SSteven Whitehouse __entry->new_state = glock_trace_state(new_state); 11463997775SSteven Whitehouse __entry->tgt_state = glock_trace_state(gl->gl_target); 11563997775SSteven Whitehouse __entry->dmt_state = glock_trace_state(gl->gl_demote_state); 116627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0); 11763997775SSteven Whitehouse ), 11863997775SSteven Whitehouse 11963997775SSteven Whitehouse TP_printk("%u,%u glock %d:%lld state %s to %s tgt:%s dmt:%s flags:%s", 12063997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 12163997775SSteven Whitehouse (unsigned long long)__entry->glnum, 12263997775SSteven Whitehouse glock_trace_name(__entry->cur_state), 12363997775SSteven Whitehouse glock_trace_name(__entry->new_state), 12463997775SSteven Whitehouse glock_trace_name(__entry->tgt_state), 12563997775SSteven Whitehouse glock_trace_name(__entry->dmt_state), 12663997775SSteven Whitehouse show_glock_flags(__entry->flags)) 12763997775SSteven Whitehouse ); 12863997775SSteven Whitehouse 12963997775SSteven Whitehouse /* State change -> unlocked, glock is being deallocated */ 13063997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_put, 13163997775SSteven Whitehouse 13263997775SSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl), 13363997775SSteven Whitehouse 13463997775SSteven Whitehouse TP_ARGS(gl), 13563997775SSteven Whitehouse 13663997775SSteven Whitehouse TP_STRUCT__entry( 13763997775SSteven Whitehouse __field( dev_t, dev ) 13863997775SSteven Whitehouse __field( u64, glnum ) 13963997775SSteven Whitehouse __field( u32, gltype ) 14063997775SSteven Whitehouse __field( u8, cur_state ) 14163997775SSteven Whitehouse __field( unsigned long, flags ) 14263997775SSteven Whitehouse ), 14363997775SSteven Whitehouse 14463997775SSteven Whitehouse TP_fast_assign( 14515562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; 14663997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type; 14763997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number; 14863997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state); 149627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0); 15063997775SSteven Whitehouse ), 15163997775SSteven Whitehouse 15263997775SSteven Whitehouse TP_printk("%u,%u glock %d:%lld state %s => %s flags:%s", 15363997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 15463997775SSteven Whitehouse __entry->gltype, (unsigned long long)__entry->glnum, 15563997775SSteven Whitehouse glock_trace_name(__entry->cur_state), 15663997775SSteven Whitehouse glock_trace_name(DLM_LOCK_IV), 15763997775SSteven Whitehouse show_glock_flags(__entry->flags)) 15863997775SSteven Whitehouse 15963997775SSteven Whitehouse ); 16063997775SSteven Whitehouse 16163997775SSteven Whitehouse /* Callback (local or remote) requesting lock demotion */ 16263997775SSteven Whitehouse TRACE_EVENT(gfs2_demote_rq, 16363997775SSteven Whitehouse 1647bd8b2ebSSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, bool remote), 16563997775SSteven Whitehouse 1667bd8b2ebSSteven Whitehouse TP_ARGS(gl, remote), 16763997775SSteven Whitehouse 16863997775SSteven Whitehouse TP_STRUCT__entry( 16963997775SSteven Whitehouse __field( dev_t, dev ) 17063997775SSteven Whitehouse __field( u64, glnum ) 17163997775SSteven Whitehouse __field( u32, gltype ) 17263997775SSteven Whitehouse __field( u8, cur_state ) 17363997775SSteven Whitehouse __field( u8, dmt_state ) 17463997775SSteven Whitehouse __field( unsigned long, flags ) 1757bd8b2ebSSteven Whitehouse __field( bool, remote ) 17663997775SSteven Whitehouse ), 17763997775SSteven Whitehouse 17863997775SSteven Whitehouse TP_fast_assign( 17915562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; 18063997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type; 18163997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number; 18263997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state); 18363997775SSteven Whitehouse __entry->dmt_state = glock_trace_state(gl->gl_demote_state); 184627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0); 1857bd8b2ebSSteven Whitehouse __entry->remote = remote; 18663997775SSteven Whitehouse ), 18763997775SSteven Whitehouse 1887bd8b2ebSSteven Whitehouse TP_printk("%u,%u glock %d:%lld demote %s to %s flags:%s %s", 18963997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 19063997775SSteven Whitehouse (unsigned long long)__entry->glnum, 19163997775SSteven Whitehouse glock_trace_name(__entry->cur_state), 19263997775SSteven Whitehouse glock_trace_name(__entry->dmt_state), 1937bd8b2ebSSteven Whitehouse show_glock_flags(__entry->flags), 1947bd8b2ebSSteven Whitehouse __entry->remote ? "remote" : "local") 19563997775SSteven Whitehouse 19663997775SSteven Whitehouse ); 19763997775SSteven Whitehouse 19863997775SSteven Whitehouse /* Promotion/grant of a glock */ 19963997775SSteven Whitehouse TRACE_EVENT(gfs2_promote, 20063997775SSteven Whitehouse 20163997775SSteven Whitehouse TP_PROTO(const struct gfs2_holder *gh, int first), 20263997775SSteven Whitehouse 20363997775SSteven Whitehouse TP_ARGS(gh, first), 20463997775SSteven Whitehouse 20563997775SSteven Whitehouse TP_STRUCT__entry( 20663997775SSteven Whitehouse __field( dev_t, dev ) 20763997775SSteven Whitehouse __field( u64, glnum ) 20863997775SSteven Whitehouse __field( u32, gltype ) 20963997775SSteven Whitehouse __field( int, first ) 21063997775SSteven Whitehouse __field( u8, state ) 21163997775SSteven Whitehouse ), 21263997775SSteven Whitehouse 21363997775SSteven Whitehouse TP_fast_assign( 21415562c43SBob Peterson __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev; 21563997775SSteven Whitehouse __entry->glnum = gh->gh_gl->gl_name.ln_number; 21663997775SSteven Whitehouse __entry->gltype = gh->gh_gl->gl_name.ln_type; 21763997775SSteven Whitehouse __entry->first = first; 21863997775SSteven Whitehouse __entry->state = glock_trace_state(gh->gh_state); 21963997775SSteven Whitehouse ), 22063997775SSteven Whitehouse 22163997775SSteven Whitehouse TP_printk("%u,%u glock %u:%llu promote %s %s", 22263997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 22363997775SSteven Whitehouse (unsigned long long)__entry->glnum, 22463997775SSteven Whitehouse __entry->first ? "first": "other", 22563997775SSteven Whitehouse glock_trace_name(__entry->state)) 22663997775SSteven Whitehouse ); 22763997775SSteven Whitehouse 22863997775SSteven Whitehouse /* Queue/dequeue a lock request */ 22963997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_queue, 23063997775SSteven Whitehouse 23163997775SSteven Whitehouse TP_PROTO(const struct gfs2_holder *gh, int queue), 23263997775SSteven Whitehouse 23363997775SSteven Whitehouse TP_ARGS(gh, queue), 23463997775SSteven Whitehouse 23563997775SSteven Whitehouse TP_STRUCT__entry( 23663997775SSteven Whitehouse __field( dev_t, dev ) 23763997775SSteven Whitehouse __field( u64, glnum ) 23863997775SSteven Whitehouse __field( u32, gltype ) 23963997775SSteven Whitehouse __field( int, queue ) 24063997775SSteven Whitehouse __field( u8, state ) 24163997775SSteven Whitehouse ), 24263997775SSteven Whitehouse 24363997775SSteven Whitehouse TP_fast_assign( 24415562c43SBob Peterson __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev; 24563997775SSteven Whitehouse __entry->glnum = gh->gh_gl->gl_name.ln_number; 24663997775SSteven Whitehouse __entry->gltype = gh->gh_gl->gl_name.ln_type; 24763997775SSteven Whitehouse __entry->queue = queue; 24863997775SSteven Whitehouse __entry->state = glock_trace_state(gh->gh_state); 24963997775SSteven Whitehouse ), 25063997775SSteven Whitehouse 25163997775SSteven Whitehouse TP_printk("%u,%u glock %u:%llu %squeue %s", 25263997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 25363997775SSteven Whitehouse (unsigned long long)__entry->glnum, 25463997775SSteven Whitehouse __entry->queue ? "" : "de", 25563997775SSteven Whitehouse glock_trace_name(__entry->state)) 25663997775SSteven Whitehouse ); 25763997775SSteven Whitehouse 258a245769fSSteven Whitehouse /* DLM sends a reply to GFS2 */ 259a245769fSSteven Whitehouse TRACE_EVENT(gfs2_glock_lock_time, 260a245769fSSteven Whitehouse 261a245769fSSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, s64 tdiff), 262a245769fSSteven Whitehouse 263a245769fSSteven Whitehouse TP_ARGS(gl, tdiff), 264a245769fSSteven Whitehouse 265a245769fSSteven Whitehouse TP_STRUCT__entry( 266a245769fSSteven Whitehouse __field( dev_t, dev ) 267a245769fSSteven Whitehouse __field( u64, glnum ) 268a245769fSSteven Whitehouse __field( u32, gltype ) 269a245769fSSteven Whitehouse __field( int, status ) 270a245769fSSteven Whitehouse __field( char, flags ) 271a245769fSSteven Whitehouse __field( s64, tdiff ) 2724d207133SBen Hutchings __field( u64, srtt ) 2734d207133SBen Hutchings __field( u64, srttvar ) 2744d207133SBen Hutchings __field( u64, srttb ) 2754d207133SBen Hutchings __field( u64, srttvarb ) 2764d207133SBen Hutchings __field( u64, sirt ) 2774d207133SBen Hutchings __field( u64, sirtvar ) 2784d207133SBen Hutchings __field( u64, dcount ) 2794d207133SBen Hutchings __field( u64, qcount ) 280a245769fSSteven Whitehouse ), 281a245769fSSteven Whitehouse 282a245769fSSteven Whitehouse TP_fast_assign( 28315562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; 284a245769fSSteven Whitehouse __entry->glnum = gl->gl_name.ln_number; 285a245769fSSteven Whitehouse __entry->gltype = gl->gl_name.ln_type; 286a245769fSSteven Whitehouse __entry->status = gl->gl_lksb.sb_status; 287a245769fSSteven Whitehouse __entry->flags = gl->gl_lksb.sb_flags; 288a245769fSSteven Whitehouse __entry->tdiff = tdiff; 289a245769fSSteven Whitehouse __entry->srtt = gl->gl_stats.stats[GFS2_LKS_SRTT]; 290a245769fSSteven Whitehouse __entry->srttvar = gl->gl_stats.stats[GFS2_LKS_SRTTVAR]; 291a245769fSSteven Whitehouse __entry->srttb = gl->gl_stats.stats[GFS2_LKS_SRTTB]; 292a245769fSSteven Whitehouse __entry->srttvarb = gl->gl_stats.stats[GFS2_LKS_SRTTVARB]; 293a245769fSSteven Whitehouse __entry->sirt = gl->gl_stats.stats[GFS2_LKS_SIRT]; 294a245769fSSteven Whitehouse __entry->sirtvar = gl->gl_stats.stats[GFS2_LKS_SIRTVAR]; 295a245769fSSteven Whitehouse __entry->dcount = gl->gl_stats.stats[GFS2_LKS_DCOUNT]; 296a245769fSSteven Whitehouse __entry->qcount = gl->gl_stats.stats[GFS2_LKS_QCOUNT]; 297a245769fSSteven Whitehouse ), 298a245769fSSteven Whitehouse 299a245769fSSteven Whitehouse 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", 300a245769fSSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 301a245769fSSteven Whitehouse (unsigned long long)__entry->glnum, 302a245769fSSteven Whitehouse __entry->status, __entry->flags, 303a245769fSSteven Whitehouse (long long)__entry->tdiff, 304a245769fSSteven Whitehouse (long long)__entry->srtt, 305a245769fSSteven Whitehouse (long long)__entry->srttvar, 306a245769fSSteven Whitehouse (long long)__entry->srttb, 307a245769fSSteven Whitehouse (long long)__entry->srttvarb, 308a245769fSSteven Whitehouse (long long)__entry->sirt, 309a245769fSSteven Whitehouse (long long)__entry->sirtvar, 310a245769fSSteven Whitehouse (long long)__entry->dcount, 311a245769fSSteven Whitehouse (long long)__entry->qcount) 312a245769fSSteven Whitehouse ); 313a245769fSSteven Whitehouse 31463997775SSteven Whitehouse /* Section 2 - Log/journal 31563997775SSteven Whitehouse * 31663997775SSteven Whitehouse * Objectives: 31763997775SSteven Whitehouse * Latency: Log flush time 31863997775SSteven Whitehouse * Correctness: pin/unpin vs. disk I/O ordering 31963997775SSteven Whitehouse * Performance: Log usage stats 32063997775SSteven Whitehouse */ 32163997775SSteven Whitehouse 32263997775SSteven Whitehouse /* Pin/unpin a block in the log */ 32363997775SSteven Whitehouse TRACE_EVENT(gfs2_pin, 32463997775SSteven Whitehouse 32563997775SSteven Whitehouse TP_PROTO(const struct gfs2_bufdata *bd, int pin), 32663997775SSteven Whitehouse 32763997775SSteven Whitehouse TP_ARGS(bd, pin), 32863997775SSteven Whitehouse 32963997775SSteven Whitehouse TP_STRUCT__entry( 33063997775SSteven Whitehouse __field( dev_t, dev ) 33163997775SSteven Whitehouse __field( int, pin ) 33263997775SSteven Whitehouse __field( u32, len ) 33363997775SSteven Whitehouse __field( sector_t, block ) 33463997775SSteven Whitehouse __field( u64, ino ) 33563997775SSteven Whitehouse ), 33663997775SSteven Whitehouse 33763997775SSteven Whitehouse TP_fast_assign( 33815562c43SBob Peterson __entry->dev = bd->bd_gl->gl_name.ln_sbd->sd_vfs->s_dev; 33963997775SSteven Whitehouse __entry->pin = pin; 34063997775SSteven Whitehouse __entry->len = bd->bd_bh->b_size; 34163997775SSteven Whitehouse __entry->block = bd->bd_bh->b_blocknr; 34263997775SSteven Whitehouse __entry->ino = bd->bd_gl->gl_name.ln_number; 34363997775SSteven Whitehouse ), 34463997775SSteven Whitehouse 34563997775SSteven Whitehouse TP_printk("%u,%u log %s %llu/%lu inode %llu", 34663997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 34763997775SSteven Whitehouse __entry->pin ? "pin" : "unpin", 34863997775SSteven Whitehouse (unsigned long long)__entry->block, 34963997775SSteven Whitehouse (unsigned long)__entry->len, 35063997775SSteven Whitehouse (unsigned long long)__entry->ino) 35163997775SSteven Whitehouse ); 35263997775SSteven Whitehouse 35363997775SSteven Whitehouse /* Flushing the log */ 35463997775SSteven Whitehouse TRACE_EVENT(gfs2_log_flush, 35563997775SSteven Whitehouse 356805c0907SBob Peterson TP_PROTO(const struct gfs2_sbd *sdp, int start, u32 flags), 35763997775SSteven Whitehouse 358805c0907SBob Peterson TP_ARGS(sdp, start, flags), 35963997775SSteven Whitehouse 36063997775SSteven Whitehouse TP_STRUCT__entry( 36163997775SSteven Whitehouse __field( dev_t, dev ) 36263997775SSteven Whitehouse __field( int, start ) 36363997775SSteven Whitehouse __field( u64, log_seq ) 364805c0907SBob Peterson __field( u32, flags ) 36563997775SSteven Whitehouse ), 36663997775SSteven Whitehouse 36763997775SSteven Whitehouse TP_fast_assign( 36863997775SSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev; 36963997775SSteven Whitehouse __entry->start = start; 37063997775SSteven Whitehouse __entry->log_seq = sdp->sd_log_sequence; 371805c0907SBob Peterson __entry->flags = flags; 37263997775SSteven Whitehouse ), 37363997775SSteven Whitehouse 374805c0907SBob Peterson TP_printk("%u,%u log flush %s %llu %llx", 37563997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 37663997775SSteven Whitehouse __entry->start ? "start" : "end", 377805c0907SBob Peterson (unsigned long long)__entry->log_seq, 378805c0907SBob Peterson (unsigned long long)__entry->flags) 37963997775SSteven Whitehouse ); 38063997775SSteven Whitehouse 38163997775SSteven Whitehouse /* Reserving/releasing blocks in the log */ 38263997775SSteven Whitehouse TRACE_EVENT(gfs2_log_blocks, 38363997775SSteven Whitehouse 38463997775SSteven Whitehouse TP_PROTO(const struct gfs2_sbd *sdp, int blocks), 38563997775SSteven Whitehouse 38663997775SSteven Whitehouse TP_ARGS(sdp, blocks), 38763997775SSteven Whitehouse 38863997775SSteven Whitehouse TP_STRUCT__entry( 38963997775SSteven Whitehouse __field( dev_t, dev ) 39063997775SSteven Whitehouse __field( int, blocks ) 39163997775SSteven Whitehouse ), 39263997775SSteven Whitehouse 39363997775SSteven Whitehouse TP_fast_assign( 39463997775SSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev; 39563997775SSteven Whitehouse __entry->blocks = blocks; 39663997775SSteven Whitehouse ), 39763997775SSteven Whitehouse 39863997775SSteven Whitehouse TP_printk("%u,%u log reserve %d", MAJOR(__entry->dev), 39963997775SSteven Whitehouse MINOR(__entry->dev), __entry->blocks) 40063997775SSteven Whitehouse ); 40163997775SSteven Whitehouse 402c83ae9caSSteven Whitehouse /* Writing back the AIL */ 403c83ae9caSSteven Whitehouse TRACE_EVENT(gfs2_ail_flush, 404c83ae9caSSteven Whitehouse 405c83ae9caSSteven Whitehouse TP_PROTO(const struct gfs2_sbd *sdp, const struct writeback_control *wbc, int start), 406c83ae9caSSteven Whitehouse 407c83ae9caSSteven Whitehouse TP_ARGS(sdp, wbc, start), 408c83ae9caSSteven Whitehouse 409c83ae9caSSteven Whitehouse TP_STRUCT__entry( 410c83ae9caSSteven Whitehouse __field( dev_t, dev ) 411c83ae9caSSteven Whitehouse __field( int, start ) 412c83ae9caSSteven Whitehouse __field( int, sync_mode ) 413c83ae9caSSteven Whitehouse __field( long, nr_to_write ) 414c83ae9caSSteven Whitehouse ), 415c83ae9caSSteven Whitehouse 416c83ae9caSSteven Whitehouse TP_fast_assign( 417c83ae9caSSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev; 418c83ae9caSSteven Whitehouse __entry->start = start; 419c83ae9caSSteven Whitehouse __entry->sync_mode = wbc->sync_mode; 420c83ae9caSSteven Whitehouse __entry->nr_to_write = wbc->nr_to_write; 421c83ae9caSSteven Whitehouse ), 422c83ae9caSSteven Whitehouse 423c83ae9caSSteven Whitehouse TP_printk("%u,%u ail flush %s %s %ld", MAJOR(__entry->dev), 424c83ae9caSSteven Whitehouse MINOR(__entry->dev), __entry->start ? "start" : "end", 425c83ae9caSSteven Whitehouse __entry->sync_mode == WB_SYNC_ALL ? "all" : "none", 426c83ae9caSSteven Whitehouse __entry->nr_to_write) 427c83ae9caSSteven Whitehouse ); 428c83ae9caSSteven Whitehouse 42963997775SSteven Whitehouse /* Section 3 - bmap 43063997775SSteven Whitehouse * 43163997775SSteven Whitehouse * Objectives: 43263997775SSteven Whitehouse * Latency: Bmap request time 43363997775SSteven Whitehouse * Performance: Block allocator tracing 43463997775SSteven Whitehouse * Correctness: Test of disard generation vs. blocks allocated 43563997775SSteven Whitehouse */ 43663997775SSteven Whitehouse 43763997775SSteven Whitehouse /* Map an extent of blocks, possibly a new allocation */ 43863997775SSteven Whitehouse TRACE_EVENT(gfs2_bmap, 43963997775SSteven Whitehouse 44063997775SSteven Whitehouse TP_PROTO(const struct gfs2_inode *ip, const struct buffer_head *bh, 44163997775SSteven Whitehouse sector_t lblock, int create, int errno), 44263997775SSteven Whitehouse 44363997775SSteven Whitehouse TP_ARGS(ip, bh, lblock, create, errno), 44463997775SSteven Whitehouse 44563997775SSteven Whitehouse TP_STRUCT__entry( 44663997775SSteven Whitehouse __field( dev_t, dev ) 44763997775SSteven Whitehouse __field( sector_t, lblock ) 44863997775SSteven Whitehouse __field( sector_t, pblock ) 44963997775SSteven Whitehouse __field( u64, inum ) 45063997775SSteven Whitehouse __field( unsigned long, state ) 45163997775SSteven Whitehouse __field( u32, len ) 45263997775SSteven Whitehouse __field( int, create ) 45363997775SSteven Whitehouse __field( int, errno ) 45463997775SSteven Whitehouse ), 45563997775SSteven Whitehouse 45663997775SSteven Whitehouse TP_fast_assign( 45715562c43SBob Peterson __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev; 45863997775SSteven Whitehouse __entry->lblock = lblock; 45963997775SSteven Whitehouse __entry->pblock = buffer_mapped(bh) ? bh->b_blocknr : 0; 46063997775SSteven Whitehouse __entry->inum = ip->i_no_addr; 46163997775SSteven Whitehouse __entry->state = bh->b_state; 46263997775SSteven Whitehouse __entry->len = bh->b_size; 46363997775SSteven Whitehouse __entry->create = create; 46463997775SSteven Whitehouse __entry->errno = errno; 46563997775SSteven Whitehouse ), 46663997775SSteven Whitehouse 46763997775SSteven Whitehouse TP_printk("%u,%u bmap %llu map %llu/%lu to %llu flags:%08lx %s %d", 46863997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 46963997775SSteven Whitehouse (unsigned long long)__entry->inum, 47063997775SSteven Whitehouse (unsigned long long)__entry->lblock, 47163997775SSteven Whitehouse (unsigned long)__entry->len, 47263997775SSteven Whitehouse (unsigned long long)__entry->pblock, 47363997775SSteven Whitehouse __entry->state, __entry->create ? "create " : "nocreate", 47463997775SSteven Whitehouse __entry->errno) 47563997775SSteven Whitehouse ); 47663997775SSteven Whitehouse 4773974320cSBob Peterson TRACE_EVENT(gfs2_iomap_start, 4783974320cSBob Peterson 4793974320cSBob Peterson TP_PROTO(const struct gfs2_inode *ip, loff_t pos, ssize_t length, 4803974320cSBob Peterson u16 flags), 4813974320cSBob Peterson 4823974320cSBob Peterson TP_ARGS(ip, pos, length, flags), 4833974320cSBob Peterson 4843974320cSBob Peterson TP_STRUCT__entry( 4853974320cSBob Peterson __field( dev_t, dev ) 4863974320cSBob Peterson __field( u64, inum ) 4873974320cSBob Peterson __field( loff_t, pos ) 4883974320cSBob Peterson __field( ssize_t, length ) 4893974320cSBob Peterson __field( u16, flags ) 4903974320cSBob Peterson ), 4913974320cSBob Peterson 4923974320cSBob Peterson TP_fast_assign( 4933974320cSBob Peterson __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev; 4943974320cSBob Peterson __entry->inum = ip->i_no_addr; 4953974320cSBob Peterson __entry->pos = pos; 4963974320cSBob Peterson __entry->length = length; 4973974320cSBob Peterson __entry->flags = flags; 4983974320cSBob Peterson ), 4993974320cSBob Peterson 5003974320cSBob Peterson TP_printk("%u,%u bmap %llu iomap start %llu/%lu flags:%08x", 5013974320cSBob Peterson MAJOR(__entry->dev), MINOR(__entry->dev), 5023974320cSBob Peterson (unsigned long long)__entry->inum, 5033974320cSBob Peterson (unsigned long long)__entry->pos, 5043974320cSBob Peterson (unsigned long)__entry->length, (u16)__entry->flags) 5053974320cSBob Peterson ); 5063974320cSBob Peterson 5073974320cSBob Peterson TRACE_EVENT(gfs2_iomap_end, 5083974320cSBob Peterson 5093974320cSBob Peterson TP_PROTO(const struct gfs2_inode *ip, struct iomap *iomap, int ret), 5103974320cSBob Peterson 5113974320cSBob Peterson TP_ARGS(ip, iomap, ret), 5123974320cSBob Peterson 5133974320cSBob Peterson TP_STRUCT__entry( 5143974320cSBob Peterson __field( dev_t, dev ) 5153974320cSBob Peterson __field( u64, inum ) 5163974320cSBob Peterson __field( loff_t, offset ) 5173974320cSBob Peterson __field( ssize_t, length ) 518ee6ed857SAndreas Gruenbacher __field( sector_t, pblock ) 5193974320cSBob Peterson __field( u16, flags ) 5203974320cSBob Peterson __field( u16, type ) 5213974320cSBob Peterson __field( int, ret ) 5223974320cSBob Peterson ), 5233974320cSBob Peterson 5243974320cSBob Peterson TP_fast_assign( 5253974320cSBob Peterson __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev; 5263974320cSBob Peterson __entry->inum = ip->i_no_addr; 5273974320cSBob Peterson __entry->offset = iomap->offset; 5283974320cSBob Peterson __entry->length = iomap->length; 529ee6ed857SAndreas Gruenbacher __entry->pblock = iomap->addr == IOMAP_NULL_ADDR ? 0 : 530ee6ed857SAndreas Gruenbacher (iomap->addr >> ip->i_inode.i_blkbits); 5313974320cSBob Peterson __entry->flags = iomap->flags; 5323974320cSBob Peterson __entry->type = iomap->type; 5333974320cSBob Peterson __entry->ret = ret; 5343974320cSBob Peterson ), 5353974320cSBob Peterson 536ee6ed857SAndreas Gruenbacher TP_printk("%u,%u bmap %llu iomap end %llu/%lu to %llu ty:%d flags:%08x rc:%d", 5373974320cSBob Peterson MAJOR(__entry->dev), MINOR(__entry->dev), 5383974320cSBob Peterson (unsigned long long)__entry->inum, 5393974320cSBob Peterson (unsigned long long)__entry->offset, 540ee6ed857SAndreas Gruenbacher (unsigned long)__entry->length, 541ee6ed857SAndreas Gruenbacher (long long)__entry->pblock, 542ee6ed857SAndreas Gruenbacher (u16)__entry->type, 5433974320cSBob Peterson (u16)__entry->flags, __entry->ret) 5443974320cSBob Peterson ); 5453974320cSBob Peterson 54663997775SSteven Whitehouse /* Keep track of blocks as they are allocated/freed */ 54763997775SSteven Whitehouse TRACE_EVENT(gfs2_block_alloc, 54863997775SSteven Whitehouse 54941db1ab9SBob Peterson TP_PROTO(const struct gfs2_inode *ip, struct gfs2_rgrpd *rgd, 55041db1ab9SBob Peterson u64 block, unsigned len, u8 block_state), 55163997775SSteven Whitehouse 55241db1ab9SBob Peterson TP_ARGS(ip, rgd, block, len, block_state), 55363997775SSteven Whitehouse 55463997775SSteven Whitehouse TP_STRUCT__entry( 55563997775SSteven Whitehouse __field( dev_t, dev ) 55663997775SSteven Whitehouse __field( u64, start ) 55763997775SSteven Whitehouse __field( u64, inum ) 55863997775SSteven Whitehouse __field( u32, len ) 55963997775SSteven Whitehouse __field( u8, block_state ) 56041db1ab9SBob Peterson __field( u64, rd_addr ) 56141db1ab9SBob Peterson __field( u32, rd_free_clone ) 5628e2e0047SBob Peterson __field( u32, rd_reserved ) 56363997775SSteven Whitehouse ), 56463997775SSteven Whitehouse 56563997775SSteven Whitehouse TP_fast_assign( 56615562c43SBob Peterson __entry->dev = rgd->rd_gl->gl_name.ln_sbd->sd_vfs->s_dev; 56763997775SSteven Whitehouse __entry->start = block; 56863997775SSteven Whitehouse __entry->inum = ip->i_no_addr; 56963997775SSteven Whitehouse __entry->len = len; 57063997775SSteven Whitehouse __entry->block_state = block_state; 57141db1ab9SBob Peterson __entry->rd_addr = rgd->rd_addr; 57241db1ab9SBob Peterson __entry->rd_free_clone = rgd->rd_free_clone; 5738e2e0047SBob Peterson __entry->rd_reserved = rgd->rd_reserved; 57463997775SSteven Whitehouse ), 57563997775SSteven Whitehouse 5768e2e0047SBob Peterson TP_printk("%u,%u bmap %llu alloc %llu/%lu %s rg:%llu rf:%u rr:%lu", 57763997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 57863997775SSteven Whitehouse (unsigned long long)__entry->inum, 57963997775SSteven Whitehouse (unsigned long long)__entry->start, 58063997775SSteven Whitehouse (unsigned long)__entry->len, 58141db1ab9SBob Peterson block_state_name(__entry->block_state), 58241db1ab9SBob Peterson (unsigned long long)__entry->rd_addr, 5838e2e0047SBob Peterson __entry->rd_free_clone, (unsigned long)__entry->rd_reserved) 5848e2e0047SBob Peterson ); 5858e2e0047SBob Peterson 5868e2e0047SBob Peterson /* Keep track of multi-block reservations as they are allocated/freed */ 5878e2e0047SBob Peterson TRACE_EVENT(gfs2_rs, 5888e2e0047SBob Peterson 5899e733d39SSteven Whitehouse TP_PROTO(const struct gfs2_blkreserv *rs, u8 func), 5908e2e0047SBob Peterson 5919e733d39SSteven Whitehouse TP_ARGS(rs, func), 5928e2e0047SBob Peterson 5938e2e0047SBob Peterson TP_STRUCT__entry( 5948e2e0047SBob Peterson __field( dev_t, dev ) 5958e2e0047SBob Peterson __field( u64, rd_addr ) 5968e2e0047SBob Peterson __field( u32, rd_free_clone ) 5978e2e0047SBob Peterson __field( u32, rd_reserved ) 5988e2e0047SBob Peterson __field( u64, inum ) 5998e2e0047SBob Peterson __field( u64, start ) 6008e2e0047SBob Peterson __field( u32, free ) 6018e2e0047SBob Peterson __field( u8, func ) 6028e2e0047SBob Peterson ), 6038e2e0047SBob Peterson 6048e2e0047SBob Peterson TP_fast_assign( 6059e733d39SSteven Whitehouse __entry->dev = rs->rs_rbm.rgd->rd_sbd->sd_vfs->s_dev; 6069e733d39SSteven Whitehouse __entry->rd_addr = rs->rs_rbm.rgd->rd_addr; 6079e733d39SSteven Whitehouse __entry->rd_free_clone = rs->rs_rbm.rgd->rd_free_clone; 6089e733d39SSteven Whitehouse __entry->rd_reserved = rs->rs_rbm.rgd->rd_reserved; 609*f85c10e2SBob Peterson __entry->inum = container_of(rs, struct gfs2_inode, 610*f85c10e2SBob Peterson i_res)->i_no_addr; 6114a993fb1SSteven Whitehouse __entry->start = gfs2_rbm_to_block(&rs->rs_rbm); 6128e2e0047SBob Peterson __entry->free = rs->rs_free; 6138e2e0047SBob Peterson __entry->func = func; 6148e2e0047SBob Peterson ), 6158e2e0047SBob Peterson 6169e733d39SSteven Whitehouse TP_printk("%u,%u bmap %llu resrv %llu rg:%llu rf:%lu rr:%lu %s f:%lu", 6178e2e0047SBob Peterson MAJOR(__entry->dev), MINOR(__entry->dev), 6188e2e0047SBob Peterson (unsigned long long)__entry->inum, 6198e2e0047SBob Peterson (unsigned long long)__entry->start, 6208e2e0047SBob Peterson (unsigned long long)__entry->rd_addr, 6218e2e0047SBob Peterson (unsigned long)__entry->rd_free_clone, 6228e2e0047SBob Peterson (unsigned long)__entry->rd_reserved, 6238e2e0047SBob Peterson rs_func_name(__entry->func), (unsigned long)__entry->free) 62463997775SSteven Whitehouse ); 62563997775SSteven Whitehouse 62663997775SSteven Whitehouse #endif /* _TRACE_GFS2_H */ 62763997775SSteven Whitehouse 62863997775SSteven Whitehouse /* This part must be outside protection */ 62963997775SSteven Whitehouse #undef TRACE_INCLUDE_PATH 63063997775SSteven Whitehouse #define TRACE_INCLUDE_PATH . 631d0b6e04aSLi Zefan #define TRACE_INCLUDE_FILE trace_gfs2 63263997775SSteven Whitehouse #include <trace/define_trace.h> 63363997775SSteven Whitehouse 634