summaryrefslogtreecommitdiff
path: root/fs/ext2/trace.h
blob: 7d230e13576e78713846248eeb21fa0770130540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// SPDX-License-Identifier: GPL-2.0

#undef TRACE_SYSTEM
#define TRACE_SYSTEM ext2

#if !defined(_EXT2_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _EXT2_TRACE_H

#include <linux/tracepoint.h>

DECLARE_EVENT_CLASS(ext2_dio_class,
	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter, ssize_t ret),
	TP_ARGS(iocb, iter, ret),
	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t, isize)
		__field(loff_t, pos)
		__field(size_t,	count)
		__field(int,	ki_flags)
		__field(bool,	aio)
		__field(ssize_t, ret)
	),
	TP_fast_assign(
		__entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
		__entry->ino = file_inode(iocb->ki_filp)->i_ino;
		__entry->isize = file_inode(iocb->ki_filp)->i_size;
		__entry->pos = iocb->ki_pos;
		__entry->count = iov_iter_count(iter);
		__entry->ki_flags = iocb->ki_flags;
		__entry->aio = !is_sync_kiocb(iocb);
		__entry->ret = ret;
	),
	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx pos 0x%llx len %zu flags %s aio %d ret %zd",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->isize,
		  __entry->pos,
		  __entry->count,
		  __print_flags(__entry->ki_flags, "|", TRACE_IOCB_STRINGS),
		  __entry->aio,
		  __entry->ret)
);

#define DEFINE_DIO_RW_EVENT(name)					  \
DEFINE_EVENT(ext2_dio_class, name,					  \
	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter, ssize_t ret), \
	TP_ARGS(iocb, iter, ret))
DEFINE_DIO_RW_EVENT(ext2_dio_write_begin);
DEFINE_DIO_RW_EVENT(ext2_dio_write_end);
DEFINE_DIO_RW_EVENT(ext2_dio_write_buff_end);
DEFINE_DIO_RW_EVENT(ext2_dio_read_begin);
DEFINE_DIO_RW_EVENT(ext2_dio_read_end);

TRACE_EVENT(ext2_dio_write_endio,
	TP_PROTO(struct kiocb *iocb, ssize_t size, int ret),
	TP_ARGS(iocb, size, ret),
	TP_STRUCT__entry(
		__field(dev_t,	dev)
		__field(ino_t,	ino)
		__field(loff_t, isize)
		__field(loff_t, pos)
		__field(ssize_t, size)
		__field(int,	ki_flags)
		__field(bool,	aio)
		__field(int,	ret)
	),
	TP_fast_assign(
		__entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
		__entry->ino = file_inode(iocb->ki_filp)->i_ino;
		__entry->isize = file_inode(iocb->ki_filp)->i_size;
		__entry->pos = iocb->ki_pos;
		__entry->size = size;
		__entry->ki_flags = iocb->ki_flags;
		__entry->aio = !is_sync_kiocb(iocb);
		__entry->ret = ret;
	),
	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx pos 0x%llx len %zd flags %s aio %d ret %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->isize,
		  __entry->pos,
		  __entry->size,
		  __print_flags(__entry->ki_flags, "|", TRACE_IOCB_STRINGS),
		  __entry->aio,
		  __entry->ret)
);

#endif /* _EXT2_TRACE_H */

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE trace
#include <trace/define_trace.h>