Skip to content

ext4: Workaround trace event flag decoding issues

Dmitry Monakhov linux-ext4 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ext4: Use raw numbers for EXT4_MAP_XXX flagsfs/ext4/ext4.h+22 -40 replies
2/2ext4: Fix extent_status trace eventsfs/ext4/extents_status.h include/trace/events/ext4.h+19 -131 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] ext4: Workaround trace event flag decoding issues

Trace's macro __print_flags() produce raw event's decraration w/o knowing actual flags value. For example trace_ext4_map_blocks_exit() has two __print_flags tables, one for EXT4_GET_BLOCKS_XX, and second for EXT4_MAP_XXX

cat /sys/kernel/debug/tracing/events/ext4/ext4_ext_map_blocks_exit/format ..
print fmt: "dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u mflags %s ret %d",
....
__print_flags(REC->flags, "|", { 0x0001, "CREATE" }, { 0x0002, "UNWRIT" },... __print_flags(REC->mflags, "", { (1 << BH_New), "N" }, { (1 << BH_Mapped), "M" }..

First macro expanded w/o issued because EXT4_GET_BLOCKS_XXX flags are explicit
numbers, but second macro stil contains text fields because it depends on
implicit enum values. It is important to note that this is exact representation
of event's binary format. This means that perf-script can not decode bintrace
file because BH_XXX is just a text token which is unknown to userspace.
As result perf fail to decode it and fallback to dump it as raw hex number.
For example:
ext4:ext4_ext_map_blocks_exit: dev 253,0 ino 12 flags CREATE lblk 0 pblk 34304 len 1 mflags 0x60 ret 1

I tend to agree that this is likely to be trace API issue, but it looks like that EXT4 is the only subsystem which is affected. Others already workaround this by using explicit numbers. Let's do the same trick.
TOC:
ext4: Use raw numbers for EXT4_MAP_XXX flags
ext4: Fix extent_status trace events