1 ext4: add tracepoints for shutdown and file system errors
3 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 fs/ext4/super.c | 4 ++++
8 include/trace/events/ext4.h | 43 +++++++++++++++++++++++++++++++++++++++++++
9 3 files changed, 48 insertions(+)
11 diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
12 index 7e99ad02f1ba..4d1b1575f8ac 100644
15 @@ -481,6 +481,7 @@ static int ext4_shutdown(struct super_block *sb, unsigned long arg)
18 ext4_msg(sb, KERN_ALERT, "shut down requested (%d)", flags);
19 + trace_ext4_shutdown(sb, flags);
22 case EXT4_GOING_FLAGS_DEFAULT:
23 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
24 index 39bf464c35f1..756f515b762d 100644
27 @@ -448,6 +448,7 @@ void __ext4_error(struct super_block *sb, const char *function,
28 if (unlikely(ext4_forced_shutdown(EXT4_SB(sb))))
31 + trace_ext4_error(sb, function, line);
32 if (ext4_error_ratelimit(sb)) {
35 @@ -472,6 +473,7 @@ void __ext4_error_inode(struct inode *inode, const char *function,
36 if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
39 + trace_ext4_error(inode->i_sb, function, line);
40 es->s_last_error_ino = cpu_to_le32(inode->i_ino);
41 es->s_last_error_block = cpu_to_le64(block);
42 if (ext4_error_ratelimit(inode->i_sb)) {
43 @@ -507,6 +509,7 @@ void __ext4_error_file(struct file *file, const char *function,
44 if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb))))
47 + trace_ext4_error(inode->i_sb, function, line);
48 es = EXT4_SB(inode->i_sb)->s_es;
49 es->s_last_error_ino = cpu_to_le32(inode->i_ino);
50 if (ext4_error_ratelimit(inode->i_sb)) {
51 @@ -719,6 +722,7 @@ __acquires(bitlock)
52 if (unlikely(ext4_forced_shutdown(EXT4_SB(sb))))
55 + trace_ext4_error(sb, function, line);
56 es->s_last_error_ino = cpu_to_le32(ino);
57 es->s_last_error_block = cpu_to_le64(block);
58 __save_error_info(sb, function, line);
59 diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
60 index 4d0e3af4e561..0e31eb136c57 100644
61 --- a/include/trace/events/ext4.h
62 +++ b/include/trace/events/ext4.h
63 @@ -2585,6 +2585,49 @@ DEFINE_GETFSMAP_EVENT(ext4_getfsmap_low_key);
64 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_high_key);
65 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_mapping);
67 +TRACE_EVENT(ext4_shutdown,
68 + TP_PROTO(struct super_block *sb, unsigned long flags),
73 + __field( dev_t, dev )
74 + __field( unsigned, flags )
78 + __entry->dev = sb->s_dev;
79 + __entry->flags = flags;
82 + TP_printk("dev %d,%d flags %u",
83 + MAJOR(__entry->dev), MINOR(__entry->dev),
87 +TRACE_EVENT(ext4_error,
88 + TP_PROTO(struct super_block *sb, const char *function,
91 + TP_ARGS(sb, function, line),
94 + __field( dev_t, dev )
95 + __field( const char *, function )
96 + __field( unsigned, line )
100 + __entry->dev = sb->s_dev;
101 + __entry->function = function;
102 + __entry->line = line;
105 + TP_printk("dev %d,%d function %s line %u",
106 + MAJOR(__entry->dev), MINOR(__entry->dev),
107 + __entry->function, __entry->line)
110 #endif /* _TRACE_EXT4_H */
112 /* This part must be outside protection */