1d0b6e04aSLi Zefan #undef TRACE_SYSTEM 2d0b6e04aSLi Zefan #define TRACE_SYSTEM gfs2 3d0b6e04aSLi Zefan 463997775SSteven Whitehouse #if !defined(_TRACE_GFS2_H) || defined(TRACE_HEADER_MULTI_READ) 563997775SSteven Whitehouse #define _TRACE_GFS2_H 663997775SSteven Whitehouse 763997775SSteven Whitehouse #include <linux/tracepoint.h> 863997775SSteven Whitehouse 963997775SSteven Whitehouse #include <linux/fs.h> 1063997775SSteven Whitehouse #include <linux/buffer_head.h> 1163997775SSteven Whitehouse #include <linux/dlmconstants.h> 1263997775SSteven Whitehouse #include <linux/gfs2_ondisk.h> 13c83ae9caSSteven Whitehouse #include <linux/writeback.h> 14a245769fSSteven Whitehouse #include <linux/ktime.h> 1563997775SSteven Whitehouse #include "incore.h" 1663997775SSteven Whitehouse #include "glock.h" 178e2e0047SBob Peterson #include "rgrp.h" 1863997775SSteven Whitehouse 1963997775SSteven Whitehouse #define dlm_state_name(nn) { DLM_LOCK_##nn, #nn } 2063997775SSteven Whitehouse #define glock_trace_name(x) __print_symbolic(x, \ 2163997775SSteven Whitehouse dlm_state_name(IV), \ 2263997775SSteven Whitehouse dlm_state_name(NL), \ 2363997775SSteven Whitehouse dlm_state_name(CR), \ 2463997775SSteven Whitehouse dlm_state_name(CW), \ 2563997775SSteven Whitehouse dlm_state_name(PR), \ 2663997775SSteven Whitehouse dlm_state_name(PW), \ 2763997775SSteven Whitehouse dlm_state_name(EX)) 2863997775SSteven Whitehouse 2963997775SSteven Whitehouse #define block_state_name(x) __print_symbolic(x, \ 3063997775SSteven Whitehouse { GFS2_BLKST_FREE, "free" }, \ 3163997775SSteven Whitehouse { GFS2_BLKST_USED, "used" }, \ 3263997775SSteven Whitehouse { GFS2_BLKST_DINODE, "dinode" }, \ 3363997775SSteven Whitehouse { GFS2_BLKST_UNLINKED, "unlinked" }) 3463997775SSteven Whitehouse 358e2e0047SBob Peterson #define TRACE_RS_DELETE 0 368e2e0047SBob Peterson #define TRACE_RS_TREEDEL 1 378e2e0047SBob Peterson #define TRACE_RS_INSERT 2 388e2e0047SBob Peterson #define TRACE_RS_CLAIM 3 398e2e0047SBob Peterson 408e2e0047SBob Peterson #define rs_func_name(x) __print_symbolic(x, \ 418e2e0047SBob Peterson { 0, "del " }, \ 428e2e0047SBob Peterson { 1, "tdel" }, \ 438e2e0047SBob Peterson { 2, "ins " }, \ 448e2e0047SBob Peterson { 3, "clm " }) 458e2e0047SBob Peterson 4663997775SSteven Whitehouse #define show_glock_flags(flags) __print_flags(flags, "", \ 4763997775SSteven Whitehouse {(1UL << GLF_LOCK), "l" }, \ 4863997775SSteven Whitehouse {(1UL << GLF_DEMOTE), "D" }, \ 4963997775SSteven Whitehouse {(1UL << GLF_PENDING_DEMOTE), "d" }, \ 5063997775SSteven Whitehouse {(1UL << GLF_DEMOTE_IN_PROGRESS), "p" }, \ 5163997775SSteven Whitehouse {(1UL << GLF_DIRTY), "y" }, \ 5263997775SSteven Whitehouse {(1UL << GLF_LFLUSH), "f" }, \ 5363997775SSteven Whitehouse {(1UL << GLF_INVALIDATE_IN_PROGRESS), "i" }, \ 5463997775SSteven Whitehouse {(1UL << GLF_REPLY_PENDING), "r" }, \ 5563997775SSteven Whitehouse {(1UL << GLF_INITIAL), "I" }, \ 567b5e3d5fSSteven Whitehouse {(1UL << GLF_FROZEN), "F" }, \ 57627c10b7SSteven Whitehouse {(1UL << GLF_QUEUED), "q" }, \ 58627c10b7SSteven Whitehouse {(1UL << GLF_LRU), "L" }, \ 59a245769fSSteven Whitehouse {(1UL << GLF_OBJECT), "o" }, \ 60a245769fSSteven Whitehouse {(1UL << GLF_BLOCKING), "b" }) 6163997775SSteven Whitehouse 6263997775SSteven Whitehouse #ifndef NUMPTY 6363997775SSteven Whitehouse #define NUMPTY 6463997775SSteven Whitehouse static inline u8 glock_trace_state(unsigned int state) 6563997775SSteven Whitehouse { 6663997775SSteven Whitehouse switch(state) { 6763997775SSteven Whitehouse case LM_ST_SHARED: 6863997775SSteven Whitehouse return DLM_LOCK_PR; 6963997775SSteven Whitehouse case LM_ST_DEFERRED: 7063997775SSteven Whitehouse return DLM_LOCK_CW; 7163997775SSteven Whitehouse case LM_ST_EXCLUSIVE: 7263997775SSteven Whitehouse return DLM_LOCK_EX; 7363997775SSteven Whitehouse } 7463997775SSteven Whitehouse return DLM_LOCK_NL; 7563997775SSteven Whitehouse } 7663997775SSteven Whitehouse #endif 7763997775SSteven Whitehouse 7863997775SSteven Whitehouse /* Section 1 - Locking 7963997775SSteven Whitehouse * 8063997775SSteven Whitehouse * Objectives: 8163997775SSteven Whitehouse * Latency: Remote demote request to state change 8263997775SSteven Whitehouse * Latency: Local lock request to state change 8363997775SSteven Whitehouse * Latency: State change to lock grant 8463997775SSteven Whitehouse * Correctness: Ordering of local lock state vs. I/O requests 8563997775SSteven Whitehouse * Correctness: Responses to remote demote requests 8663997775SSteven Whitehouse */ 8763997775SSteven Whitehouse 8863997775SSteven Whitehouse /* General glock state change (DLM lock request completes) */ 8963997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_state_change, 9063997775SSteven Whitehouse 9163997775SSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, unsigned int new_state), 9263997775SSteven Whitehouse 9363997775SSteven Whitehouse TP_ARGS(gl, new_state), 9463997775SSteven Whitehouse 9563997775SSteven Whitehouse TP_STRUCT__entry( 9663997775SSteven Whitehouse __field( dev_t, dev ) 9763997775SSteven Whitehouse __field( u64, glnum ) 9863997775SSteven Whitehouse __field( u32, gltype ) 9963997775SSteven Whitehouse __field( u8, cur_state ) 10063997775SSteven Whitehouse __field( u8, new_state ) 10163997775SSteven Whitehouse __field( u8, dmt_state ) 10263997775SSteven Whitehouse __field( u8, tgt_state ) 10363997775SSteven Whitehouse __field( unsigned long, flags ) 10463997775SSteven Whitehouse ), 10563997775SSteven Whitehouse 10663997775SSteven Whitehouse TP_fast_assign( 10715562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; 10863997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number; 10963997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type; 11063997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state); 11163997775SSteven Whitehouse __entry->new_state = glock_trace_state(new_state); 11263997775SSteven Whitehouse __entry->tgt_state = glock_trace_state(gl->gl_target); 11363997775SSteven Whitehouse __entry->dmt_state = glock_trace_state(gl->gl_demote_state); 114627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0); 11563997775SSteven Whitehouse ), 11663997775SSteven Whitehouse 11763997775SSteven Whitehouse TP_printk("%u,%u glock %d:%lld state %s to %s tgt:%s dmt:%s flags:%s", 11863997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 11963997775SSteven Whitehouse (unsigned long long)__entry->glnum, 12063997775SSteven Whitehouse glock_trace_name(__entry->cur_state), 12163997775SSteven Whitehouse glock_trace_name(__entry->new_state), 12263997775SSteven Whitehouse glock_trace_name(__entry->tgt_state), 12363997775SSteven Whitehouse glock_trace_name(__entry->dmt_state), 12463997775SSteven Whitehouse show_glock_flags(__entry->flags)) 12563997775SSteven Whitehouse ); 12663997775SSteven Whitehouse 12763997775SSteven Whitehouse /* State change -> unlocked, glock is being deallocated */ 12863997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_put, 12963997775SSteven Whitehouse 13063997775SSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl), 13163997775SSteven Whitehouse 13263997775SSteven Whitehouse TP_ARGS(gl), 13363997775SSteven Whitehouse 13463997775SSteven Whitehouse TP_STRUCT__entry( 13563997775SSteven Whitehouse __field( dev_t, dev ) 13663997775SSteven Whitehouse __field( u64, glnum ) 13763997775SSteven Whitehouse __field( u32, gltype ) 13863997775SSteven Whitehouse __field( u8, cur_state ) 13963997775SSteven Whitehouse __field( unsigned long, flags ) 14063997775SSteven Whitehouse ), 14163997775SSteven Whitehouse 14263997775SSteven Whitehouse TP_fast_assign( 14315562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; 14463997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type; 14563997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number; 14663997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state); 147627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0); 14863997775SSteven Whitehouse ), 14963997775SSteven Whitehouse 15063997775SSteven Whitehouse TP_printk("%u,%u glock %d:%lld state %s => %s flags:%s", 15163997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 15263997775SSteven Whitehouse __entry->gltype, (unsigned long long)__entry->glnum, 15363997775SSteven Whitehouse glock_trace_name(__entry->cur_state), 15463997775SSteven Whitehouse glock_trace_name(DLM_LOCK_IV), 15563997775SSteven Whitehouse show_glock_flags(__entry->flags)) 15663997775SSteven Whitehouse 15763997775SSteven Whitehouse ); 15863997775SSteven Whitehouse 15963997775SSteven Whitehouse /* Callback (local or remote) requesting lock demotion */ 16063997775SSteven Whitehouse TRACE_EVENT(gfs2_demote_rq, 16163997775SSteven Whitehouse 1627bd8b2ebSSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, bool remote), 16363997775SSteven Whitehouse 1647bd8b2ebSSteven Whitehouse TP_ARGS(gl, remote), 16563997775SSteven Whitehouse 16663997775SSteven Whitehouse TP_STRUCT__entry( 16763997775SSteven Whitehouse __field( dev_t, dev ) 16863997775SSteven Whitehouse __field( u64, glnum ) 16963997775SSteven Whitehouse __field( u32, gltype ) 17063997775SSteven Whitehouse __field( u8, cur_state ) 17163997775SSteven Whitehouse __field( u8, dmt_state ) 17263997775SSteven Whitehouse __field( unsigned long, flags ) 1737bd8b2ebSSteven Whitehouse __field( bool, remote ) 17463997775SSteven Whitehouse ), 17563997775SSteven Whitehouse 17663997775SSteven Whitehouse TP_fast_assign( 17715562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; 17863997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type; 17963997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number; 18063997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state); 18163997775SSteven Whitehouse __entry->dmt_state = glock_trace_state(gl->gl_demote_state); 182627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0); 1837bd8b2ebSSteven Whitehouse __entry->remote = remote; 18463997775SSteven Whitehouse ), 18563997775SSteven Whitehouse 1867bd8b2ebSSteven Whitehouse TP_printk("%u,%u glock %d:%lld demote %s to %s flags:%s %s", 18763997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 18863997775SSteven Whitehouse (unsigned long long)__entry->glnum, 18963997775SSteven Whitehouse glock_trace_name(__entry->cur_state), 19063997775SSteven Whitehouse glock_trace_name(__entry->dmt_state), 1917bd8b2ebSSteven Whitehouse show_glock_flags(__entry->flags), 1927bd8b2ebSSteven Whitehouse __entry->remote ? "remote" : "local") 19363997775SSteven Whitehouse 19463997775SSteven Whitehouse ); 19563997775SSteven Whitehouse 19663997775SSteven Whitehouse /* Promotion/grant of a glock */ 19763997775SSteven Whitehouse TRACE_EVENT(gfs2_promote, 19863997775SSteven Whitehouse 19963997775SSteven Whitehouse TP_PROTO(const struct gfs2_holder *gh, int first), 20063997775SSteven Whitehouse 20163997775SSteven Whitehouse TP_ARGS(gh, first), 20263997775SSteven Whitehouse 20363997775SSteven Whitehouse TP_STRUCT__entry( 20463997775SSteven Whitehouse __field( dev_t, dev ) 20563997775SSteven Whitehouse __field( u64, glnum ) 20663997775SSteven Whitehouse __field( u32, gltype ) 20763997775SSteven Whitehouse __field( int, first ) 20863997775SSteven Whitehouse __field( u8, state ) 20963997775SSteven Whitehouse ), 21063997775SSteven Whitehouse 21163997775SSteven Whitehouse TP_fast_assign( 21215562c43SBob Peterson __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev; 21363997775SSteven Whitehouse __entry->glnum = gh->gh_gl->gl_name.ln_number; 21463997775SSteven Whitehouse __entry->gltype = gh->gh_gl->gl_name.ln_type; 21563997775SSteven Whitehouse __entry->first = first; 21663997775SSteven Whitehouse __entry->state = glock_trace_state(gh->gh_state); 21763997775SSteven Whitehouse ), 21863997775SSteven Whitehouse 21963997775SSteven Whitehouse TP_printk("%u,%u glock %u:%llu promote %s %s", 22063997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 22163997775SSteven Whitehouse (unsigned long long)__entry->glnum, 22263997775SSteven Whitehouse __entry->first ? "first": "other", 22363997775SSteven Whitehouse glock_trace_name(__entry->state)) 22463997775SSteven Whitehouse ); 22563997775SSteven Whitehouse 22663997775SSteven Whitehouse /* Queue/dequeue a lock request */ 22763997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_queue, 22863997775SSteven Whitehouse 22963997775SSteven Whitehouse TP_PROTO(const struct gfs2_holder *gh, int queue), 23063997775SSteven Whitehouse 23163997775SSteven Whitehouse TP_ARGS(gh, queue), 23263997775SSteven Whitehouse 23363997775SSteven Whitehouse TP_STRUCT__entry( 23463997775SSteven Whitehouse __field( dev_t, dev ) 23563997775SSteven Whitehouse __field( u64, glnum ) 23663997775SSteven Whitehouse __field( u32, gltype ) 23763997775SSteven Whitehouse __field( int, queue ) 23863997775SSteven Whitehouse __field( u8, state ) 23963997775SSteven Whitehouse ), 24063997775SSteven Whitehouse 24163997775SSteven Whitehouse TP_fast_assign( 24215562c43SBob Peterson __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev; 24363997775SSteven Whitehouse __entry->glnum = gh->gh_gl->gl_name.ln_number; 24463997775SSteven Whitehouse __entry->gltype = gh->gh_gl->gl_name.ln_type; 24563997775SSteven Whitehouse __entry->queue = queue; 24663997775SSteven Whitehouse __entry->state = glock_trace_state(gh->gh_state); 24763997775SSteven Whitehouse ), 24863997775SSteven Whitehouse 24963997775SSteven Whitehouse TP_printk("%u,%u glock %u:%llu %squeue %s", 25063997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 25163997775SSteven Whitehouse (unsigned long long)__entry->glnum, 25263997775SSteven Whitehouse __entry->queue ? "" : "de", 25363997775SSteven Whitehouse glock_trace_name(__entry->state)) 25463997775SSteven Whitehouse ); 25563997775SSteven Whitehouse 256a245769fSSteven Whitehouse /* DLM sends a reply to GFS2 */ 257a245769fSSteven Whitehouse TRACE_EVENT(gfs2_glock_lock_time, 258a245769fSSteven Whitehouse 259a245769fSSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, s64 tdiff), 260a245769fSSteven Whitehouse 261a245769fSSteven Whitehouse TP_ARGS(gl, tdiff), 262a245769fSSteven Whitehouse 263a245769fSSteven Whitehouse TP_STRUCT__entry( 264a245769fSSteven Whitehouse __field( dev_t, dev ) 265a245769fSSteven Whitehouse __field( u64, glnum ) 266a245769fSSteven Whitehouse __field( u32, gltype ) 267a245769fSSteven Whitehouse __field( int, status ) 268a245769fSSteven Whitehouse __field( char, flags ) 269a245769fSSteven Whitehouse __field( s64, tdiff ) 270*4d207133SBen Hutchings __field( u64, srtt ) 271*4d207133SBen Hutchings __field( u64, srttvar ) 272*4d207133SBen Hutchings __field( u64, srttb ) 273*4d207133SBen Hutchings __field( u64, srttvarb ) 274*4d207133SBen Hutchings __field( u64, sirt ) 275*4d207133SBen Hutchings __field( u64, sirtvar ) 276*4d207133SBen Hutchings __field( u64, dcount ) 277*4d207133SBen Hutchings __field( u64, qcount ) 278a245769fSSteven Whitehouse ), 279a245769fSSteven Whitehouse 280a245769fSSteven Whitehouse TP_fast_assign( 28115562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev; 282a245769fSSteven Whitehouse __entry->glnum = gl->gl_name.ln_number; 283a245769fSSteven Whitehouse __entry->gltype = gl->gl_name.ln_type; 284a245769fSSteven Whitehouse __entry->status = gl->gl_lksb.sb_status; 285a245769fSSteven Whitehouse __entry->flags = gl->gl_lksb.sb_flags; 286a245769fSSteven Whitehouse __entry->tdiff = tdiff; 287a245769fSSteven Whitehouse __entry->srtt = gl->gl_stats.stats[GFS2_LKS_SRTT]; 288a245769fSSteven Whitehouse __entry->srttvar = gl->gl_stats.stats[GFS2_LKS_SRTTVAR]; 289a245769fSSteven Whitehouse __entry->srttb = gl->gl_stats.stats[GFS2_LKS_SRTTB]; 290a245769fSSteven Whitehouse __entry->srttvarb = gl->gl_stats.stats[GFS2_LKS_SRTTVARB]; 291a245769fSSteven Whitehouse __entry->sirt = gl->gl_stats.stats[GFS2_LKS_SIRT]; 292a245769fSSteven Whitehouse __entry->sirtvar = gl->gl_stats.stats[GFS2_LKS_SIRTVAR]; 293a245769fSSteven Whitehouse __entry->dcount = gl->gl_stats.stats[GFS2_LKS_DCOUNT]; 294a245769fSSteven Whitehouse __entry->qcount = gl->gl_stats.stats[GFS2_LKS_QCOUNT]; 295a245769fSSteven Whitehouse ), 296a245769fSSteven Whitehouse 297a245769fSSteven 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", 298a245769fSSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype, 299a245769fSSteven Whitehouse (unsigned long long)__entry->glnum, 300a245769fSSteven Whitehouse __entry->status, __entry->flags, 301a245769fSSteven Whitehouse (long long)__entry->tdiff, 302a245769fSSteven Whitehouse (long long)__entry->srtt, 303a245769fSSteven Whitehouse (long long)__entry->srttvar, 304a245769fSSteven Whitehouse (long long)__entry->srttb, 305a245769fSSteven Whitehouse (long long)__entry->srttvarb, 306a245769fSSteven Whitehouse (long long)__entry->sirt, 307a245769fSSteven Whitehouse (long long)__entry->sirtvar, 308a245769fSSteven Whitehouse (long long)__entry->dcount, 309a245769fSSteven Whitehouse (long long)__entry->qcount) 310a245769fSSteven Whitehouse ); 311a245769fSSteven Whitehouse 31263997775SSteven Whitehouse /* Section 2 - Log/journal 31363997775SSteven Whitehouse * 31463997775SSteven Whitehouse * Objectives: 31563997775SSteven Whitehouse * Latency: Log flush time 31663997775SSteven Whitehouse * Correctness: pin/unpin vs. disk I/O ordering 31763997775SSteven Whitehouse * Performance: Log usage stats 31863997775SSteven Whitehouse */ 31963997775SSteven Whitehouse 32063997775SSteven Whitehouse /* Pin/unpin a block in the log */ 32163997775SSteven Whitehouse TRACE_EVENT(gfs2_pin, 32263997775SSteven Whitehouse 32363997775SSteven Whitehouse TP_PROTO(const struct gfs2_bufdata *bd, int pin), 32463997775SSteven Whitehouse 32563997775SSteven Whitehouse TP_ARGS(bd, pin), 32663997775SSteven Whitehouse 32763997775SSteven Whitehouse TP_STRUCT__entry( 32863997775SSteven Whitehouse __field( dev_t, dev ) 32963997775SSteven Whitehouse __field( int, pin ) 33063997775SSteven Whitehouse __field( u32, len ) 33163997775SSteven Whitehouse __field( sector_t, block ) 33263997775SSteven Whitehouse __field( u64, ino ) 33363997775SSteven Whitehouse ), 33463997775SSteven Whitehouse 33563997775SSteven Whitehouse TP_fast_assign( 33615562c43SBob Peterson __entry->dev = bd->bd_gl->gl_name.ln_sbd->sd_vfs->s_dev; 33763997775SSteven Whitehouse __entry->pin = pin; 33863997775SSteven Whitehouse __entry->len = bd->bd_bh->b_size; 33963997775SSteven Whitehouse __entry->block = bd->bd_bh->b_blocknr; 34063997775SSteven Whitehouse __entry->ino = bd->bd_gl->gl_name.ln_number; 34163997775SSteven Whitehouse ), 34263997775SSteven Whitehouse 34363997775SSteven Whitehouse TP_printk("%u,%u log %s %llu/%lu inode %llu", 34463997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 34563997775SSteven Whitehouse __entry->pin ? "pin" : "unpin", 34663997775SSteven Whitehouse (unsigned long long)__entry->block, 34763997775SSteven Whitehouse (unsigned long)__entry->len, 34863997775SSteven Whitehouse (unsigned long long)__entry->ino) 34963997775SSteven Whitehouse ); 35063997775SSteven Whitehouse 35163997775SSteven Whitehouse /* Flushing the log */ 35263997775SSteven Whitehouse TRACE_EVENT(gfs2_log_flush, 35363997775SSteven Whitehouse 35463997775SSteven Whitehouse TP_PROTO(const struct gfs2_sbd *sdp, int start), 35563997775SSteven Whitehouse 35663997775SSteven Whitehouse TP_ARGS(sdp, start), 35763997775SSteven Whitehouse 35863997775SSteven Whitehouse TP_STRUCT__entry( 35963997775SSteven Whitehouse __field( dev_t, dev ) 36063997775SSteven Whitehouse __field( int, start ) 36163997775SSteven Whitehouse __field( u64, log_seq ) 36263997775SSteven Whitehouse ), 36363997775SSteven Whitehouse 36463997775SSteven Whitehouse TP_fast_assign( 36563997775SSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev; 36663997775SSteven Whitehouse __entry->start = start; 36763997775SSteven Whitehouse __entry->log_seq = sdp->sd_log_sequence; 36863997775SSteven Whitehouse ), 36963997775SSteven Whitehouse 37063997775SSteven Whitehouse TP_printk("%u,%u log flush %s %llu", 37163997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 37263997775SSteven Whitehouse __entry->start ? "start" : "end", 37363997775SSteven Whitehouse (unsigned long long)__entry->log_seq) 37463997775SSteven Whitehouse ); 37563997775SSteven Whitehouse 37663997775SSteven Whitehouse /* Reserving/releasing blocks in the log */ 37763997775SSteven Whitehouse TRACE_EVENT(gfs2_log_blocks, 37863997775SSteven Whitehouse 37963997775SSteven Whitehouse TP_PROTO(const struct gfs2_sbd *sdp, int blocks), 38063997775SSteven Whitehouse 38163997775SSteven Whitehouse TP_ARGS(sdp, blocks), 38263997775SSteven Whitehouse 38363997775SSteven Whitehouse TP_STRUCT__entry( 38463997775SSteven Whitehouse __field( dev_t, dev ) 38563997775SSteven Whitehouse __field( int, blocks ) 38663997775SSteven Whitehouse ), 38763997775SSteven Whitehouse 38863997775SSteven Whitehouse TP_fast_assign( 38963997775SSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev; 39063997775SSteven Whitehouse __entry->blocks = blocks; 39163997775SSteven Whitehouse ), 39263997775SSteven Whitehouse 39363997775SSteven Whitehouse TP_printk("%u,%u log reserve %d", MAJOR(__entry->dev), 39463997775SSteven Whitehouse MINOR(__entry->dev), __entry->blocks) 39563997775SSteven Whitehouse ); 39663997775SSteven Whitehouse 397c83ae9caSSteven Whitehouse /* Writing back the AIL */ 398c83ae9caSSteven Whitehouse TRACE_EVENT(gfs2_ail_flush, 399c83ae9caSSteven Whitehouse 400c83ae9caSSteven Whitehouse TP_PROTO(const struct gfs2_sbd *sdp, const struct writeback_control *wbc, int start), 401c83ae9caSSteven Whitehouse 402c83ae9caSSteven Whitehouse TP_ARGS(sdp, wbc, start), 403c83ae9caSSteven Whitehouse 404c83ae9caSSteven Whitehouse TP_STRUCT__entry( 405c83ae9caSSteven Whitehouse __field( dev_t, dev ) 406c83ae9caSSteven Whitehouse __field( int, start ) 407c83ae9caSSteven Whitehouse __field( int, sync_mode ) 408c83ae9caSSteven Whitehouse __field( long, nr_to_write ) 409c83ae9caSSteven Whitehouse ), 410c83ae9caSSteven Whitehouse 411c83ae9caSSteven Whitehouse TP_fast_assign( 412c83ae9caSSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev; 413c83ae9caSSteven Whitehouse __entry->start = start; 414c83ae9caSSteven Whitehouse __entry->sync_mode = wbc->sync_mode; 415c83ae9caSSteven Whitehouse __entry->nr_to_write = wbc->nr_to_write; 416c83ae9caSSteven Whitehouse ), 417c83ae9caSSteven Whitehouse 418c83ae9caSSteven Whitehouse TP_printk("%u,%u ail flush %s %s %ld", MAJOR(__entry->dev), 419c83ae9caSSteven Whitehouse MINOR(__entry->dev), __entry->start ? "start" : "end", 420c83ae9caSSteven Whitehouse __entry->sync_mode == WB_SYNC_ALL ? "all" : "none", 421c83ae9caSSteven Whitehouse __entry->nr_to_write) 422c83ae9caSSteven Whitehouse ); 423c83ae9caSSteven Whitehouse 42463997775SSteven Whitehouse /* Section 3 - bmap 42563997775SSteven Whitehouse * 42663997775SSteven Whitehouse * Objectives: 42763997775SSteven Whitehouse * Latency: Bmap request time 42863997775SSteven Whitehouse * Performance: Block allocator tracing 42963997775SSteven Whitehouse * Correctness: Test of disard generation vs. blocks allocated 43063997775SSteven Whitehouse */ 43163997775SSteven Whitehouse 43263997775SSteven Whitehouse /* Map an extent of blocks, possibly a new allocation */ 43363997775SSteven Whitehouse TRACE_EVENT(gfs2_bmap, 43463997775SSteven Whitehouse 43563997775SSteven Whitehouse TP_PROTO(const struct gfs2_inode *ip, const struct buffer_head *bh, 43663997775SSteven Whitehouse sector_t lblock, int create, int errno), 43763997775SSteven Whitehouse 43863997775SSteven Whitehouse TP_ARGS(ip, bh, lblock, create, errno), 43963997775SSteven Whitehouse 44063997775SSteven Whitehouse TP_STRUCT__entry( 44163997775SSteven Whitehouse __field( dev_t, dev ) 44263997775SSteven Whitehouse __field( sector_t, lblock ) 44363997775SSteven Whitehouse __field( sector_t, pblock ) 44463997775SSteven Whitehouse __field( u64, inum ) 44563997775SSteven Whitehouse __field( unsigned long, state ) 44663997775SSteven Whitehouse __field( u32, len ) 44763997775SSteven Whitehouse __field( int, create ) 44863997775SSteven Whitehouse __field( int, errno ) 44963997775SSteven Whitehouse ), 45063997775SSteven Whitehouse 45163997775SSteven Whitehouse TP_fast_assign( 45215562c43SBob Peterson __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev; 45363997775SSteven Whitehouse __entry->lblock = lblock; 45463997775SSteven Whitehouse __entry->pblock = buffer_mapped(bh) ? bh->b_blocknr : 0; 45563997775SSteven Whitehouse __entry->inum = ip->i_no_addr; 45663997775SSteven Whitehouse __entry->state = bh->b_state; 45763997775SSteven Whitehouse __entry->len = bh->b_size; 45863997775SSteven Whitehouse __entry->create = create; 45963997775SSteven Whitehouse __entry->errno = errno; 46063997775SSteven Whitehouse ), 46163997775SSteven Whitehouse 46263997775SSteven Whitehouse TP_printk("%u,%u bmap %llu map %llu/%lu to %llu flags:%08lx %s %d", 46363997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 46463997775SSteven Whitehouse (unsigned long long)__entry->inum, 46563997775SSteven Whitehouse (unsigned long long)__entry->lblock, 46663997775SSteven Whitehouse (unsigned long)__entry->len, 46763997775SSteven Whitehouse (unsigned long long)__entry->pblock, 46863997775SSteven Whitehouse __entry->state, __entry->create ? "create " : "nocreate", 46963997775SSteven Whitehouse __entry->errno) 47063997775SSteven Whitehouse ); 47163997775SSteven Whitehouse 47263997775SSteven Whitehouse /* Keep track of blocks as they are allocated/freed */ 47363997775SSteven Whitehouse TRACE_EVENT(gfs2_block_alloc, 47463997775SSteven Whitehouse 47541db1ab9SBob Peterson TP_PROTO(const struct gfs2_inode *ip, struct gfs2_rgrpd *rgd, 47641db1ab9SBob Peterson u64 block, unsigned len, u8 block_state), 47763997775SSteven Whitehouse 47841db1ab9SBob Peterson TP_ARGS(ip, rgd, block, len, block_state), 47963997775SSteven Whitehouse 48063997775SSteven Whitehouse TP_STRUCT__entry( 48163997775SSteven Whitehouse __field( dev_t, dev ) 48263997775SSteven Whitehouse __field( u64, start ) 48363997775SSteven Whitehouse __field( u64, inum ) 48463997775SSteven Whitehouse __field( u32, len ) 48563997775SSteven Whitehouse __field( u8, block_state ) 48641db1ab9SBob Peterson __field( u64, rd_addr ) 48741db1ab9SBob Peterson __field( u32, rd_free_clone ) 4888e2e0047SBob Peterson __field( u32, rd_reserved ) 48963997775SSteven Whitehouse ), 49063997775SSteven Whitehouse 49163997775SSteven Whitehouse TP_fast_assign( 49215562c43SBob Peterson __entry->dev = rgd->rd_gl->gl_name.ln_sbd->sd_vfs->s_dev; 49363997775SSteven Whitehouse __entry->start = block; 49463997775SSteven Whitehouse __entry->inum = ip->i_no_addr; 49563997775SSteven Whitehouse __entry->len = len; 49663997775SSteven Whitehouse __entry->block_state = block_state; 49741db1ab9SBob Peterson __entry->rd_addr = rgd->rd_addr; 49841db1ab9SBob Peterson __entry->rd_free_clone = rgd->rd_free_clone; 4998e2e0047SBob Peterson __entry->rd_reserved = rgd->rd_reserved; 50063997775SSteven Whitehouse ), 50163997775SSteven Whitehouse 5028e2e0047SBob Peterson TP_printk("%u,%u bmap %llu alloc %llu/%lu %s rg:%llu rf:%u rr:%lu", 50363997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), 50463997775SSteven Whitehouse (unsigned long long)__entry->inum, 50563997775SSteven Whitehouse (unsigned long long)__entry->start, 50663997775SSteven Whitehouse (unsigned long)__entry->len, 50741db1ab9SBob Peterson block_state_name(__entry->block_state), 50841db1ab9SBob Peterson (unsigned long long)__entry->rd_addr, 5098e2e0047SBob Peterson __entry->rd_free_clone, (unsigned long)__entry->rd_reserved) 5108e2e0047SBob Peterson ); 5118e2e0047SBob Peterson 5128e2e0047SBob Peterson /* Keep track of multi-block reservations as they are allocated/freed */ 5138e2e0047SBob Peterson TRACE_EVENT(gfs2_rs, 5148e2e0047SBob Peterson 5159e733d39SSteven Whitehouse TP_PROTO(const struct gfs2_blkreserv *rs, u8 func), 5168e2e0047SBob Peterson 5179e733d39SSteven Whitehouse TP_ARGS(rs, func), 5188e2e0047SBob Peterson 5198e2e0047SBob Peterson TP_STRUCT__entry( 5208e2e0047SBob Peterson __field( dev_t, dev ) 5218e2e0047SBob Peterson __field( u64, rd_addr ) 5228e2e0047SBob Peterson __field( u32, rd_free_clone ) 5238e2e0047SBob Peterson __field( u32, rd_reserved ) 5248e2e0047SBob Peterson __field( u64, inum ) 5258e2e0047SBob Peterson __field( u64, start ) 5268e2e0047SBob Peterson __field( u32, free ) 5278e2e0047SBob Peterson __field( u8, func ) 5288e2e0047SBob Peterson ), 5298e2e0047SBob Peterson 5308e2e0047SBob Peterson TP_fast_assign( 5319e733d39SSteven Whitehouse __entry->dev = rs->rs_rbm.rgd->rd_sbd->sd_vfs->s_dev; 5329e733d39SSteven Whitehouse __entry->rd_addr = rs->rs_rbm.rgd->rd_addr; 5339e733d39SSteven Whitehouse __entry->rd_free_clone = rs->rs_rbm.rgd->rd_free_clone; 5349e733d39SSteven Whitehouse __entry->rd_reserved = rs->rs_rbm.rgd->rd_reserved; 5359e733d39SSteven Whitehouse __entry->inum = rs->rs_inum; 5364a993fb1SSteven Whitehouse __entry->start = gfs2_rbm_to_block(&rs->rs_rbm); 5378e2e0047SBob Peterson __entry->free = rs->rs_free; 5388e2e0047SBob Peterson __entry->func = func; 5398e2e0047SBob Peterson ), 5408e2e0047SBob Peterson 5419e733d39SSteven Whitehouse TP_printk("%u,%u bmap %llu resrv %llu rg:%llu rf:%lu rr:%lu %s f:%lu", 5428e2e0047SBob Peterson MAJOR(__entry->dev), MINOR(__entry->dev), 5438e2e0047SBob Peterson (unsigned long long)__entry->inum, 5448e2e0047SBob Peterson (unsigned long long)__entry->start, 5458e2e0047SBob Peterson (unsigned long long)__entry->rd_addr, 5468e2e0047SBob Peterson (unsigned long)__entry->rd_free_clone, 5478e2e0047SBob Peterson (unsigned long)__entry->rd_reserved, 5488e2e0047SBob Peterson rs_func_name(__entry->func), (unsigned long)__entry->free) 54963997775SSteven Whitehouse ); 55063997775SSteven Whitehouse 55163997775SSteven Whitehouse #endif /* _TRACE_GFS2_H */ 55263997775SSteven Whitehouse 55363997775SSteven Whitehouse /* This part must be outside protection */ 55463997775SSteven Whitehouse #undef TRACE_INCLUDE_PATH 55563997775SSteven Whitehouse #define TRACE_INCLUDE_PATH . 556d0b6e04aSLi Zefan #define TRACE_INCLUDE_FILE trace_gfs2 55763997775SSteven Whitehouse #include <trace/define_trace.h> 55863997775SSteven Whitehouse 559