xref: /linux/fs/zonefs/trace.h (revision bdaedca74d6293b6ac643a8ebe8231b52bf1171b)
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 inode *inode, enum req_opf op),
24 	    TP_ARGS(inode, op),
25 	    TP_STRUCT__entry(
26 			     __field(dev_t, dev)
27 			     __field(ino_t, ino)
28 			     __field(int, op)
29 			     __field(sector_t, sector)
30 			     __field(sector_t, nr_sectors)
31 	    ),
32 	    TP_fast_assign(
33 			   __entry->dev = inode->i_sb->s_dev;
34 			   __entry->ino = inode->i_ino;
35 			   __entry->op = op;
36 			   __entry->sector = ZONEFS_I(inode)->i_zsector;
37 			   __entry->nr_sectors =
38 				   ZONEFS_I(inode)->i_zone_size >> SECTOR_SHIFT;
39 	    ),
40 	    TP_printk("bdev=(%d,%d), ino=%lu op=%s, sector=%llu, nr_sectors=%llu",
41 		      show_dev(__entry->dev), (unsigned long)__entry->ino,
42 		      blk_op_str(__entry->op), __entry->sector,
43 		      __entry->nr_sectors
44 	    )
45 );
46 
47 TRACE_EVENT(zonefs_file_dio_append,
48 	    TP_PROTO(struct inode *inode, ssize_t size, ssize_t ret),
49 	    TP_ARGS(inode, size, ret),
50 	    TP_STRUCT__entry(
51 			     __field(dev_t, dev)
52 			     __field(ino_t, ino)
53 			     __field(sector_t, sector)
54 			     __field(ssize_t, size)
55 			     __field(loff_t, wpoffset)
56 			     __field(ssize_t, ret)
57 	    ),
58 	    TP_fast_assign(
59 			   __entry->dev = inode->i_sb->s_dev;
60 			   __entry->ino = inode->i_ino;
61 			   __entry->sector = ZONEFS_I(inode)->i_zsector;
62 			   __entry->size = size;
63 			   __entry->wpoffset = ZONEFS_I(inode)->i_wpoffset;
64 			   __entry->ret = ret;
65 	    ),
66 	    TP_printk("bdev=(%d, %d), ino=%lu, sector=%llu, size=%zu, wpoffset=%llu, ret=%zu",
67 		      show_dev(__entry->dev), (unsigned long)__entry->ino,
68 		      __entry->sector, __entry->size, __entry->wpoffset,
69 		      __entry->ret
70 	    )
71 );
72 
73 TRACE_EVENT(zonefs_iomap_begin,
74 	    TP_PROTO(struct inode *inode, struct iomap *iomap),
75 	    TP_ARGS(inode, iomap),
76 	    TP_STRUCT__entry(
77 			     __field(dev_t, dev)
78 			     __field(ino_t, ino)
79 			     __field(u64, addr)
80 			     __field(loff_t, offset)
81 			     __field(u64, length)
82 	    ),
83 	    TP_fast_assign(
84 			   __entry->dev = inode->i_sb->s_dev;
85 			   __entry->ino = inode->i_ino;
86 			   __entry->addr = iomap->addr;
87 			   __entry->offset = iomap->offset;
88 			   __entry->length = iomap->length;
89 	    ),
90 	    TP_printk("bdev=(%d,%d), ino=%lu, addr=%llu, offset=%llu, length=%llu",
91 		      show_dev(__entry->dev), (unsigned long)__entry->ino,
92 		      __entry->addr, __entry->offset, __entry->length
93 	    )
94 );
95 
96 #endif /* _TRACE_ZONEFS_H */
97 
98 #undef TRACE_INCLUDE_PATH
99 #define TRACE_INCLUDE_PATH .
100 #undef TRACE_INCLUDE_FILE
101 #define TRACE_INCLUDE_FILE trace
102 
103 /* This part must be outside protection */
104 #include <trace/define_trace.h>
105