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" }, \
560a0383a9SAndreas Gruenbacher {(1UL << GLF_HAVE_REPLY), "r" }, \
57*c8758ad0SAndreas Gruenbacher {(1UL << GLF_INITIAL), "a" }, \
581fb5f67eSAndreas Gruenbacher {(1UL << GLF_HAVE_FROZEN_REPLY), "F" }, \
59627c10b7SSteven Whitehouse {(1UL << GLF_LRU), "L" }, \
60a245769fSSteven Whitehouse {(1UL << GLF_OBJECT), "o" }, \
61a245769fSSteven Whitehouse {(1UL << GLF_BLOCKING), "b" })
6263997775SSteven Whitehouse
6363997775SSteven Whitehouse #ifndef NUMPTY
6463997775SSteven Whitehouse #define NUMPTY
glock_trace_state(unsigned int state)6563997775SSteven Whitehouse static inline u8 glock_trace_state(unsigned int state)
6663997775SSteven Whitehouse {
6763997775SSteven Whitehouse switch(state) {
6863997775SSteven Whitehouse case LM_ST_SHARED:
6963997775SSteven Whitehouse return DLM_LOCK_PR;
7063997775SSteven Whitehouse case LM_ST_DEFERRED:
7163997775SSteven Whitehouse return DLM_LOCK_CW;
7263997775SSteven Whitehouse case LM_ST_EXCLUSIVE:
7363997775SSteven Whitehouse return DLM_LOCK_EX;
7463997775SSteven Whitehouse }
7563997775SSteven Whitehouse return DLM_LOCK_NL;
7663997775SSteven Whitehouse }
7763997775SSteven Whitehouse #endif
7863997775SSteven Whitehouse
7963997775SSteven Whitehouse /* Section 1 - Locking
8063997775SSteven Whitehouse *
8163997775SSteven Whitehouse * Objectives:
8263997775SSteven Whitehouse * Latency: Remote demote request to state change
8363997775SSteven Whitehouse * Latency: Local lock request to state change
8463997775SSteven Whitehouse * Latency: State change to lock grant
8563997775SSteven Whitehouse * Correctness: Ordering of local lock state vs. I/O requests
8663997775SSteven Whitehouse * Correctness: Responses to remote demote requests
8763997775SSteven Whitehouse */
8863997775SSteven Whitehouse
8963997775SSteven Whitehouse /* General glock state change (DLM lock request completes) */
9063997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_state_change,
9163997775SSteven Whitehouse
9263997775SSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, unsigned int new_state),
9363997775SSteven Whitehouse
9463997775SSteven Whitehouse TP_ARGS(gl, new_state),
9563997775SSteven Whitehouse
9663997775SSteven Whitehouse TP_STRUCT__entry(
9763997775SSteven Whitehouse __field( dev_t, dev )
9863997775SSteven Whitehouse __field( u64, glnum )
9963997775SSteven Whitehouse __field( u32, gltype )
10063997775SSteven Whitehouse __field( u8, cur_state )
10163997775SSteven Whitehouse __field( u8, new_state )
10263997775SSteven Whitehouse __field( u8, dmt_state )
10363997775SSteven Whitehouse __field( u8, tgt_state )
10463997775SSteven Whitehouse __field( unsigned long, flags )
10563997775SSteven Whitehouse ),
10663997775SSteven Whitehouse
10763997775SSteven Whitehouse TP_fast_assign(
10815562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
10963997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number;
11063997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type;
11163997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state);
11263997775SSteven Whitehouse __entry->new_state = glock_trace_state(new_state);
11363997775SSteven Whitehouse __entry->tgt_state = glock_trace_state(gl->gl_target);
11463997775SSteven Whitehouse __entry->dmt_state = glock_trace_state(gl->gl_demote_state);
115627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
11663997775SSteven Whitehouse ),
11763997775SSteven Whitehouse
11863997775SSteven Whitehouse TP_printk("%u,%u glock %d:%lld state %s to %s tgt:%s dmt:%s flags:%s",
11963997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
12063997775SSteven Whitehouse (unsigned long long)__entry->glnum,
12163997775SSteven Whitehouse glock_trace_name(__entry->cur_state),
12263997775SSteven Whitehouse glock_trace_name(__entry->new_state),
12363997775SSteven Whitehouse glock_trace_name(__entry->tgt_state),
12463997775SSteven Whitehouse glock_trace_name(__entry->dmt_state),
12563997775SSteven Whitehouse show_glock_flags(__entry->flags))
12663997775SSteven Whitehouse );
12763997775SSteven Whitehouse
12863997775SSteven Whitehouse /* State change -> unlocked, glock is being deallocated */
12963997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_put,
13063997775SSteven Whitehouse
13163997775SSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl),
13263997775SSteven Whitehouse
13363997775SSteven Whitehouse TP_ARGS(gl),
13463997775SSteven Whitehouse
13563997775SSteven Whitehouse TP_STRUCT__entry(
13663997775SSteven Whitehouse __field( dev_t, dev )
13763997775SSteven Whitehouse __field( u64, glnum )
13863997775SSteven Whitehouse __field( u32, gltype )
13963997775SSteven Whitehouse __field( u8, cur_state )
14063997775SSteven Whitehouse __field( unsigned long, flags )
14163997775SSteven Whitehouse ),
14263997775SSteven Whitehouse
14363997775SSteven Whitehouse TP_fast_assign(
14415562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
14563997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type;
14663997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number;
14763997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state);
148627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
14963997775SSteven Whitehouse ),
15063997775SSteven Whitehouse
15163997775SSteven Whitehouse TP_printk("%u,%u glock %d:%lld state %s => %s flags:%s",
15263997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev),
15363997775SSteven Whitehouse __entry->gltype, (unsigned long long)__entry->glnum,
15463997775SSteven Whitehouse glock_trace_name(__entry->cur_state),
15563997775SSteven Whitehouse glock_trace_name(DLM_LOCK_IV),
15663997775SSteven Whitehouse show_glock_flags(__entry->flags))
15763997775SSteven Whitehouse
15863997775SSteven Whitehouse );
15963997775SSteven Whitehouse
16063997775SSteven Whitehouse /* Callback (local or remote) requesting lock demotion */
16163997775SSteven Whitehouse TRACE_EVENT(gfs2_demote_rq,
16263997775SSteven Whitehouse
1637bd8b2ebSSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, bool remote),
16463997775SSteven Whitehouse
1657bd8b2ebSSteven Whitehouse TP_ARGS(gl, remote),
16663997775SSteven Whitehouse
16763997775SSteven Whitehouse TP_STRUCT__entry(
16863997775SSteven Whitehouse __field( dev_t, dev )
16963997775SSteven Whitehouse __field( u64, glnum )
17063997775SSteven Whitehouse __field( u32, gltype )
17163997775SSteven Whitehouse __field( u8, cur_state )
17263997775SSteven Whitehouse __field( u8, dmt_state )
17363997775SSteven Whitehouse __field( unsigned long, flags )
1747bd8b2ebSSteven Whitehouse __field( bool, remote )
17563997775SSteven Whitehouse ),
17663997775SSteven Whitehouse
17763997775SSteven Whitehouse TP_fast_assign(
17815562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
17963997775SSteven Whitehouse __entry->gltype = gl->gl_name.ln_type;
18063997775SSteven Whitehouse __entry->glnum = gl->gl_name.ln_number;
18163997775SSteven Whitehouse __entry->cur_state = glock_trace_state(gl->gl_state);
18263997775SSteven Whitehouse __entry->dmt_state = glock_trace_state(gl->gl_demote_state);
183627c10b7SSteven Whitehouse __entry->flags = gl->gl_flags | (gl->gl_object ? (1UL<<GLF_OBJECT) : 0);
1847bd8b2ebSSteven Whitehouse __entry->remote = remote;
18563997775SSteven Whitehouse ),
18663997775SSteven Whitehouse
1877bd8b2ebSSteven Whitehouse TP_printk("%u,%u glock %d:%lld demote %s to %s flags:%s %s",
18863997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
18963997775SSteven Whitehouse (unsigned long long)__entry->glnum,
19063997775SSteven Whitehouse glock_trace_name(__entry->cur_state),
19163997775SSteven Whitehouse glock_trace_name(__entry->dmt_state),
1927bd8b2ebSSteven Whitehouse show_glock_flags(__entry->flags),
1937bd8b2ebSSteven Whitehouse __entry->remote ? "remote" : "local")
19463997775SSteven Whitehouse
19563997775SSteven Whitehouse );
19663997775SSteven Whitehouse
19763997775SSteven Whitehouse /* Promotion/grant of a glock */
19863997775SSteven Whitehouse TRACE_EVENT(gfs2_promote,
19963997775SSteven Whitehouse
200d74d0ce5SAndreas Gruenbacher TP_PROTO(const struct gfs2_holder *gh),
20163997775SSteven Whitehouse
202d74d0ce5SAndreas Gruenbacher TP_ARGS(gh),
20363997775SSteven Whitehouse
20463997775SSteven Whitehouse TP_STRUCT__entry(
20563997775SSteven Whitehouse __field( dev_t, dev )
20663997775SSteven Whitehouse __field( u64, glnum )
20763997775SSteven Whitehouse __field( u32, gltype )
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->state = glock_trace_state(gh->gh_state);
21663997775SSteven Whitehouse ),
21763997775SSteven Whitehouse
218d74d0ce5SAndreas Gruenbacher TP_printk("%u,%u glock %u:%llu promote %s",
21963997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
22063997775SSteven Whitehouse (unsigned long long)__entry->glnum,
22163997775SSteven Whitehouse glock_trace_name(__entry->state))
22263997775SSteven Whitehouse );
22363997775SSteven Whitehouse
22463997775SSteven Whitehouse /* Queue/dequeue a lock request */
22563997775SSteven Whitehouse TRACE_EVENT(gfs2_glock_queue,
22663997775SSteven Whitehouse
22763997775SSteven Whitehouse TP_PROTO(const struct gfs2_holder *gh, int queue),
22863997775SSteven Whitehouse
22963997775SSteven Whitehouse TP_ARGS(gh, queue),
23063997775SSteven Whitehouse
23163997775SSteven Whitehouse TP_STRUCT__entry(
23263997775SSteven Whitehouse __field( dev_t, dev )
23363997775SSteven Whitehouse __field( u64, glnum )
23463997775SSteven Whitehouse __field( u32, gltype )
23563997775SSteven Whitehouse __field( int, queue )
23663997775SSteven Whitehouse __field( u8, state )
23763997775SSteven Whitehouse ),
23863997775SSteven Whitehouse
23963997775SSteven Whitehouse TP_fast_assign(
24015562c43SBob Peterson __entry->dev = gh->gh_gl->gl_name.ln_sbd->sd_vfs->s_dev;
24163997775SSteven Whitehouse __entry->glnum = gh->gh_gl->gl_name.ln_number;
24263997775SSteven Whitehouse __entry->gltype = gh->gh_gl->gl_name.ln_type;
24363997775SSteven Whitehouse __entry->queue = queue;
24463997775SSteven Whitehouse __entry->state = glock_trace_state(gh->gh_state);
24563997775SSteven Whitehouse ),
24663997775SSteven Whitehouse
24763997775SSteven Whitehouse TP_printk("%u,%u glock %u:%llu %squeue %s",
24863997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
24963997775SSteven Whitehouse (unsigned long long)__entry->glnum,
25063997775SSteven Whitehouse __entry->queue ? "" : "de",
25163997775SSteven Whitehouse glock_trace_name(__entry->state))
25263997775SSteven Whitehouse );
25363997775SSteven Whitehouse
254a245769fSSteven Whitehouse /* DLM sends a reply to GFS2 */
255a245769fSSteven Whitehouse TRACE_EVENT(gfs2_glock_lock_time,
256a245769fSSteven Whitehouse
257a245769fSSteven Whitehouse TP_PROTO(const struct gfs2_glock *gl, s64 tdiff),
258a245769fSSteven Whitehouse
259a245769fSSteven Whitehouse TP_ARGS(gl, tdiff),
260a245769fSSteven Whitehouse
261a245769fSSteven Whitehouse TP_STRUCT__entry(
262a245769fSSteven Whitehouse __field( dev_t, dev )
263a245769fSSteven Whitehouse __field( u64, glnum )
264a245769fSSteven Whitehouse __field( u32, gltype )
265a245769fSSteven Whitehouse __field( int, status )
266a245769fSSteven Whitehouse __field( char, flags )
267a245769fSSteven Whitehouse __field( s64, tdiff )
2684d207133SBen Hutchings __field( u64, srtt )
2694d207133SBen Hutchings __field( u64, srttvar )
2704d207133SBen Hutchings __field( u64, srttb )
2714d207133SBen Hutchings __field( u64, srttvarb )
2724d207133SBen Hutchings __field( u64, sirt )
2734d207133SBen Hutchings __field( u64, sirtvar )
2744d207133SBen Hutchings __field( u64, dcount )
2754d207133SBen Hutchings __field( u64, qcount )
276a245769fSSteven Whitehouse ),
277a245769fSSteven Whitehouse
278a245769fSSteven Whitehouse TP_fast_assign(
27915562c43SBob Peterson __entry->dev = gl->gl_name.ln_sbd->sd_vfs->s_dev;
280a245769fSSteven Whitehouse __entry->glnum = gl->gl_name.ln_number;
281a245769fSSteven Whitehouse __entry->gltype = gl->gl_name.ln_type;
282a245769fSSteven Whitehouse __entry->status = gl->gl_lksb.sb_status;
283a245769fSSteven Whitehouse __entry->flags = gl->gl_lksb.sb_flags;
284a245769fSSteven Whitehouse __entry->tdiff = tdiff;
285a245769fSSteven Whitehouse __entry->srtt = gl->gl_stats.stats[GFS2_LKS_SRTT];
286a245769fSSteven Whitehouse __entry->srttvar = gl->gl_stats.stats[GFS2_LKS_SRTTVAR];
287a245769fSSteven Whitehouse __entry->srttb = gl->gl_stats.stats[GFS2_LKS_SRTTB];
288a245769fSSteven Whitehouse __entry->srttvarb = gl->gl_stats.stats[GFS2_LKS_SRTTVARB];
289a245769fSSteven Whitehouse __entry->sirt = gl->gl_stats.stats[GFS2_LKS_SIRT];
290a245769fSSteven Whitehouse __entry->sirtvar = gl->gl_stats.stats[GFS2_LKS_SIRTVAR];
291a245769fSSteven Whitehouse __entry->dcount = gl->gl_stats.stats[GFS2_LKS_DCOUNT];
292a245769fSSteven Whitehouse __entry->qcount = gl->gl_stats.stats[GFS2_LKS_QCOUNT];
293a245769fSSteven Whitehouse ),
294a245769fSSteven Whitehouse
295a245769fSSteven 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",
296a245769fSSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
297a245769fSSteven Whitehouse (unsigned long long)__entry->glnum,
298a245769fSSteven Whitehouse __entry->status, __entry->flags,
299a245769fSSteven Whitehouse (long long)__entry->tdiff,
300a245769fSSteven Whitehouse (long long)__entry->srtt,
301a245769fSSteven Whitehouse (long long)__entry->srttvar,
302a245769fSSteven Whitehouse (long long)__entry->srttb,
303a245769fSSteven Whitehouse (long long)__entry->srttvarb,
304a245769fSSteven Whitehouse (long long)__entry->sirt,
305a245769fSSteven Whitehouse (long long)__entry->sirtvar,
306a245769fSSteven Whitehouse (long long)__entry->dcount,
307a245769fSSteven Whitehouse (long long)__entry->qcount)
308a245769fSSteven Whitehouse );
309a245769fSSteven Whitehouse
31063997775SSteven Whitehouse /* Section 2 - Log/journal
31163997775SSteven Whitehouse *
31263997775SSteven Whitehouse * Objectives:
31363997775SSteven Whitehouse * Latency: Log flush time
31463997775SSteven Whitehouse * Correctness: pin/unpin vs. disk I/O ordering
31563997775SSteven Whitehouse * Performance: Log usage stats
31663997775SSteven Whitehouse */
31763997775SSteven Whitehouse
31863997775SSteven Whitehouse /* Pin/unpin a block in the log */
31963997775SSteven Whitehouse TRACE_EVENT(gfs2_pin,
32063997775SSteven Whitehouse
32163997775SSteven Whitehouse TP_PROTO(const struct gfs2_bufdata *bd, int pin),
32263997775SSteven Whitehouse
32363997775SSteven Whitehouse TP_ARGS(bd, pin),
32463997775SSteven Whitehouse
32563997775SSteven Whitehouse TP_STRUCT__entry(
32663997775SSteven Whitehouse __field( dev_t, dev )
32763997775SSteven Whitehouse __field( int, pin )
32863997775SSteven Whitehouse __field( u32, len )
32963997775SSteven Whitehouse __field( sector_t, block )
33063997775SSteven Whitehouse __field( u64, ino )
33163997775SSteven Whitehouse ),
33263997775SSteven Whitehouse
33363997775SSteven Whitehouse TP_fast_assign(
33415562c43SBob Peterson __entry->dev = bd->bd_gl->gl_name.ln_sbd->sd_vfs->s_dev;
33563997775SSteven Whitehouse __entry->pin = pin;
33663997775SSteven Whitehouse __entry->len = bd->bd_bh->b_size;
33763997775SSteven Whitehouse __entry->block = bd->bd_bh->b_blocknr;
33863997775SSteven Whitehouse __entry->ino = bd->bd_gl->gl_name.ln_number;
33963997775SSteven Whitehouse ),
34063997775SSteven Whitehouse
34163997775SSteven Whitehouse TP_printk("%u,%u log %s %llu/%lu inode %llu",
34263997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev),
34363997775SSteven Whitehouse __entry->pin ? "pin" : "unpin",
34463997775SSteven Whitehouse (unsigned long long)__entry->block,
34563997775SSteven Whitehouse (unsigned long)__entry->len,
34663997775SSteven Whitehouse (unsigned long long)__entry->ino)
34763997775SSteven Whitehouse );
34863997775SSteven Whitehouse
34963997775SSteven Whitehouse /* Flushing the log */
35063997775SSteven Whitehouse TRACE_EVENT(gfs2_log_flush,
35163997775SSteven Whitehouse
352805c0907SBob Peterson TP_PROTO(const struct gfs2_sbd *sdp, int start, u32 flags),
35363997775SSteven Whitehouse
354805c0907SBob Peterson TP_ARGS(sdp, start, flags),
35563997775SSteven Whitehouse
35663997775SSteven Whitehouse TP_STRUCT__entry(
35763997775SSteven Whitehouse __field( dev_t, dev )
35863997775SSteven Whitehouse __field( int, start )
35963997775SSteven Whitehouse __field( u64, log_seq )
360805c0907SBob Peterson __field( u32, flags )
36163997775SSteven Whitehouse ),
36263997775SSteven Whitehouse
36363997775SSteven Whitehouse TP_fast_assign(
36463997775SSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev;
36563997775SSteven Whitehouse __entry->start = start;
36663997775SSteven Whitehouse __entry->log_seq = sdp->sd_log_sequence;
367805c0907SBob Peterson __entry->flags = flags;
36863997775SSteven Whitehouse ),
36963997775SSteven Whitehouse
370805c0907SBob Peterson TP_printk("%u,%u log flush %s %llu %llx",
37163997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev),
37263997775SSteven Whitehouse __entry->start ? "start" : "end",
373805c0907SBob Peterson (unsigned long long)__entry->log_seq,
374805c0907SBob Peterson (unsigned long long)__entry->flags)
37563997775SSteven Whitehouse );
37663997775SSteven Whitehouse
37763997775SSteven Whitehouse /* Reserving/releasing blocks in the log */
37863997775SSteven Whitehouse TRACE_EVENT(gfs2_log_blocks,
37963997775SSteven Whitehouse
38063997775SSteven Whitehouse TP_PROTO(const struct gfs2_sbd *sdp, int blocks),
38163997775SSteven Whitehouse
38263997775SSteven Whitehouse TP_ARGS(sdp, blocks),
38363997775SSteven Whitehouse
38463997775SSteven Whitehouse TP_STRUCT__entry(
38563997775SSteven Whitehouse __field( dev_t, dev )
38663997775SSteven Whitehouse __field( int, blocks )
38797c5e43dSBob Peterson __field( int, blks_free )
38863997775SSteven Whitehouse ),
38963997775SSteven Whitehouse
39063997775SSteven Whitehouse TP_fast_assign(
39163997775SSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev;
39263997775SSteven Whitehouse __entry->blocks = blocks;
39397c5e43dSBob Peterson __entry->blks_free = atomic_read(&sdp->sd_log_blks_free);
39463997775SSteven Whitehouse ),
39563997775SSteven Whitehouse
39697c5e43dSBob Peterson TP_printk("%u,%u log reserve %d %d", MAJOR(__entry->dev),
39797c5e43dSBob Peterson MINOR(__entry->dev), __entry->blocks, __entry->blks_free)
39863997775SSteven Whitehouse );
39963997775SSteven Whitehouse
400c83ae9caSSteven Whitehouse /* Writing back the AIL */
401c83ae9caSSteven Whitehouse TRACE_EVENT(gfs2_ail_flush,
402c83ae9caSSteven Whitehouse
403c83ae9caSSteven Whitehouse TP_PROTO(const struct gfs2_sbd *sdp, const struct writeback_control *wbc, int start),
404c83ae9caSSteven Whitehouse
405c83ae9caSSteven Whitehouse TP_ARGS(sdp, wbc, start),
406c83ae9caSSteven Whitehouse
407c83ae9caSSteven Whitehouse TP_STRUCT__entry(
408c83ae9caSSteven Whitehouse __field( dev_t, dev )
409c83ae9caSSteven Whitehouse __field( int, start )
410c83ae9caSSteven Whitehouse __field( int, sync_mode )
411c83ae9caSSteven Whitehouse __field( long, nr_to_write )
412c83ae9caSSteven Whitehouse ),
413c83ae9caSSteven Whitehouse
414c83ae9caSSteven Whitehouse TP_fast_assign(
415c83ae9caSSteven Whitehouse __entry->dev = sdp->sd_vfs->s_dev;
416c83ae9caSSteven Whitehouse __entry->start = start;
417c83ae9caSSteven Whitehouse __entry->sync_mode = wbc->sync_mode;
418c83ae9caSSteven Whitehouse __entry->nr_to_write = wbc->nr_to_write;
419c83ae9caSSteven Whitehouse ),
420c83ae9caSSteven Whitehouse
421c83ae9caSSteven Whitehouse TP_printk("%u,%u ail flush %s %s %ld", MAJOR(__entry->dev),
422c83ae9caSSteven Whitehouse MINOR(__entry->dev), __entry->start ? "start" : "end",
423c83ae9caSSteven Whitehouse __entry->sync_mode == WB_SYNC_ALL ? "all" : "none",
424c83ae9caSSteven Whitehouse __entry->nr_to_write)
425c83ae9caSSteven Whitehouse );
426c83ae9caSSteven Whitehouse
42763997775SSteven Whitehouse /* Section 3 - bmap
42863997775SSteven Whitehouse *
42963997775SSteven Whitehouse * Objectives:
43063997775SSteven Whitehouse * Latency: Bmap request time
43163997775SSteven Whitehouse * Performance: Block allocator tracing
43263997775SSteven Whitehouse * Correctness: Test of disard generation vs. blocks allocated
43363997775SSteven Whitehouse */
43463997775SSteven Whitehouse
43563997775SSteven Whitehouse /* Map an extent of blocks, possibly a new allocation */
43663997775SSteven Whitehouse TRACE_EVENT(gfs2_bmap,
43763997775SSteven Whitehouse
43863997775SSteven Whitehouse TP_PROTO(const struct gfs2_inode *ip, const struct buffer_head *bh,
43963997775SSteven Whitehouse sector_t lblock, int create, int errno),
44063997775SSteven Whitehouse
44163997775SSteven Whitehouse TP_ARGS(ip, bh, lblock, create, errno),
44263997775SSteven Whitehouse
44363997775SSteven Whitehouse TP_STRUCT__entry(
44463997775SSteven Whitehouse __field( dev_t, dev )
44563997775SSteven Whitehouse __field( sector_t, lblock )
44663997775SSteven Whitehouse __field( sector_t, pblock )
44763997775SSteven Whitehouse __field( u64, inum )
44863997775SSteven Whitehouse __field( unsigned long, state )
44963997775SSteven Whitehouse __field( u32, len )
45063997775SSteven Whitehouse __field( int, create )
45163997775SSteven Whitehouse __field( int, errno )
45263997775SSteven Whitehouse ),
45363997775SSteven Whitehouse
45463997775SSteven Whitehouse TP_fast_assign(
45515562c43SBob Peterson __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
45663997775SSteven Whitehouse __entry->lblock = lblock;
45763997775SSteven Whitehouse __entry->pblock = buffer_mapped(bh) ? bh->b_blocknr : 0;
45863997775SSteven Whitehouse __entry->inum = ip->i_no_addr;
45963997775SSteven Whitehouse __entry->state = bh->b_state;
46063997775SSteven Whitehouse __entry->len = bh->b_size;
46163997775SSteven Whitehouse __entry->create = create;
46263997775SSteven Whitehouse __entry->errno = errno;
46363997775SSteven Whitehouse ),
46463997775SSteven Whitehouse
46563997775SSteven Whitehouse TP_printk("%u,%u bmap %llu map %llu/%lu to %llu flags:%08lx %s %d",
46663997775SSteven Whitehouse MAJOR(__entry->dev), MINOR(__entry->dev),
46763997775SSteven Whitehouse (unsigned long long)__entry->inum,
46863997775SSteven Whitehouse (unsigned long long)__entry->lblock,
46963997775SSteven Whitehouse (unsigned long)__entry->len,
47063997775SSteven Whitehouse (unsigned long long)__entry->pblock,
47163997775SSteven Whitehouse __entry->state, __entry->create ? "create " : "nocreate",
47263997775SSteven Whitehouse __entry->errno)
47363997775SSteven Whitehouse );
47463997775SSteven Whitehouse
4753974320cSBob Peterson TRACE_EVENT(gfs2_iomap_start,
4763974320cSBob Peterson
4773974320cSBob Peterson TP_PROTO(const struct gfs2_inode *ip, loff_t pos, ssize_t length,
4783974320cSBob Peterson u16 flags),
4793974320cSBob Peterson
4803974320cSBob Peterson TP_ARGS(ip, pos, length, flags),
4813974320cSBob Peterson
4823974320cSBob Peterson TP_STRUCT__entry(
4833974320cSBob Peterson __field( dev_t, dev )
4843974320cSBob Peterson __field( u64, inum )
4853974320cSBob Peterson __field( loff_t, pos )
4863974320cSBob Peterson __field( ssize_t, length )
4873974320cSBob Peterson __field( u16, flags )
4883974320cSBob Peterson ),
4893974320cSBob Peterson
4903974320cSBob Peterson TP_fast_assign(
4913974320cSBob Peterson __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
4923974320cSBob Peterson __entry->inum = ip->i_no_addr;
4933974320cSBob Peterson __entry->pos = pos;
4943974320cSBob Peterson __entry->length = length;
4953974320cSBob Peterson __entry->flags = flags;
4963974320cSBob Peterson ),
4973974320cSBob Peterson
4983974320cSBob Peterson TP_printk("%u,%u bmap %llu iomap start %llu/%lu flags:%08x",
4993974320cSBob Peterson MAJOR(__entry->dev), MINOR(__entry->dev),
5003974320cSBob Peterson (unsigned long long)__entry->inum,
5013974320cSBob Peterson (unsigned long long)__entry->pos,
5023974320cSBob Peterson (unsigned long)__entry->length, (u16)__entry->flags)
5033974320cSBob Peterson );
5043974320cSBob Peterson
5053974320cSBob Peterson TRACE_EVENT(gfs2_iomap_end,
5063974320cSBob Peterson
5073974320cSBob Peterson TP_PROTO(const struct gfs2_inode *ip, struct iomap *iomap, int ret),
5083974320cSBob Peterson
5093974320cSBob Peterson TP_ARGS(ip, iomap, ret),
5103974320cSBob Peterson
5113974320cSBob Peterson TP_STRUCT__entry(
5123974320cSBob Peterson __field( dev_t, dev )
5133974320cSBob Peterson __field( u64, inum )
5143974320cSBob Peterson __field( loff_t, offset )
5153974320cSBob Peterson __field( ssize_t, length )
516ee6ed857SAndreas Gruenbacher __field( sector_t, pblock )
5173974320cSBob Peterson __field( u16, flags )
5183974320cSBob Peterson __field( u16, type )
5193974320cSBob Peterson __field( int, ret )
5203974320cSBob Peterson ),
5213974320cSBob Peterson
5223974320cSBob Peterson TP_fast_assign(
5233974320cSBob Peterson __entry->dev = ip->i_gl->gl_name.ln_sbd->sd_vfs->s_dev;
5243974320cSBob Peterson __entry->inum = ip->i_no_addr;
5253974320cSBob Peterson __entry->offset = iomap->offset;
5263974320cSBob Peterson __entry->length = iomap->length;
527ee6ed857SAndreas Gruenbacher __entry->pblock = iomap->addr == IOMAP_NULL_ADDR ? 0 :
528ee6ed857SAndreas Gruenbacher (iomap->addr >> ip->i_inode.i_blkbits);
5293974320cSBob Peterson __entry->flags = iomap->flags;
5303974320cSBob Peterson __entry->type = iomap->type;
5313974320cSBob Peterson __entry->ret = ret;
5323974320cSBob Peterson ),
5333974320cSBob Peterson
534ee6ed857SAndreas Gruenbacher TP_printk("%u,%u bmap %llu iomap end %llu/%lu to %llu ty:%d flags:%08x rc:%d",
5353974320cSBob Peterson MAJOR(__entry->dev), MINOR(__entry->dev),
5363974320cSBob Peterson (unsigned long long)__entry->inum,
5373974320cSBob Peterson (unsigned long long)__entry->offset,
538ee6ed857SAndreas Gruenbacher (unsigned long)__entry->length,
539ee6ed857SAndreas Gruenbacher (long long)__entry->pblock,
540ee6ed857SAndreas Gruenbacher (u16)__entry->type,
5413974320cSBob Peterson (u16)__entry->flags, __entry->ret)
5423974320cSBob Peterson );
5433974320cSBob Peterson
54463997775SSteven Whitehouse /* Keep track of blocks as they are allocated/freed */
54563997775SSteven Whitehouse TRACE_EVENT(gfs2_block_alloc,
54663997775SSteven Whitehouse
54741db1ab9SBob Peterson TP_PROTO(const struct gfs2_inode *ip, struct gfs2_rgrpd *rgd,
54841db1ab9SBob Peterson u64 block, unsigned len, u8 block_state),
54963997775SSteven Whitehouse
55041db1ab9SBob Peterson TP_ARGS(ip, rgd, block, len, block_state),
55163997775SSteven Whitehouse
55263997775SSteven Whitehouse TP_STRUCT__entry(
55363997775SSteven Whitehouse __field( dev_t, dev )
55463997775SSteven Whitehouse __field( u64, start )
55563997775SSteven Whitehouse __field( u64, inum )
55663997775SSteven Whitehouse __field( u32, len )
55763997775SSteven Whitehouse __field( u8, block_state )
55841db1ab9SBob Peterson __field( u64, rd_addr )
55941db1ab9SBob Peterson __field( u32, rd_free_clone )
56007974d2aSAndreas Gruenbacher __field( u32, rd_requested )
561725d0e9dSAndreas Gruenbacher __field( u32, rd_reserved )
56263997775SSteven Whitehouse ),
56363997775SSteven Whitehouse
56463997775SSteven Whitehouse TP_fast_assign(
56515562c43SBob Peterson __entry->dev = rgd->rd_gl->gl_name.ln_sbd->sd_vfs->s_dev;
56663997775SSteven Whitehouse __entry->start = block;
56763997775SSteven Whitehouse __entry->inum = ip->i_no_addr;
56863997775SSteven Whitehouse __entry->len = len;
56963997775SSteven Whitehouse __entry->block_state = block_state;
57041db1ab9SBob Peterson __entry->rd_addr = rgd->rd_addr;
57141db1ab9SBob Peterson __entry->rd_free_clone = rgd->rd_free_clone;
57207974d2aSAndreas Gruenbacher __entry->rd_requested = rgd->rd_requested;
573725d0e9dSAndreas Gruenbacher __entry->rd_reserved = rgd->rd_reserved;
57463997775SSteven Whitehouse ),
57563997775SSteven Whitehouse
576725d0e9dSAndreas Gruenbacher TP_printk("%u,%u bmap %llu alloc %llu/%lu %s rg:%llu rf:%u rq:%u rr:%u",
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,
583725d0e9dSAndreas Gruenbacher __entry->rd_free_clone,
584725d0e9dSAndreas Gruenbacher __entry->rd_requested,
585725d0e9dSAndreas Gruenbacher __entry->rd_reserved)
5868e2e0047SBob Peterson );
5878e2e0047SBob Peterson
5888e2e0047SBob Peterson /* Keep track of multi-block reservations as they are allocated/freed */
5898e2e0047SBob Peterson TRACE_EVENT(gfs2_rs,
5908e2e0047SBob Peterson
5919e733d39SSteven Whitehouse TP_PROTO(const struct gfs2_blkreserv *rs, u8 func),
5928e2e0047SBob Peterson
5939e733d39SSteven Whitehouse TP_ARGS(rs, func),
5948e2e0047SBob Peterson
5958e2e0047SBob Peterson TP_STRUCT__entry(
5968e2e0047SBob Peterson __field( dev_t, dev )
5978e2e0047SBob Peterson __field( u64, rd_addr )
5988e2e0047SBob Peterson __field( u32, rd_free_clone )
59907974d2aSAndreas Gruenbacher __field( u32, rd_requested )
600725d0e9dSAndreas Gruenbacher __field( u32, rd_reserved )
6018e2e0047SBob Peterson __field( u64, inum )
6028e2e0047SBob Peterson __field( u64, start )
60307974d2aSAndreas Gruenbacher __field( u32, requested )
604725d0e9dSAndreas Gruenbacher __field( u32, reserved )
6058e2e0047SBob Peterson __field( u8, func )
6068e2e0047SBob Peterson ),
6078e2e0047SBob Peterson
6088e2e0047SBob Peterson TP_fast_assign(
609c65b76b8SAndreas Gruenbacher __entry->dev = rs->rs_rgd->rd_sbd->sd_vfs->s_dev;
610c65b76b8SAndreas Gruenbacher __entry->rd_addr = rs->rs_rgd->rd_addr;
611c65b76b8SAndreas Gruenbacher __entry->rd_free_clone = rs->rs_rgd->rd_free_clone;
61207974d2aSAndreas Gruenbacher __entry->rd_requested = rs->rs_rgd->rd_requested;
613725d0e9dSAndreas Gruenbacher __entry->rd_reserved = rs->rs_rgd->rd_reserved;
614f85c10e2SBob Peterson __entry->inum = container_of(rs, struct gfs2_inode,
615f85c10e2SBob Peterson i_res)->i_no_addr;
616c65b76b8SAndreas Gruenbacher __entry->start = rs->rs_start;
61707974d2aSAndreas Gruenbacher __entry->requested = rs->rs_requested;
618725d0e9dSAndreas Gruenbacher __entry->reserved = rs->rs_reserved;
6198e2e0047SBob Peterson __entry->func = func;
6208e2e0047SBob Peterson ),
6218e2e0047SBob Peterson
622725d0e9dSAndreas Gruenbacher TP_printk("%u,%u bmap %llu resrv %llu rg:%llu rf:%u rq:%u rr:%u %s q:%u r:%u",
6238e2e0047SBob Peterson MAJOR(__entry->dev), MINOR(__entry->dev),
6248e2e0047SBob Peterson (unsigned long long)__entry->inum,
6258e2e0047SBob Peterson (unsigned long long)__entry->start,
6268e2e0047SBob Peterson (unsigned long long)__entry->rd_addr,
627725d0e9dSAndreas Gruenbacher __entry->rd_free_clone,
628725d0e9dSAndreas Gruenbacher __entry->rd_requested,
629725d0e9dSAndreas Gruenbacher __entry->rd_reserved,
630725d0e9dSAndreas Gruenbacher rs_func_name(__entry->func),
631725d0e9dSAndreas Gruenbacher __entry->requested,
632725d0e9dSAndreas Gruenbacher __entry->reserved)
63363997775SSteven Whitehouse );
63463997775SSteven Whitehouse
63563997775SSteven Whitehouse #endif /* _TRACE_GFS2_H */
63663997775SSteven Whitehouse
63763997775SSteven Whitehouse /* This part must be outside protection */
63863997775SSteven Whitehouse #undef TRACE_INCLUDE_PATH
63963997775SSteven Whitehouse #define TRACE_INCLUDE_PATH .
640d0b6e04aSLi Zefan #define TRACE_INCLUDE_FILE trace_gfs2
64163997775SSteven Whitehouse #include <trace/define_trace.h>
64263997775SSteven Whitehouse
643