Skip to content

iotracing: refactor file path handling to support multiple directories#99

Merged
hao022 merged 1 commit intoccfos:mainfrom
sancppp:dir_resolution
Jan 10, 2026
Merged

iotracing: refactor file path handling to support multiple directories#99
hao022 merged 1 commit intoccfos:mainfrom
sancppp:dir_resolution

Conversation

@sancppp
Copy link
Copy Markdown
Contributor

@sancppp sancppp commented Jan 8, 2026

This pull request refactors how file path information is captured and represented in the I/O tracing code, both in the eBPF program (iotracing.c) and in the Go code that consumes its data (iotracing.go). Instead of storing only a few individual directory names, the code now captures a configurable depth of the file path in a more flexible array structure, and reconstructs the full path accordingly.

Before:

➜  huatuo git:(main) ./_output/bin/iotracing
===========================================================================
PID: 478     TOTAL_IO: R=14KB W=284KB  FILES: 1
COMMAND: /usr/lib/systemd/systemd-journald 
-----------------------------------
DEVICE  FS_READ FS_WRITE DISK_READ DISK_WRITE   LATENCY(μs)      FILE/INODE
[8:2]    13824B  291328B        0B   235520B   q2c=410  d2c=384  log/journal/f55d0c7bde9c471882841ea73d3ccb84/system.journal

===========================================================================
PID: 1297780 TOTAL_IO: R=14KB W=200KB  FILES: 3
COMMAND: /usr/bin/containerd 
-----------------------------------
DEVICE  FS_READ FS_WRITE DISK_READ DISK_WRITE   LATENCY(μs)      FILE/INODE
[8:2]        0B  204288B        0B   203776B   q2c=106  d2c=106  lib/containerd/io.containerd.metadata.v1.bolt/meta.db
[8:2]     8897B       0B        0B        0B   q2c=0    d2c=0    io.containerd.content.v1.content/blobs/sha256/ff2ba8901a2244acdc607a32e04361bb7b00f9e0c450de2667bcdc4d5e67897
[8:2]     5197B       0B        0B        0B   q2c=0    d2c=0    io.containerd.content.v1.content/blobs/sha256/0955a05f4f65837cb38c6d810b380e10a329d23bcd791630d2448511f538a43

After:

➜  huatuo git:(dir_resolution) ✗ ./_output/bin/iotracing
...
===========================================================================
PID: 478     TOTAL_IO: R=12KB W=146KB  FILES: 1
COMMAND: /usr/lib/systemd/systemd-journald 
-----------------------------------
DEVICE  FS_READ FS_WRITE DISK_READ DISK_WRITE   LATENCY(μs)      FILE/INODE
[8:2]    11776B  150016B        0B   153088B   q2c=469  d2c=444  /var/log/journal/f55d0c7bde9c471882841ea73d3c.../system.journal

===========================================================================
PID: 1297780 TOTAL_IO: R=6.9KB W=103KB  FILES: 3
COMMAND: /usr/bin/containerd 
-----------------------------------
DEVICE  FS_READ FS_WRITE DISK_READ DISK_WRITE   LATENCY(μs)      FILE/INODE
[8:2]        0B  105472B        0B   102912B   q2c=110  d2c=110  /var/lib/containerd/io.containerd.metadata.v1.bolt/meta.db
[8:2]     4448B       0B        0B        0B   q2c=0    d2c=0    /var/lib/containerd/io.containerd.content.v1.con.../blobs/sha256/ff2ba8901a2244acdc607a32e043...
[8:2]     2598B       0B        0B        0B   q2c=0    d2c=0    /var/lib/containerd/io.containerd.content.v1.con.../blobs/sha256/0955a05f4f65837cb38c6d810b38...

The next step could be to further refactor the parsing and storage of file paths in an ebpf map to prevent kernel stack limits

@hao022 hao022 merged commit c57073f into ccfos:main Jan 10, 2026
1 check passed
@sancppp sancppp deleted the dir_resolution branch January 10, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants