xref: /openbmc/linux/fs/zonefs/trace.h (revision 2d594783)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * zonefs filesystem driver tracepoints.
4  *
5  * Copyright (C) 2021 Western Digital Corporation or its affiliates.
6  */
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM zonefs
10 
11 #if !defined(_TRACE_ZONEFS_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_ZONEFS_H
13 
14 #include <linux/tracepoint.h>
15 #include <linux/trace_seq.h>
16 #include <linux/blkdev.h>
17 
18 #include "zonefs.h"
19 
20 #define show_dev(dev) MAJOR(dev), MINOR(dev)
21 
22 TRACE_EVENT(zonefs_zone_mgmt,
23 	    TP_PROTO(struct super_block *sb, struct zonefs_zone *z,
24 		     enum req_op op),
25 	    TP_ARGS(sb, z, op),
26 	    TP_STRUCT__entry(
27 			     __field(dev_t, dev)
28 			     __field(ino_t, ino)
29 			     __field(enum req_op, op)
30 			     __field(sector_t, sector)
31 			     __field(sector_t, nr_sectors)
32 	    ),
33 	    TP_fast_assign(
34 			   __entry->dev = sb->s_dev;
35 			   __entry->ino =
36 				z->z_sector >> ZONEFS_SB(sb)->s_zone_sectors_shift;
37 			   __entry->op = op;
38 			   __entry->sector = z->z_sector;
39 			   __entry->nr_sectors = z->z_size >> SECTOR_SHIFT;
40 	    ),
41 	    TP_printk("bdev=(%d,%d), ino=%lu op=%s, sector=%llu, nr_sectors=%llu",
42 		      show_dev(__entry->dev), (unsigned long)__entry->ino,
43 		      blk_op_str(__entry->op), __entry->sector,
44 		      __entry->nr_sectors
45 	    )
46 );
47 
48 TRACE_EVENT(zonefs_file_dio_append,
49 	    TP_PROTO(struct inode *inode, ssize_t size, ssize_t ret),
50 	    TP_ARGS(inode, size, ret),
51 	    TP_STRUCT__entry(
52 			     __field(dev_t, dev)
53 			     __field(ino_t, ino)
54 			     __field(sector_t, sector)
55 			     __field(ssize_t, size)
56 			     __field(loff_t, wpoffset)
57 			     __field(ssize_t, ret)
58 	    ),
59 	    TP_fast_assign(
60 			   __entry->dev = inode->i_sb->s_dev;
61 			   __entry->ino = inode->i_ino;
62 			   __entry->sector = zonefs_inode_zone(inode)->z_sector;
63 			   __entry->size = size;
64 			   __entry->wpoffset =
65 				zonefs_inode_zone(inode)->z_wpoffset;
66 			   __entry->ret = ret;
67 	    ),
68 	    TP_printk("bdev=(%d, %d), ino=%lu, sector=%llu, size=%zu, wpoffset=%llu, ret=%zu",
69 		      show_dev(__entry->dev), (unsigned long)__entry->ino,
70 		      __entry->sector, __entry->size, __entry->wpoffset,
71 		      __entry->ret
72 	    )
73 );
74 
75 TRACE_EVENT(zonefs_iomap_begin,
76 	    TP_PROTO(struct inode *inode, struct iomap *iomap),
77 	    TP_ARGS(inode, iomap),
78 	    TP_STRUCT__entry(
79 			     __field(dev_t, dev)
80 			     __field(ino_t, ino)
81 			     __field(u64, addr)
82 			     __field(loff_t, offset)
83 			     __field(u64, length)
84 	    ),
85 	    TP_fast_assign(
86 			   __entry->dev = inode->i_sb->s_dev;
87 			   __entry->ino = inode->i_ino;
88 			   __entry->addr = iomap->addr;
89 			   __entry->offset = iomap->offset;
90 			   __entry->length = iomap->length;
91 	    ),
92 	    TP_printk("bdev=(%d,%d), ino=%lu, addr=%llu, offset=%llu, length=%llu",
93 		      show_dev(__entry->dev), (unsigned long)__entry->ino,
94 		      __entry->addr, __entry->offset, __entry->length
95 	    )
96 );
97 
98 #endif /* _TRACE_ZONEFS_H */
99 
100 #undef TRACE_INCLUDE_PATH
101 #define TRACE_INCLUDE_PATH .
102 #undef TRACE_INCLUDE_FILE
103 #define TRACE_INCLUDE_FILE trace
104 
105 /* This part must be outside protection */
106 #include <trace/define_trace.h>
107