Skip to content

Commit 459c807

Browse files
dmonakhovtytso
authored andcommitted
ext4: fix symbolic enum printing in trace output
Trace's macro __print_flags() produce raw event's decraration w/o knowing actual flags value cat /sys/kernel/debug/tracing/events/ext4/ext4_ext_map_blocks_exit/format .. __print_flags(REC->mflags, "", { (1 << BH_New), For that reason we have to explicitly define it via special macro TRACE_DEFINE_ENUM() Also add missed EXTENT_STATUS_REFERENCED flag. #Before patch ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 2 flags lblk 0 pblk 4177 len 1 mflags 0x20 ret 1 ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 12 flags CREATE lblk 0 pblk 34304 len 1 mflags 0x60 ret 1 #With patch ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 2 flags lblk 0 pblk 4177 len 1 mflags M ret 1 ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 12 flags CREATE lblk 0 pblk 34816 len 1 mflags NM ret 1 Signed-off-by: Dmitry Monakhov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 57c32ea commit 459c807

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

include/trace/events/ext4.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ struct partial_cluster;
4848
{ EXT4_GET_BLOCKS_KEEP_SIZE, "KEEP_SIZE" }, \
4949
{ EXT4_GET_BLOCKS_ZERO, "ZERO" })
5050

51+
/*
52+
* __print_flags() requires that all enum values be wrapped in the
53+
* TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
54+
* ring buffer.
55+
*/
56+
TRACE_DEFINE_ENUM(BH_New);
57+
TRACE_DEFINE_ENUM(BH_Mapped);
58+
TRACE_DEFINE_ENUM(BH_Unwritten);
59+
TRACE_DEFINE_ENUM(BH_Boundary);
60+
5161
#define show_mflags(flags) __print_flags(flags, "", \
5262
{ EXT4_MAP_NEW, "N" }, \
5363
{ EXT4_MAP_MAPPED, "M" }, \
@@ -62,11 +72,18 @@ struct partial_cluster;
6272
{ EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER,"1ST_CLUSTER" },\
6373
{ EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER, "LAST_CLUSTER" })
6474

75+
TRACE_DEFINE_ENUM(ES_WRITTEN_B);
76+
TRACE_DEFINE_ENUM(ES_UNWRITTEN_B);
77+
TRACE_DEFINE_ENUM(ES_DELAYED_B);
78+
TRACE_DEFINE_ENUM(ES_HOLE_B);
79+
TRACE_DEFINE_ENUM(ES_REFERENCED_B);
80+
6581
#define show_extent_status(status) __print_flags(status, "", \
6682
{ EXTENT_STATUS_WRITTEN, "W" }, \
6783
{ EXTENT_STATUS_UNWRITTEN, "U" }, \
6884
{ EXTENT_STATUS_DELAYED, "D" }, \
69-
{ EXTENT_STATUS_HOLE, "H" })
85+
{ EXTENT_STATUS_HOLE, "H" }, \
86+
{ EXTENT_STATUS_REFERENCED, "R" })
7087

7188
#define show_falloc_mode(mode) __print_flags(mode, "|", \
7289
{ FALLOC_FL_KEEP_SIZE, "KEEP_SIZE"}, \

0 commit comments

Comments
 (0)