xref: /linux/fs/ext2/trace.h (revision cdd5b5a9761fd66d17586e4f4ba6588c70e640ea)
1*6e335cd7SRitesh Harjani (IBM) // SPDX-License-Identifier: GPL-2.0
2*6e335cd7SRitesh Harjani (IBM) 
3*6e335cd7SRitesh Harjani (IBM) #undef TRACE_SYSTEM
4*6e335cd7SRitesh Harjani (IBM) #define TRACE_SYSTEM ext2
5*6e335cd7SRitesh Harjani (IBM) 
6*6e335cd7SRitesh Harjani (IBM) #if !defined(_EXT2_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
7*6e335cd7SRitesh Harjani (IBM) #define _EXT2_TRACE_H
8*6e335cd7SRitesh Harjani (IBM) 
9*6e335cd7SRitesh Harjani (IBM) #include <linux/tracepoint.h>
10*6e335cd7SRitesh Harjani (IBM) 
11*6e335cd7SRitesh Harjani (IBM) DECLARE_EVENT_CLASS(ext2_dio_class,
12*6e335cd7SRitesh Harjani (IBM) 	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter, ssize_t ret),
13*6e335cd7SRitesh Harjani (IBM) 	TP_ARGS(iocb, iter, ret),
14*6e335cd7SRitesh Harjani (IBM) 	TP_STRUCT__entry(
15*6e335cd7SRitesh Harjani (IBM) 		__field(dev_t,	dev)
16*6e335cd7SRitesh Harjani (IBM) 		__field(ino_t,	ino)
17*6e335cd7SRitesh Harjani (IBM) 		__field(loff_t, isize)
18*6e335cd7SRitesh Harjani (IBM) 		__field(loff_t, pos)
19*6e335cd7SRitesh Harjani (IBM) 		__field(size_t,	count)
20*6e335cd7SRitesh Harjani (IBM) 		__field(int,	ki_flags)
21*6e335cd7SRitesh Harjani (IBM) 		__field(bool,	aio)
22*6e335cd7SRitesh Harjani (IBM) 		__field(ssize_t, ret)
23*6e335cd7SRitesh Harjani (IBM) 	),
24*6e335cd7SRitesh Harjani (IBM) 	TP_fast_assign(
25*6e335cd7SRitesh Harjani (IBM) 		__entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
26*6e335cd7SRitesh Harjani (IBM) 		__entry->ino = file_inode(iocb->ki_filp)->i_ino;
27*6e335cd7SRitesh Harjani (IBM) 		__entry->isize = file_inode(iocb->ki_filp)->i_size;
28*6e335cd7SRitesh Harjani (IBM) 		__entry->pos = iocb->ki_pos;
29*6e335cd7SRitesh Harjani (IBM) 		__entry->count = iov_iter_count(iter);
30*6e335cd7SRitesh Harjani (IBM) 		__entry->ki_flags = iocb->ki_flags;
31*6e335cd7SRitesh Harjani (IBM) 		__entry->aio = !is_sync_kiocb(iocb);
32*6e335cd7SRitesh Harjani (IBM) 		__entry->ret = ret;
33*6e335cd7SRitesh Harjani (IBM) 	),
34*6e335cd7SRitesh Harjani (IBM) 	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx pos 0x%llx len %zu flags %s aio %d ret %zd",
35*6e335cd7SRitesh Harjani (IBM) 		  MAJOR(__entry->dev), MINOR(__entry->dev),
36*6e335cd7SRitesh Harjani (IBM) 		  __entry->ino,
37*6e335cd7SRitesh Harjani (IBM) 		  __entry->isize,
38*6e335cd7SRitesh Harjani (IBM) 		  __entry->pos,
39*6e335cd7SRitesh Harjani (IBM) 		  __entry->count,
40*6e335cd7SRitesh Harjani (IBM) 		  __print_flags(__entry->ki_flags, "|", TRACE_IOCB_STRINGS),
41*6e335cd7SRitesh Harjani (IBM) 		  __entry->aio,
42*6e335cd7SRitesh Harjani (IBM) 		  __entry->ret)
43*6e335cd7SRitesh Harjani (IBM) );
44*6e335cd7SRitesh Harjani (IBM) 
45*6e335cd7SRitesh Harjani (IBM) #define DEFINE_DIO_RW_EVENT(name)					  \
46*6e335cd7SRitesh Harjani (IBM) DEFINE_EVENT(ext2_dio_class, name,					  \
47*6e335cd7SRitesh Harjani (IBM) 	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter, ssize_t ret), \
48*6e335cd7SRitesh Harjani (IBM) 	TP_ARGS(iocb, iter, ret))
49*6e335cd7SRitesh Harjani (IBM) DEFINE_DIO_RW_EVENT(ext2_dio_write_begin);
50*6e335cd7SRitesh Harjani (IBM) DEFINE_DIO_RW_EVENT(ext2_dio_write_end);
51*6e335cd7SRitesh Harjani (IBM) DEFINE_DIO_RW_EVENT(ext2_dio_write_buff_end);
52*6e335cd7SRitesh Harjani (IBM) DEFINE_DIO_RW_EVENT(ext2_dio_read_begin);
53*6e335cd7SRitesh Harjani (IBM) DEFINE_DIO_RW_EVENT(ext2_dio_read_end);
54*6e335cd7SRitesh Harjani (IBM) 
55*6e335cd7SRitesh Harjani (IBM) TRACE_EVENT(ext2_dio_write_endio,
56*6e335cd7SRitesh Harjani (IBM) 	TP_PROTO(struct kiocb *iocb, ssize_t size, int ret),
57*6e335cd7SRitesh Harjani (IBM) 	TP_ARGS(iocb, size, ret),
58*6e335cd7SRitesh Harjani (IBM) 	TP_STRUCT__entry(
59*6e335cd7SRitesh Harjani (IBM) 		__field(dev_t,	dev)
60*6e335cd7SRitesh Harjani (IBM) 		__field(ino_t,	ino)
61*6e335cd7SRitesh Harjani (IBM) 		__field(loff_t, isize)
62*6e335cd7SRitesh Harjani (IBM) 		__field(loff_t, pos)
63*6e335cd7SRitesh Harjani (IBM) 		__field(ssize_t, size)
64*6e335cd7SRitesh Harjani (IBM) 		__field(int,	ki_flags)
65*6e335cd7SRitesh Harjani (IBM) 		__field(bool,	aio)
66*6e335cd7SRitesh Harjani (IBM) 		__field(int,	ret)
67*6e335cd7SRitesh Harjani (IBM) 	),
68*6e335cd7SRitesh Harjani (IBM) 	TP_fast_assign(
69*6e335cd7SRitesh Harjani (IBM) 		__entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
70*6e335cd7SRitesh Harjani (IBM) 		__entry->ino = file_inode(iocb->ki_filp)->i_ino;
71*6e335cd7SRitesh Harjani (IBM) 		__entry->isize = file_inode(iocb->ki_filp)->i_size;
72*6e335cd7SRitesh Harjani (IBM) 		__entry->pos = iocb->ki_pos;
73*6e335cd7SRitesh Harjani (IBM) 		__entry->size = size;
74*6e335cd7SRitesh Harjani (IBM) 		__entry->ki_flags = iocb->ki_flags;
75*6e335cd7SRitesh Harjani (IBM) 		__entry->aio = !is_sync_kiocb(iocb);
76*6e335cd7SRitesh Harjani (IBM) 		__entry->ret = ret;
77*6e335cd7SRitesh Harjani (IBM) 	),
78*6e335cd7SRitesh Harjani (IBM) 	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx pos 0x%llx len %zd flags %s aio %d ret %d",
79*6e335cd7SRitesh Harjani (IBM) 		  MAJOR(__entry->dev), MINOR(__entry->dev),
80*6e335cd7SRitesh Harjani (IBM) 		  __entry->ino,
81*6e335cd7SRitesh Harjani (IBM) 		  __entry->isize,
82*6e335cd7SRitesh Harjani (IBM) 		  __entry->pos,
83*6e335cd7SRitesh Harjani (IBM) 		  __entry->size,
84*6e335cd7SRitesh Harjani (IBM) 		  __print_flags(__entry->ki_flags, "|", TRACE_IOCB_STRINGS),
85*6e335cd7SRitesh Harjani (IBM) 		  __entry->aio,
86*6e335cd7SRitesh Harjani (IBM) 		  __entry->ret)
87*6e335cd7SRitesh Harjani (IBM) );
88*6e335cd7SRitesh Harjani (IBM) 
89*6e335cd7SRitesh Harjani (IBM) #endif /* _EXT2_TRACE_H */
90*6e335cd7SRitesh Harjani (IBM) 
91*6e335cd7SRitesh Harjani (IBM) #undef TRACE_INCLUDE_PATH
92*6e335cd7SRitesh Harjani (IBM) #define TRACE_INCLUDE_PATH .
93*6e335cd7SRitesh Harjani (IBM) #define TRACE_INCLUDE_FILE trace
94*6e335cd7SRitesh Harjani (IBM) #include <trace/define_trace.h>
95